|
When you read an image it may have origin set at a value different than
(0,0,0). Now if the image is cropped the origin should be moved to maintain
the original coordinate system. Similar when an image with ROI is
duplicated, the new image should have origin of its coordinates moved. This
is important when you want to have correct absolute locations of objects
after cropping of large images or processing parts of the image separately.
I have patch that fixes this for Crop (see draft below), can create one for
Duplicate. Wanted to make sure that I am not missing some possible reason
for the origin being fixed in current code.
Any thoughts?
Jarek
Draft of fix for ij.plugin.Resizer#run() about line 137:
Calibration cal = imp.getCalibration();
if (cal.scaled()) {
cal.pixelWidth *= origWidth/newWidth;
cal.pixelHeight *= origHeight/newHeight;
}
cal.xOrigin -= roi.getBounds().getX();
cal.yOrigin -= roi.getBounds().getY();
imp.setCalibration(cal);
|