I'm using ImageJ's Java API and need to calculate some data based on multiple selected ROIs (regions of interest).
First I get an instance of the current ROI Manager by using
RoiManager roiMng = RoiManager.getInstance();
Then, I get all ROIs in the manager by using Roi[] rois = roiMng.getRoisAsArray();
.
From here, I need to get the image in the ROI and get some data from it. However, I seem to only get Null back when calling getImage() on a ROI.
Doing something like,
Roi roi = rois[0];
ImagePlus foo = roi.getImage();
int height = foo.getHeight();
gives me 'java.lang.NullPointerException' at the foo.getHeight()
line.
Anyone got any ideas as to what may be going here?
Thanks!