ij.measure
Class Calibration

java.lang.Object
  extended by ij.measure.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.


Field Summary
static int CUSTOM
           
static int EXPONENTIAL
           
 double fps
          Frame rate in frames per second
 double frameInterval
          Frame interval in 'timeUnit's
static int GAMMA_VARIATE
           
 java.lang.String info
          Plugin writers can use this string to store information about the image.
static int LOG
           
static int LOG2
           
static int NONE
           
 double pixelDepth
          Pixel depth in 'unit's
 double pixelHeight
          Pixel height in 'unit's
 double pixelWidth
          Pixel width in 'unit's
static int POLY2
           
static int POLY3
           
static int POLY4
           
static int POWER
           
static int RODBARD
           
static int RODBARD2
           
static int STRAIGHT_LINE
           
static int UNCALIBRATED_OD
           
 double xOrigin
          X origin in pixels.
 double yOrigin
          Y origin in pixels.
 double zOrigin
          Z origin in pixels.
 
Constructor Summary
Calibration()
          Constructs a new Calibration object using the default values.
Calibration(ImagePlus imp)
          Constructs a new Calibration object using the default values.
 
Method Summary
 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.
 double getRawValue(double value)
          Converts a density calibrated value into a raw pixel value.
 java.lang.String getTimeUnit()
          Returns the distance unit (e.g.
 java.lang.String getUnit()
          Returns the 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.
 double getY(double y)
          Converts a y-coodinate in pixels to physical units (e.g.
 double getY(double y, int imageHeight)
          Converts a y-coodinate in pixels to physical units (e.g.
 double getZ(double z)
          Converts a z-coodinate in pixels to physical units (e.g.
 boolean isSigned16Bit()
          Returns true if this is a signed 16-bit image.
 boolean scaled()
          Returns true if this image is spatially calibrated.
 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.
 void setTimeUnit(java.lang.String unit)
          Sets the time unit (e.g.
 void setUnit(java.lang.String unit)
          Sets the length unit (e.g.
 void setValueUnit(java.lang.String unit)
          Sets the value 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

STRAIGHT_LINE

public static final int STRAIGHT_LINE
See Also:
Constant Field Values

POLY2

public static final int POLY2
See Also:
Constant Field Values

POLY3

public static final int POLY3
See Also:
Constant Field Values

POLY4

public static final int POLY4
See Also:
Constant Field Values

EXPONENTIAL

public static final int EXPONENTIAL
See Also:
Constant Field Values

POWER

public static final int POWER
See Also:
Constant Field Values

LOG

public static final int LOG
See Also:
Constant Field Values

RODBARD

public static final int RODBARD
See Also:
Constant Field Values

GAMMA_VARIATE

public static final int GAMMA_VARIATE
See Also:
Constant Field Values

LOG2

public static final int LOG2
See Also:
Constant Field Values

RODBARD2

public static final int RODBARD2
See Also:
Constant Field Values

NONE

public static final int NONE
See Also:
Constant Field Values

UNCALIBRATED_OD

public static final int UNCALIBRATED_OD
See Also:
Constant Field Values

CUSTOM

public static final int CUSTOM
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


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.


setUnit

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


getUnit

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


getUnits

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


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-coodinate in pixels to physical units (e.g. mm).


getY

public double getY(double y,
                   int imageHeight)
Converts a y-coodinate 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-coodinate in pixels to physical units (e.g. mm).


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.


zeroClip

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


setInvertY

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


toString

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