Skip to content

Commit

Permalink
LabelImages.crop: fix calibration propagation
Browse files Browse the repository at this point in the history
  • Loading branch information
dlegland committed Aug 17, 2023
1 parent de10333 commit 6a98b8d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/inra/ijpb/label/LabelImages.java
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ public static final ImagePlus cropLabel(ImagePlus imagePlus, int label, int bord
croppedPlus = new ImagePlus(newName, cropped);

// update spatial calibration
Calibration calib = croppedPlus.getCalibration().copy();
Calibration calib = imagePlus.getCalibration().copy();
calib.xOrigin += (bounds.getXMin() - border) * calib.pixelWidth;
calib.yOrigin += (bounds.getYMin() - border) * calib.pixelHeight;
croppedPlus.setCalibration(calib);
Expand All @@ -377,7 +377,7 @@ public static final ImagePlus cropLabel(ImagePlus imagePlus, int label, int bord
croppedPlus = new ImagePlus(newName, cropped);

// update spatial calibration
Calibration calib = croppedPlus.getCalibration().copy();
Calibration calib = imagePlus.getCalibration().copy();
calib.xOrigin += (bounds.getXMin() - border) * calib.pixelWidth;
calib.yOrigin += (bounds.getYMin() - border) * calib.pixelHeight;
calib.zOrigin += (bounds.getZMin() - border) * calib.pixelDepth;
Expand Down

0 comments on commit 6a98b8d

Please sign in to comment.