Module ij
Package ij.measure

Class Calibration

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class Calibration
    extends java.lang.Object
    implements java.lang.Cloneable
    Calibration objects contain an image's spatial and density calibration data.
    • Constructor Summary

      Constructors 
      Constructor Description
      Calibration()
      Constructs a new Calibration object using the default values.
      Calibration​(ImagePlus imp)
      Constructs a new Calibration object using the default values.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean calibrated()
      Returns true if this image is density calibrated.
      java.lang.Object clone()  
      Calibration copy()
      Returns a clone of this object.
      void disableDensityCalibration()  
      boolean equals​(Calibration cal)
      Compares two Calibration objects for equality.
      double[] getCoefficients()
      Returns the calibration function coefficients.
      float[] getCTable()
      Returns the calibration table.
      double getCValue​(double value)
      Converts a raw pixel value to a density calibrated value.
      double getCValue​(int value)
      Converts a raw pixel value to a density calibrated value.
      int getFunction()
      Returns the calibration function ID.
      boolean getInvertY()
      Returns the 'invertY' flag.
      double getRawValue​(double value)
      Converts a density calibrated value into a raw pixel value.
      double getRawX​(double x)
      Converts a x-coordinate in physical units to pixels.
      double getRawY​(double y)
      Converts a y-coodinate in physical units to pixels.
      double getRawY​(double y, int imageHeight)
      Converts a y-coodinate in physical units to pixels, taking into account the 'invertY' flag.
      double getRawZ​(double z)
      Converts a z-coodinate in physical units to pixels.
      java.lang.String getTimeUnit()
      Returns the distance unit (e.g.
      java.lang.String getUnit()
      Returns the default length unit (e.g.
      java.lang.String getUnits()
      Returns the plural form of the length unit (e.g.
      java.lang.String getValueUnit()
      Returns the value unit.
      double getX​(double x)
      Converts a x-coodinate in pixels to physical units (e.g.
      java.lang.String getXUnit()
      Returns the X length unit.
      java.lang.String getXUnits()
      Returns the plural form of the X length unit (e.g.
      double getY​(double y)
      Converts a y-coordinate in pixels to physical units (e.g.
      double getY​(double y, int imageHeight)
      Converts a y-coordinate in pixels to physical units (e.g.
      java.lang.String getYUnit()
      Returns the Y length unit, or the default unit if 'yunit' is null.
      java.lang.String getYUnits()
      Returns the plural form of the Y length unit (e.g.
      double getZ​(double z)
      Converts a z-coordinate in pixels to physical units (e.g.
      java.lang.String getZUnit()
      Returns the Z length unit, or the default unit if 'zunit' is null.
      java.lang.String getZUnits()
      Returns the plural form of the Z length unit (e.g.
      boolean isSigned16Bit()
      Returns true if this is a signed 16-bit image.
      boolean scaled()
      Returns 'true' if this image is spatially calibrated.
      boolean scaledOrOffset()
      Returns 'true' if this image is spatially calibrated or has offsets.
      void setCTable​(float[] table, java.lang.String unit)
      Sets the calibration table.
      void setFunction​(int function, double[] coefficients, java.lang.String unit)
      Sets the calibration function, coefficient table and unit (e.g.
      void setFunction​(int function, double[] coefficients, java.lang.String unit, boolean zeroClip)  
      void setImage​(ImagePlus imp)
      Disables the density calibation if the specified image has a differenent bit depth.
      void setInvertY​(boolean invertYCoordinates)
      Sets the 'invertY' flag.
      static void setLoopBackAndForth​(boolean loop)
      Set the default state of the animation "Loop back and forth" flag
      void setSigned16BitCalibration()
      Sets up a calibration function that subtracts 32,768 from pixel values.
      void setTimeUnit​(java.lang.String unit)
      Sets the time unit (e.g.
      void setUnit​(java.lang.String unit)
      Sets the default length unit (e.g.
      void setValueUnit​(java.lang.String unit)
      Sets the value unit.
      void setXUnit​(java.lang.String unit)
      Sets the X length unit.
      void setYUnit​(java.lang.String unit)
      Sets the Y length unit.
      void setZUnit​(java.lang.String unit)
      Sets the Z length unit.
      java.lang.String toString()  
      boolean zeroClip()
      Returns true if zero clipping is enabled.
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • DEFAULT_VALUE_UNIT

        public static final java.lang.String DEFAULT_VALUE_UNIT
        See Also:
        Constant Field Values
      • pixelWidth

        public double pixelWidth
        Pixel width in 'unit's
      • pixelHeight

        public double pixelHeight
        Pixel height in 'unit's
      • pixelDepth

        public double pixelDepth
        Pixel depth in 'unit's
      • frameInterval

        public double frameInterval
        Frame interval in 'timeUnit's
      • fps

        public double fps
        Frame rate in frames per second
      • loop

        public boolean loop
      • xOrigin

        public double xOrigin
        X origin in pixels.
      • yOrigin

        public double yOrigin
        Y origin in pixels.
      • zOrigin

        public double zOrigin
        Z origin in pixels.
      • info

        public java.lang.String info
        Plugin writers can use this string to store information about the image. This string is saved in the TIFF header if it is not longer than 64 characters and it contains no '=' or '\n' characters.
    • Constructor Detail

      • Calibration

        public Calibration​(ImagePlus imp)
        Constructs a new Calibration object using the default values.
      • Calibration

        public Calibration()
        Constructs a new Calibration object using the default values. For density calibration, the image is assumed to be 8-bits.
    • Method Detail

      • scaled

        public boolean scaled()
        Returns 'true' if this image is spatially calibrated.
      • scaledOrOffset

        public boolean scaledOrOffset()
        Returns 'true' if this image is spatially calibrated or has offsets.
      • setUnit

        public void setUnit​(java.lang.String unit)
        Sets the default length unit (e.g. "mm", "inch").
      • setXUnit

        public void setXUnit​(java.lang.String unit)
        Sets the X length unit.
      • setYUnit

        public void setYUnit​(java.lang.String unit)
        Sets the Y length unit.
      • setZUnit

        public void setZUnit​(java.lang.String unit)
        Sets the Z length unit.
      • getUnit

        public java.lang.String getUnit()
        Returns the default length unit (e.g. "micron", "inch").
      • getXUnit

        public java.lang.String getXUnit()
        Returns the X length unit.
      • getYUnit

        public java.lang.String getYUnit()
        Returns the Y length unit, or the default unit if 'yunit' is null.
      • getZUnit

        public java.lang.String getZUnit()
        Returns the Z length unit, or the default unit if 'zunit' is null.
      • getUnits

        public java.lang.String getUnits()
        Returns the plural form of the length unit (e.g. "microns", "inches").
      • getXUnits

        public java.lang.String getXUnits()
        Returns the plural form of the X length unit (e.g. "microns", "inches"), or of the default unit if 'xunit' is null.
      • getYUnits

        public java.lang.String getYUnits()
        Returns the plural form of the Y length unit (e.g. "microns", "inches"), or of the default unit if 'yunit' is null.
      • getZUnits

        public java.lang.String getZUnits()
        Returns the plural form of the Z length unit (e.g. "microns", "inches"), or of the default unit if 'zunit' is null.
      • setTimeUnit

        public void setTimeUnit​(java.lang.String unit)
        Sets the time unit (e.g. "sec", "msec").
      • getTimeUnit

        public java.lang.String getTimeUnit()
        Returns the distance unit (e.g. "sec", "msec").
      • getX

        public double getX​(double x)
        Converts a x-coodinate in pixels to physical units (e.g. mm).
      • getY

        public double getY​(double y)
        Converts a y-coordinate in pixels to physical units (e.g. mm).
      • getY

        public double getY​(double y,
                           int imageHeight)
        Converts a y-coordinate in pixels to physical units (e.g. mm), taking into account the invertY and global "Invert Y Coordinates" flags.
      • getZ

        public double getZ​(double z)
        Converts a z-coordinate in pixels to physical units (e.g. mm).
      • getRawX

        public double getRawX​(double x)
        Converts a x-coordinate in physical units to pixels.
      • getRawY

        public double getRawY​(double y)
        Converts a y-coodinate in physical units to pixels.
      • getRawZ

        public double getRawZ​(double z)
        Converts a z-coodinate in physical units to pixels.
      • getRawY

        public double getRawY​(double y,
                              int imageHeight)
        Converts a y-coodinate in physical units to pixels, taking into account the 'invertY' flag.
      • setFunction

        public void setFunction​(int function,
                                double[] coefficients,
                                java.lang.String unit)
        Sets the calibration function, coefficient table and unit (e.g. "OD").
      • setFunction

        public void setFunction​(int function,
                                double[] coefficients,
                                java.lang.String unit,
                                boolean zeroClip)
      • setImage

        public void setImage​(ImagePlus imp)
        Disables the density calibation if the specified image has a differenent bit depth.
      • disableDensityCalibration

        public void disableDensityCalibration()
      • getValueUnit

        public java.lang.String getValueUnit()
        Returns the value unit.
      • setValueUnit

        public void setValueUnit​(java.lang.String unit)
        Sets the value unit.
      • getCoefficients

        public double[] getCoefficients()
        Returns the calibration function coefficients.
      • calibrated

        public boolean calibrated()
        Returns true if this image is density calibrated.
      • getFunction

        public int getFunction()
        Returns the calibration function ID.
      • getCTable

        public float[] getCTable()
        Returns the calibration table. With 8-bit images, the table has a length of 256. With 16-bit images, the length is 65536.
      • setCTable

        public void setCTable​(float[] table,
                              java.lang.String unit)
        Sets the calibration table. With 8-bit images, the table must have a length of 256. With 16-bit images, it must be 65536.
      • getCValue

        public double getCValue​(int value)
        Converts a raw pixel value to a density calibrated value.
      • getCValue

        public double getCValue​(double value)
        Converts a raw pixel value to a density calibrated value.
      • getRawValue

        public double getRawValue​(double value)
        Converts a density calibrated value into a raw pixel value.
      • copy

        public Calibration copy()
        Returns a clone of this object.
      • clone

        public java.lang.Object clone()
        Overrides:
        clone in class java.lang.Object
      • equals

        public boolean equals​(Calibration cal)
        Compares two Calibration objects for equality.
      • isSigned16Bit

        public boolean isSigned16Bit()
        Returns true if this is a signed 16-bit image.
      • setSigned16BitCalibration

        public void setSigned16BitCalibration()
        Sets up a calibration function that subtracts 32,768 from pixel values.
      • zeroClip

        public boolean zeroClip()
        Returns true if zero clipping is enabled.
      • setInvertY

        public void setInvertY​(boolean invertYCoordinates)
        Sets the 'invertY' flag.
      • getInvertY

        public boolean getInvertY()
        Returns the 'invertY' flag.
      • setLoopBackAndForth

        public static void setLoopBackAndForth​(boolean loop)
        Set the default state of the animation "Loop back and forth" flag
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object