Package com.xinapse.image
Class ImageMoments
java.lang.Object
com.xinapse.image.ImageMoments
Calculation of factors derived from the moments of an image.
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.jogamp.vecmath.Point3f
getCentreOfMass
(ReadableImage image, Double threshold, boolean radiological) Calculates the centre of mass of an image.static org.jogamp.vecmath.Point3f
getCentreOfMass
(ReadableImage image, Object pixelArray, PixelDataType dataType) Calculates the centre of mass of an image.static org.jogamp.vecmath.Vector3f[]
getPrincipalAxes
(ReadableImage image, Object pixelArray, PixelDataType dataType, org.jogamp.vecmath.Point3f centreOfMass, boolean inPlaneOnly) Calculates the principal axes of an image.static org.jogamp.vecmath.Vector3f[]
getPrincipalAxes
(ReadableImage image, org.jogamp.vecmath.Point3f centreOfMass, Double threshold, boolean inPlaneOnly, boolean radiological) Calculates the principal axes of an image.static void
Runs the self-test on this Class.
-
Method Details
-
getCentreOfMass
public static org.jogamp.vecmath.Point3f getCentreOfMass(ReadableImage image, Double threshold, boolean radiological) throws InvalidImageException, InvalidArgumentException 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.radiological
- whether pixel values should be retrieved from the image in radiological orientation, so that the centre-of-mass will be located relative to the radiologically- oriented image.- Returns:
- the centre of mass of the image, relative to the centre of the field of view in all directions.
- Throws:
InvalidArgumentException
- if the dimensionality of the image is greater than 3.InvalidImageException
- if the image is invalid.
-
getCentreOfMass
public static org.jogamp.vecmath.Point3f getCentreOfMass(ReadableImage image, Object pixelArray, PixelDataType dataType) 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
- thePixelDataType
for the image pixels.- 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 inPlaneOnly, boolean radiological) throws InvalidImageException, NumericalException, ConvergenceException Calculates the principal axes of an image.- Parameters:
image
- the image for which to calculates the principal axes.centreOfMass
- the centre of mass of the image.threshold
- the intensity threshold. If non-null, pixel values below the threshold will not contribute to the calculation of the principal axes.inPlaneOnly
- if true, the in-plane rotation of the axes only is calculated.radiological
- whether pixel values should be retrieved from the image in radiological orientation, so that the axes will be oriented relative to the radiologically- oriented image.- 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, org.jogamp.vecmath.Point3f centreOfMass, boolean inPlaneOnly) throws InvalidImageException, NumericalException, ConvergenceException Calculates the principal axes of an image.- Parameters:
image
- the image for which to calculates the principal axes.pixelArray
- the pixel values extracted from the image.dataType
- thePixelDataType
for the image pixels.centreOfMass
- the centre of mass of the image.inPlaneOnly
- if true, the in-plane rotation of the axes only is calculated.- 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.
-
main
Runs the self-test on this Class.- Parameters:
args
- the first and only argument is the name of an image file.
-