Closed bogovicj closed 2 years ago
When duplicating a selection, the origin is only updated if it is not set to zero in the source image. You can force it to be updated by setting the x origin to small non-zero value like 0.00001. Here is an example:
run("MRI Stack");
run("Properties...", "origin=0.00001,0,0");
makeRectangle(51, 67, 84, 100);
run("Duplicate...", "duplicate");
selectWindow("mri-stack-1.tif");
getImageInfo();
@rasband Why is this the desired behavior? I don't see a downside in always modifying the origin, nor do I see an upside in modifying the origin sometimes but not others.
Doing this workaround in code is one thing, but making users (me) implement this workaround in the UI is quite burdonsome.
Why is this the desired behavior?
This is the way it has always worked and it can't be changed without breaking existing workflows.
@rasband
What about changing the origin when an image is scaled? It seems like the origin should be scaled to the destination image pixels. Would that also break workflows?
This issue has been mentioned on Image.sc Forum. There might be relevant details there:
https://forum.image.sc/t/is-there-a-way-to-get-the-origin-value-from-an-imageplus/67220/5
This is the way it has always worked and it can't be changed without breaking existing workflows.
Which ones ? Can we work on these ? Alternatively could other fields be added in the calibration that would behave differently ? A calibrated 3D matrix to specify the location of the image in 3D would be very useful.
The Image>Scale command in the ImageJ 1.53t1 daily build updates the origin.
@rasband,
Cropping / duplicating an image sometimes updates the origin metadata, but sometimes does not.
From what I can tell, it does not update the origin when it is set to zeros, but do update it otherwise.
I would expect the origin to always be updated.
To reproduce
Running this macro
sets the image origin to some non-zero value, then crops ("Duplicate"s with an ROI). It logs some output, one line of which is:
This is correct, and what I would expect.
Running this macro (same as above but does not set the origin)
also logs some output, one of of which is:
I expect a non-zero origin in this latter situation as well, because the origin when it is opened is
0,0,0