ImageJ icon indicating copy to clipboard operation
ImageJ copied to clipboard

ImageStack.getRoi() inconsistent behaviour

Open mdoube opened this issue 10 months ago • 1 comments

final Rectangle r = stack.getRoi();

Used to give a Rectangle either of the bounds of the ROI if one was set or with the dimensions and origin of the whole image.

You could then use r.x or r.width regardless of whether there was an ROI or not, to scan pixels inside the ROI (if one was set) or the whole image (if no ROI was set).

Recently this broke so that this behaviour was not maintained leading to legacy code not working any more.

I fixed this for BoneJ's Slice Geometry by using ImagePlus.getRoi().getBounds() instead of the ImageStack-based methods. https://github.com/bonej-org/BoneJ2/pull/346/commits/8e9141951418906cd68f4a9b6de5ba609f63cbc7

mdoube avatar Apr 26 '24 05:04 mdoube