Hi Michael,

in this case, ImageJ has two conflicting pieces of information:
(1) The names of the channels. The first channel is named 'Red', etc.
(2) The Lookup Tables (LUTs) of the channels.

It seems that the first one is honored when converting to RGB.
(But you can't swap colors by just renaming; it seems that the slice labels override the LUTs only if they are in the correct sequence, "Red", "Green", "Blue.")

You can remove the slice labels with
  Property.setSliceLabel("", 1);
  Property.setSliceLabel("", 2);
  Property.setSliceLabel("", 3);


Michael
________________________________________________________________
On 03.07.24 17:53, Cammer, Michael wrote:
I was trying to convert an image back to RGB after using run("Make
Composite") and ran into a problem.  Instead of converting the image as
shown to RGB, the channels were reassigned RGB in the original order.
In this example run on my computer, the red and green channels should be
  swapped, but the resulting RGB image has them not swapped.  Is this
expected behavior or a bug?

1.54k11

Thank you!

// Creates a test RGB Image.  Instead, use any existing RGB image.
newImage("Test HyperStack", "8-bit color-mode", 512, 256, 3, 1, 1);
setSlice(1);
makeRectangle(23, 27, 139, 182);
run("Set...", "value=255 slice");
setSlice(2);
makeRectangle(126, 44, 139, 182);
run("Set...", "value=255 slice");
setSlice(3);
makeRectangle(234, 70, 139, 182);
run("Set...", "value=255 slice");
Property.set("CompositeProjection", "Sum");
Stack.setDisplayMode("composite");
run("Select None");
run("RGB Color");


//swap channels and convert to RGB
run("Make Composite");
setSlice(1);
run("Green");
setSlice(2);
run("Red");
waitForUser("Red and green should be swapped");
run("RGB Color");
// The resulting image I get is the original RGB image, not the one with
  channels swapped.


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

Reply via email to