[ImageJ-devel] Calibration bug when rotating an image by 90°

Michael Epping m.epping at arcor.de
Thu Mar 21 04:45:01 CDT 2013


Hello,
I hope this is the right address to report a small bug.

Problem:
I use the calibration "Origin (pixels)" with different values for x and 
y. When I rotate an image by 90°, pixel width and pixel height are 
swapped as expected. But the origin stays the same.
The attached code shows that only cal.pixelWidth and cal.pixelHeight are 
swapped but not cal.xOrigin and cal.yOrigin.

Code:
ij.plugin.filter.Transformer

public void run(ImageProcessor ip) {
         if (arg.equals("fliph")) {
             ip.flipHorizontal();
             return;
         }
         if (arg.equals("flipv")) {
             ip.flipVertical();
             return;
         }
         if (arg.equals("right") || arg.equals("left")) {
             StackProcessor sp = new StackProcessor(imp.getStack(), ip);
             ImageStack s2 = null;
             if (arg.equals("right"))
                 s2 = sp.rotateRight();
             else
                 s2 = sp.rotateLeft();
             Calibration cal = imp.getCalibration();
             imp.setStack(null, s2);
             double pixelWidth = cal.pixelWidth;
             cal.pixelWidth = cal.pixelHeight;
             cal.pixelHeight = pixelWidth;
             return;
         }



More information about the ImageJ-devel mailing list