0

I am using ImageJ API in java. I got an array of ROIs from Particle Analyser tool. I need to get just the detected area into another image(just a white or transparent bg). How can I do that?

Arun Baby
  • 67
  • 6

1 Answers1

1

Duplicate the image (which duplicates only the bounding box of the current ROI), then clear the area outside the ROI.

ImagePlus region = imp.duplicate();
region.show();
region.restoreRoi();
IJ.setBackgroundColor(255, 255, 255);
IJ.run("Clear Outside", "");

You can use the Macro Recorder set to Java mode to get many of these commands.

ctrueden
  • 6,751
  • 3
  • 37
  • 69