Class ImageMoments
java.lang.Object
com.xinapse.image.ImageMoments
Calculation of factors derived from the moments of an image.
-
Method Summary
Modifier and TypeMethodDescriptionstatic floatgetCentralSliceYAsymmetry(ReadableImage image, Double threshold) Assesses the degree of asymmetry of the central slice of an image, in the y-direction (about the x-axis).static org.jogamp.vecmath.Point3fgetCentreOfMass(ReadableImage image, Double threshold) Calculates the centre of mass of an image.static org.jogamp.vecmath.Point3fgetCentreOfMass(ReadableImage image, Object pixelArray, PixelDataType dataType, Double threshold) Calculates the centre of mass of an image.static org.jogamp.vecmath.Vector3f[]getPrincipalAxes(ReadableImage image, Object pixelArray, PixelDataType dataType, Double threshold, org.jogamp.vecmath.Point3f centreOfMass, boolean allowXRotation, boolean allowYRotation, boolean allowZRotation) Calculates the principal axes of an object in an image.static org.jogamp.vecmath.Vector3f[]getPrincipalAxes(ReadableImage image, org.jogamp.vecmath.Point3f centreOfMass, Double threshold, boolean allowXRotation, boolean allowYRotation, boolean allowZRotation) Calculates the principal axes of an object in an image.static voidRuns the self-test on this Class.
-
Method Details
-
getCentreOfMass
public static org.jogamp.vecmath.Point3f getCentreOfMass(ReadableImage image, Double threshold) throws InvalidImageException Calculates the centre of mass of an image. The origin for the coordinates is at the centre of the field of view in all directions.- Parameters:
image- the image for which to calculates the centre of mass.threshold- if non-null, the intensity threshold. Pixel values below the threshold will not contribute to the calculation of the centre of mass.- Returns:
- the centre of mass of the image, relative to the centre of the field of view in all directions.
- Throws:
InvalidImageException- if the image is invalid.
-
getCentreOfMass
public static org.jogamp.vecmath.Point3f getCentreOfMass(ReadableImage image, Object pixelArray, PixelDataType dataType, Double threshold) throws InvalidImageException Calculates the centre of mass of an image. The origin for the coordinates is at the centre of the field of view in all directions.- Parameters:
image- the image for which to calculates the centre of mass.pixelArray- the pixel values extracted from the image.dataType- thePixelDataTypefor the image pixels.threshold- if non-null, the intensity threshold. The object is defined by pixel will not contribute to the calculation of the centre of mass.- Returns:
- the centre of mass of the image, relative to the centre of the field of view in all directions.
- Throws:
InvalidImageException- if the image is invalid.
-
getPrincipalAxes
public static org.jogamp.vecmath.Vector3f[] getPrincipalAxes(ReadableImage image, org.jogamp.vecmath.Point3f centreOfMass, Double threshold, boolean allowXRotation, boolean allowYRotation, boolean allowZRotation) throws InvalidImageException, NumericalException Calculates the principal axes of an object in an image.- Parameters:
image- the image containing the object for which to calculates the principal axes.centreOfMass- the centre of mass of the image.threshold- if non-null, the threshold that separates the object from the background. If null, the Otsu method is used to set the threshold.allowXRotation- if true then rotation about the x-axis is allowed.allowYRotation- if true then rotation about the y-axis is allowed.allowZRotation- if true then rotation about the z-axis is allowed.- Returns:
- the direction cosines of the principal axes of the image.
- Throws:
InvalidImageException- if the image is invalid.NumericalException- if a numerical error occurs due to bad input data.ConvergenceException- if the matrix inversion fails to converge.
-
getPrincipalAxes
public static org.jogamp.vecmath.Vector3f[] getPrincipalAxes(ReadableImage image, Object pixelArray, PixelDataType dataType, Double threshold, org.jogamp.vecmath.Point3f centreOfMass, boolean allowXRotation, boolean allowYRotation, boolean allowZRotation) throws InvalidImageException, NumericalException Calculates the principal axes of an object in an image.- Parameters:
image- the image containing the object for which to calculate the principal axes.pixelArray- the pixel values extracted from the image.dataType- thePixelDataTypefor the image pixels.threshold- if non-null, the threshold that separates the object from the background. If null, the Otsu method is used to set the threshold.centreOfMass- the centre of mass of the image.allowXRotation- if true, allow rotations about the x-axis.allowYRotation- if true, allow rotations about the y-axis.allowZRotation- if true, allow rotations about the z-axis.- Returns:
- the direction cosines of the principal axes of the image. The returned principal axes are order by Eigen values (largest Eigen value first).
- Throws:
InvalidImageException- if the image is invalid.NumericalException- if a numerical error occurs due to bad input data.ConvergenceException- if the algorithm fails to converge.
-
getCentralSliceYAsymmetry
public static float getCentralSliceYAsymmetry(ReadableImage image, Double threshold) throws InvalidImageException, NumericalException Assesses the degree of asymmetry of the central slice of an image, in the y-direction (about the x-axis).- Parameters:
image- the image for which to assess the degree of asymmetry of the central slice.threshold- if non-null an intensity threshold that separates the background from the foreground pixels.- Returns:
- a normalised asymmetry value.
- Throws:
InvalidImageException- if the image is invalid.NumericalException- a numerical error occurs.
-
main
Runs the self-test on this Class.- Parameters:
args- the first and only argument is the name of an image file.
-