Question

I have an image that is 2048*2048. When I run the following macros:

makeRectangle(304, 304, 1450, 1450);
run("Crop");

it then results in an image of 1450*1450. Why not (1450-303)*(1450-303)?

Était-ce utile?

La solution

Because makeRectangle expects the x and y coordinates of the upper left corner, as well as the width and height (not the coordinates of the lower right corner) of the rectangular selection.

The line

makeRectangle(304, 304, 1450, 1450);

is equivalent to

run("Specify...", "width=1450 height=1450 x=304 y=304");

(see also the ImageJ user guide)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top