ROI Manager "Flatten [F]" command

Hello ImageJ team,

I am trying to implement roiManager(“Flatten”); command, but I am getting and “invalid ROI Manager command in line 64. roiManage(“flatten” <)>:” error.

Can someone help me?

I am just trying to combine image created by ROI Color Coder and the original photo.



Hi @erikagedvilaite,

Are you referring to the ROI Color Coder that is part of the BAR suite of scripts from the BAR Update site?
It is not clear exactly what you are trying to accomplish without seeing your macro (without sharing it, none of us can guess what you have on line 64. But the error may be you are forgetting an r , i.e., roiManage**r**("flatten"); (Edit: Sorry, wrote in haste and did not notice the argument being passed to the roiManager() built-in macro function. As mention in the accepted answer below, "Flatten" is not a valid option (at least for IJ 1.50g or older). I also wanted to mention that the “flattening” of ROI Color Coder overlays is discussed in the first documentation page of the macro.

1 Like

According to the documentation, there is no roiManager("Flatten"); command. When I run the macro recorder and then press the Flatten button in the ROI Manager, this is what gets recorded:


also corresponding to the menu command Image > Overlay > Flatten that does the same thing.


Thank you for the correction. Much appreciated.