Posted by
Rasband, Wayne (NIH/NIMH) [E] on
Mar 18, 2015; 7:55pm
URL: http://imagej.273.s1.nabble.com/Non-reproducible-bug-on-ImageJ-tp5012035p5012047.html
> On Mar 18, 2015, at 9:20 AM, Philippe CARL <
[hidden email]> wrote:
>
> Dear all / Wayne,
>
> I have got some trouble with an issue on both ImageJ and Fiji that on top of
> this isn't even reproducible which could make it very tricky to fix.
>
> So let's consider the following short macro code:
> run("Blobs (25K)");
> makeRectangle(83, 41, 94, 159);
> run("Crop");
> close();
> run("Blobs (25K)");
> run("Restore Selection");
>
> So sometimes this code finishes with the Blobs picture open on which the
> previously defined ROI (i.e. makeRectangle(83, 41, 94, 159)) is selected (as
> expected).
>
> But sometimes it finishes with all the picture being selected (i.e. similar
> to run("Select All")), and this issue is connected to the fact that there is
> a "run("Crop")" within the code.
Dear Philippe,
The latest ImageJ daily build (1.49q8) adds Roi.copy() and Roi.paste() functions to the macro language. They provide a more reliable way to copy selections from one image to another. Here is your macro code upgraded to use these new functions:
run("Blobs (25K)");
makeRectangle(83, 41, 94, 159);
Roi.copy();
run("Crop");
close();
run("Blobs (25K)");
Roi.paste();
-wayne
> This problem has now no consequences for the macro I was developing since I
> finally use a getBoundingRect(x, y, width, height) to get the rectangular
> ROI position and sizes and apply later on the copied values with a
> makeRectangle (x, y, width, height) instead of a run("Restore Selection").
>
> But it took me quite some time to figure out the origin of the issue and it
> may as well be problematic for other users.
>
> My best regards,
>
> Philippe
>
>
>
> Philippe CARL
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html