imagej / ImageJ

Public domain software for processing and analyzing scientific images
http://imagej.org
Other
576 stars 227 forks source link

Error when duplicating an image with a selection outside the image borders; change default behavior #254

Closed bvandenbroek closed 4 months ago

bvandenbroek commented 4 months ago

Hello! When duplicating an image containing an (invisibe) ROI outside the image borders, ImageJ gives an error 'ROI is outside the image'. This may be expected behavior, but wouldn't it be better to first show the option to 'ignore selection'? (because if checked the error message becomes irrelevant)

ROIs that are outside the image may not occur frequently, but in a script it can happen (as it did for me). It causes a crash, regardless whether the 'ignore selection' flag is true or false. I suggest that duplicating the complete image becomes the default action when the ROI is outside the image.

Reproduce with:

run("Blobs (25K)");
makeRectangle(300, 300, 50, 50);
run("Duplicate...", "title=test ignore");

Thanks, Bram van den Broek

rasband commented 4 months ago

The ImageJ 1.54k10 daily build duplicates the entire image when the ROI is outside the image. The commit is at https://github.com/imagej/ImageJ/commit/b9b7f9386c387a69fa3053f98f8c496560fe3fbb.

BioImaging-NKI commented 4 months ago

Thanks Wayne!