I’m trying to automize a process which involves overlaying a mask and a grayscale image. Manually, this can be achieved by clicking “Image->Color->MergeChannels…” and converting the resulting image to RGB “Image->Type->RGBColor” with channel4(gray)=grayscale image and channel1(red)=mask. When doing this in macro, it looks like this
run("Merge Channels...", "c1=maskimage c4=inputimage create"); run("RGB Color", "slices"); run("MHD/MHA ...", "save=overlay.mha");
and this also works fine when calling it from macro editor (Plugins->Macros->Edit). However, the system I’m trying to use this macro is a headless server, hence I’d like to run that in headless mode, i.e.
./ImageJ/ImageJ --headless -macro ./overlay.ijm
Now, the two images are merged in an interleaved way, i.e., first frame from image1, first frame from image2, second frame from image1, … but what I want is the image with the mask drawn in.
Am I just things wrong here or is this kind of a bug?
I’ve tried to achieve the same thing using python
redChannelImg = ImagePlus("mask.mha") grayscaleImg = ImagePlus("gray.mha") overlay = RGBStackMerge.mergeChannels([redChannelImg, grayscaleImg], False) overlay.show()
but couldn’t get it working (mergeChannels-call fails). Maybe someone knows how to do that call right.