Class MipavCoordinateSystems
- java.lang.Object
-
- gov.nih.mipav.util.MipavCoordinateSystems
-
public class MipavCoordinateSystems extends java.lang.Object
MipavCoordinateSystems class. This class provides the interface layer between objects and classes that display information about the ModelImage class and the ModelImage class itself.FileCoordinates -- how the ModelImage data is stored on disk and read into the ModelStorageBase 1D array.
ModelCoordinates -- mapping of the Axial, Coronal, and Sagittal FileCoordinates values into x, y, z (0, 1, 2) positions for array indexing (based on the FileInfoBase.AXIAL, CORONAL, and SAGITTIAL constant defines).
PatientCoordinates, the coordinate axes for displaying the Axial, Coronal, and Sagittal views of the ModelImage data. The mapping of Human-Anatomical axes (Left-Right, Anterior-Posterior, Superior-Inferior) onto PatientCoordinates: Axial = { R2L, A2P, I2S }; Coronal = { R2L, S2I, A2P }; Sagittal = { A2P, S2I, R2L }
This class provides static functions for transforming points from one Coordinate Space into another.
-
-
Constructor Summary
Constructors Constructor Description MipavCoordinateSystems()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
CartesianToPolar2D(ModelImage image, ModelSimpleImage imageR, ModelSimpleImage imageTheta)
Convert the Cartesian coordinate into the Polar coordinate.static void
CartesianToPolar2D(WildMagic.LibFoundation.Mathematics.Vector2f in, WildMagic.LibFoundation.Mathematics.Vector2f out, ModelImage image)
Convert the Cartesian coordinate into the Polar coordinate, point based.static void
CartesianToPolar2D(WildMagic.LibFoundation.Mathematics.Vector2f in, WildMagic.LibFoundation.Mathematics.Vector2f out, WildMagic.LibFoundation.Mathematics.Vector3f center)
Convert the Cartesian coordinate into the Polar coordinate, point based.static int
fileToModel(int iIndex, ModelStorageBase image)
FileToModel transform.static void
fileToModel(WildMagic.LibFoundation.Mathematics.Vector3f pIn, WildMagic.LibFoundation.Mathematics.Vector3f pOut, ModelStorageBase image)
FileToModel transform.static int
fileToPatient(int iIndex, ModelStorageBase image, int orientation)
FileToModel transform.static void
fileToPatient(WildMagic.LibFoundation.Mathematics.Vector3f pIn, WildMagic.LibFoundation.Mathematics.Vector3f pOut, ModelStorageBase image, boolean bFlip, int[] axisOrder, boolean[] axisFlip)
FileToPatient transform.static void
fileToPatient(WildMagic.LibFoundation.Mathematics.Vector3f pIn, WildMagic.LibFoundation.Mathematics.Vector3f pOut, ModelStorageBase image, int orientation)
FileToPatient transform.static void
fileToPatient(WildMagic.LibFoundation.Mathematics.Vector3f pIn, WildMagic.LibFoundation.Mathematics.Vector3f pOut, ModelStorageBase image, int orientation, boolean bFlip)
FileToPatient transform.static void
fileToPatient(WildMagic.LibFoundation.Mathematics.Vector3f pIn, WildMagic.LibFoundation.Mathematics.Vector3f pOut, ModelStorageBase image, int orientation, boolean bFlip, int[] axisOrder, boolean[] axisFlip)
FileToPatient transform.static void
fileToScanner(WildMagic.LibFoundation.Mathematics.Vector3f kInput, WildMagic.LibFoundation.Mathematics.Vector3f kOutput, ModelImage kImage)
Translates the input point into ScannerCoordinates, based on the input image, kImage.static boolean
fromLPS(ModelImage kImage, int[] axisOrder, boolean[] axisFlip)
Returns the axisOrder and axisFlip mapping of the input image from LPS coordinates.private static float
getAngleInDegree(float x, float y)
Get the polar theta angle in Degree [0, 360].private static float
getAngleInRadians(float x, float y)
Get the polar theta value in radians [0 , 2*PI].static boolean[]
getAxisFlip(ModelStorageBase image, int iOrientation)
Get the booean axisFlip array that describes how FileCoordinate axes are inverted in PatientCoordinates.static boolean[]
getAxisFlip(ModelStorageBase image, int iOrientation, boolean bDICOM)
Get the booean axisFlip array that describes how FileCoordinate axes are inverted in PatientCoordinates.static int[]
getAxisOrder(ModelStorageBase image, int iOrientation)
Get the axisOrder array that describes how FileCoordinate axes are remapped for the PatientCoordinates.static void
getAxisOrderInverse(int[] axisOrder, int[] axisOrderInverse)
Inverts the input axisOrder so that points can be mapped back from PatientCoordinates to FileCoordinates.static int[]
getAxisOrientation(ModelStorageBase image)
Gets the axisOrientation variables stored in the image.FileInfoBase object for the input ModelImage, image.private static float
getCartesianX(float r, float angle)
Givem Polar coordinate system r and theta, calculate the Cartesian coordinate X.private static float
getCartesianY(float r, float angle)
Givem Polar coordinate system r and theta, calculate the Cartesian coordinate Y.static int[]
getModelDirections(ModelStorageBase kImage)
Returns the direction vectors for displaying the surface so that it aligns properly with the input ModelImage.static float[][]
getPatientTextureCoordinates(WildMagic.LibFoundation.Mathematics.Vector3f pIn, ModelStorageBase image, int orientation, boolean bFlip)
private static float
getRadius(float x, float y)
Get the radius for the polar coordinate from the given Cartesian coordinatestatic boolean
matchOrientation(int[] axisA, int[] axisB, int[] axisOrder, boolean[] axisFlip)
Returns the axisOrder and axisFlip arrays for mapping axisB image orientation onto axisA image orientation.static void
modelToFile(WildMagic.LibFoundation.Mathematics.Vector3f pIn, WildMagic.LibFoundation.Mathematics.Vector3f pOut, ModelStorageBase image)
ModelToFile transform.static WildMagic.LibFoundation.Mathematics.Vector3f
originLPS(ModelImage kImage)
Returns the image origin in LPS space.static void
patientToFile(WildMagic.LibFoundation.Mathematics.Vector3d pIn, WildMagic.LibFoundation.Mathematics.Vector3d pOut, ModelStorageBase image, int orientation)
PatientToFile transform.static void
patientToFile(WildMagic.LibFoundation.Mathematics.Vector3d pIn, WildMagic.LibFoundation.Mathematics.Vector3d pOut, ModelStorageBase image, int orientation, boolean bFlip)
PatientToFile transform.static void
patientToFile(WildMagic.LibFoundation.Mathematics.Vector3f pIn, WildMagic.LibFoundation.Mathematics.Vector3f pOut, ModelStorageBase image, boolean bFlip, int[] axisOrder, boolean[] axisFlip)
PatientToFile transform.static void
patientToFile(WildMagic.LibFoundation.Mathematics.Vector3f pIn, WildMagic.LibFoundation.Mathematics.Vector3f pOut, ModelStorageBase image, int orientation)
PatientToFile transform.static void
patientToFile(WildMagic.LibFoundation.Mathematics.Vector3f pIn, WildMagic.LibFoundation.Mathematics.Vector3f pOut, ModelStorageBase image, int orientation, boolean bFlip)
PatientToFile transform.static void
PolarToCartesian2D(WildMagic.LibFoundation.Mathematics.Vector2f in, WildMagic.LibFoundation.Mathematics.Vector2f out, ModelImage image)
Convert the Polar coordinate to Cartesian coordinate, point based.static void
PolarToCartisian2D(ModelImage image, ModelSimpleImage imageR, ModelSimpleImage imageTheta)
Whether this routine is necessary, the question will to be decided in the future.static void
scannerToFile(WildMagic.LibFoundation.Mathematics.Vector3f kInput, WildMagic.LibFoundation.Mathematics.Vector3f kOutput, ModelImage kImage)
Translates the input point into FileCoordinates, based on the input image, kImage.static void
scannerToFile(WildMagic.LibFoundation.Mathematics.Vector3f kInput, WildMagic.LibFoundation.Mathematics.Vector3f kOutput, WildMagic.LibFoundation.Mathematics.Vector3f kOriginLPS, ModelImage kImage)
Translates the input point into FileCoordinates, based on the input image, kImage.static boolean
toLPS(ModelImage kImage, int[] axisOrder, boolean[] axisFlip)
Returns the axisOrder and axisFlip mapping of the input image to LPS coordinates.
-
-
-
Method Detail
-
fileToModel
public static final void fileToModel(WildMagic.LibFoundation.Mathematics.Vector3f pIn, WildMagic.LibFoundation.Mathematics.Vector3f pOut, ModelStorageBase image)
FileToModel transform. Transforms points in FileCoordinates into ModelCoordinates. ModelCoordinates map the Axial, Coronal, and Sagittal values from the FileCoordinates point into the x, y, and z positions of the output point.- Parameters:
pIn
- the point in FileCoordinates to be transformedpOut
- return: the transformed point in ModelCoordinatesimage
- the ModelImage for which the transform is done.
-
fileToPatient
public static final void fileToPatient(WildMagic.LibFoundation.Mathematics.Vector3f pIn, WildMagic.LibFoundation.Mathematics.Vector3f pOut, ModelStorageBase image, int orientation)
FileToPatient transform. Transforms points that are in FileCoordinates into PatientCoordinates space, based on the ModelImage and the desired oriented view -- either FileInfoBase.AXIAL, FileInfoBase.CORONAL, FileInfoBase.SAGITTAL, or FileInfoBase.UNKNOWN_ORIENT. Always allows for flipping of the axies using the image orientation information as needed.- Parameters:
pIn
- the FileCoordinates PointpOut
- the Point in PatientCoordinatesimage
- the ModelImage for which the point is being transformed.orientation
- the desired PatientCoordinates orientation.
-
fileToPatient
public static final void fileToPatient(WildMagic.LibFoundation.Mathematics.Vector3f pIn, WildMagic.LibFoundation.Mathematics.Vector3f pOut, ModelStorageBase image, int orientation, boolean bFlip)
FileToPatient transform. Transforms points that are in FileCoordinates into PatientCoordinates space, based on the ModelImage and the desired oriented view -- either FileInfoBase.AXIAL, FileInfoBase.CORONAL, FileInfoBase.SAGITTAL, or FileInfoBase.UNKNOWN_ORIENT:- Parameters:
pIn
- the FileCoordinates PointpOut
- the Point in PatientCoordinatesimage
- the ModelImage for which the point is being transformed.orientation
- the desired PatientCoordinates orientation.bFlip
- when true use axisFlip to flip the PatientCoordinates axis
-
fileToPatient
public static final void fileToPatient(WildMagic.LibFoundation.Mathematics.Vector3f pIn, WildMagic.LibFoundation.Mathematics.Vector3f pOut, ModelStorageBase image, int orientation, boolean bFlip, int[] axisOrder, boolean[] axisFlip)
FileToPatient transform. Transforms points that are in FileCoordinates into PatientCoordinates space, based on the ModelImage and the desired oriented view -- either FileInfoBase.AXIAL, FileInfoBase.CORONAL, FileInfoBase.SAGITTAL, or FileInfoBase.UNKNOWN_ORIENT:- Parameters:
pIn
- input point in FileCoordinatespOut
- output point in PatientCoordinatesimage
- input imageorientation
- patient orientationbFlip
- flag to use axisFlip for inverting axesaxisOrder
- mapping of input and output image orientation axes.axisFlip
- invert flags for the output orientation axes.
-
fileToPatient
public static final void fileToPatient(WildMagic.LibFoundation.Mathematics.Vector3f pIn, WildMagic.LibFoundation.Mathematics.Vector3f pOut, ModelStorageBase image, boolean bFlip, int[] axisOrder, boolean[] axisFlip)
FileToPatient transform. Transforms points that are in FileCoordinates into PatientCoordinates space, based on the ModelImage and the desired oriented view -- either FileInfoBase.AXIAL, FileInfoBase.CORONAL, FileInfoBase.SAGITTAL, or FileInfoBase.UNKNOWN_ORIENT:- Parameters:
pIn
- input point in FileCoordinatespOut
- output point in PatientCoordinatesimage
- input imagebFlip
- flag to use axisFlip for inverting axesaxisOrder
- mapping of input and output image orientation axes.axisFlip
- invert flags for the output orientation axes.
-
fileToScanner
public static final void fileToScanner(WildMagic.LibFoundation.Mathematics.Vector3f kInput, WildMagic.LibFoundation.Mathematics.Vector3f kOutput, ModelImage kImage)
Translates the input point into ScannerCoordinates, based on the input image, kImage.- Parameters:
kInput
- the input point in FileCoordinateskOutput
- the transformed point in ScannerCoordinateskImage
- the image for which the point is being transformed.
-
getAxisFlip
public static final boolean[] getAxisFlip(ModelStorageBase image, int iOrientation)
Get the booean axisFlip array that describes how FileCoordinate axes are inverted in PatientCoordinates. The values are determined by the FileInfoBase.ORI_L2R_TYPE, etc. values stored in the input image.FileInfoBase.axisOrientation and by the desired patient viewing orientation.- Parameters:
image
- DOCUMENT ME!iOrientation
- the desired PatientCoordinates view of the data (AXIAL, SAGITTAL, CORONAL)- Returns:
- DOCUMENT ME!
-
getAxisFlip
public static final boolean[] getAxisFlip(ModelStorageBase image, int iOrientation, boolean bDICOM)
Get the booean axisFlip array that describes how FileCoordinate axes are inverted in PatientCoordinates. The values are determined by the FileInfoBase.ORI_L2R_TYPE, etc. values stored in the input image.FileInfoBase.axisOrientation and by the desired patient viewing orientation.- Parameters:
image
- DOCUMENT ME!iOrientation
- the desired PatientCoordinates view of the data (AXIAL, SAGITTAL, CORONAL)bDICOM
- whether we are trying to find the axis flip array for a translation into DICOM spaces- Returns:
- DOCUMENT ME!
-
getAxisOrder
public static final int[] getAxisOrder(ModelStorageBase image, int iOrientation)
Get the axisOrder array that describes how FileCoordinate axes are remapped for the PatientCoordinates. The axisOrder values are determined by the FileInfoBase.ORI_L2R_TYPE, etc. values stored in the input image and by the desired patient viewing orientation.- Parameters:
image
- DOCUMENT ME!iOrientation
- the desired PatientCoordinates view of the data (AXIAL, SAGITTAL, CORONAL)- Returns:
- DOCUMENT ME!
-
getAxisOrderInverse
public static final void getAxisOrderInverse(int[] axisOrder, int[] axisOrderInverse)
Inverts the input axisOrder so that points can be mapped back from PatientCoordinates to FileCoordinates. The Inverse map is based only on the input axisOrder map.- Parameters:
axisOrder
- DOCUMENT ME!axisOrderInverse
- DOCUMENT ME!
-
getAxisOrientation
public static final int[] getAxisOrientation(ModelStorageBase image)
Gets the axisOrientation variables stored in the image.FileInfoBase object for the input ModelImage, image. If the orientation is undefined, the axes are assigned values based on the image orientation:- Parameters:
image
- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
getModelDirections
public static final int[] getModelDirections(ModelStorageBase kImage)
Returns the direction vectors for displaying the surface so that it aligns properly with the input ModelImage. The direction vectors are transformed into ModelCoordinates.- Parameters:
kImage
- the ModelImage for which the direction vectors are returned.- Returns:
- the direction vectors for the object.
-
modelToFile
public static final void modelToFile(WildMagic.LibFoundation.Mathematics.Vector3f pIn, WildMagic.LibFoundation.Mathematics.Vector3f pOut, ModelStorageBase image)
ModelToFile transform. Transforms points in ModelCoordinates (x = Axial, y = Coronal, z = Sagittal) into FileCoordinates.- Parameters:
pIn
- the point in ModelCoordinates to be transformedpOut
- return: the transformed point in FileCoordinatesimage
- the ModelImage for which the transform is done.
-
patientToFile
public static final void patientToFile(WildMagic.LibFoundation.Mathematics.Vector3f pIn, WildMagic.LibFoundation.Mathematics.Vector3f pOut, ModelStorageBase image, int orientation)
PatientToFile transform. Transforms points that are in PatientCoordinates into FileCoordinates space, based on the ModelImage and the given oriented view -- either FileInfoBase.AXIAL, FileInfoBase.CORONAL, FileInfoBase.SAGITTAL, or FileInfoBase.UNKNOWN_ORIENT. Always allows for flipping of the axies using the image orientation information as needed.- Parameters:
pIn
- the FileCoordinates PointpOut
- the Point in PatientCoordinatesimage
- the ModelImage for which the point is being transformed.orientation
- the desired PatientCoordinates orientation.
-
patientToFile
public static final void patientToFile(WildMagic.LibFoundation.Mathematics.Vector3f pIn, WildMagic.LibFoundation.Mathematics.Vector3f pOut, ModelStorageBase image, int orientation, boolean bFlip)
PatientToFile transform. Transforms points that are in PatientCoordinates into FileCoordinates space, based on the ModelImage and the given oriented view -- either FileInfoBase.AXIAL, FileInfoBase.CORONAL, FileInfoBase.SAGITTAL, or FileInfoBase.UNKNOWN_ORIENT:- Parameters:
pIn
- the PatientCoordinates PointpOut
- the Point in FileCoordinatesimage
- the ModelImage for which the point is being transformed.orientation
- the given PatientCoordinates orientation.bFlip
- when true use axisFlip to flip the PatientCoordinates axis
-
patientToFile
public static final void patientToFile(WildMagic.LibFoundation.Mathematics.Vector3d pIn, WildMagic.LibFoundation.Mathematics.Vector3d pOut, ModelStorageBase image, int orientation)
PatientToFile transform. Transforms points that are in PatientCoordinates into FileCoordinates space, based on the ModelImage and the given oriented view -- either FileInfoBase.AXIAL, FileInfoBase.CORONAL, FileInfoBase.SAGITTAL, or FileInfoBase.UNKNOWN_ORIENT. Always allows for flipping of the axies using the image orientation information as needed.- Parameters:
pIn
- the FileCoordinates PointpOut
- the Point in PatientCoordinatesimage
- the ModelImage for which the point is being transformed.orientation
- the desired PatientCoordinates orientation.
-
patientToFile
public static final void patientToFile(WildMagic.LibFoundation.Mathematics.Vector3d pIn, WildMagic.LibFoundation.Mathematics.Vector3d pOut, ModelStorageBase image, int orientation, boolean bFlip)
PatientToFile transform. Transforms points that are in PatientCoordinates into FileCoordinates space, based on the ModelImage and the given oriented view -- either FileInfoBase.AXIAL, FileInfoBase.CORONAL, FileInfoBase.SAGITTAL, or FileInfoBase.UNKNOWN_ORIENT:- Parameters:
pIn
- the PatientCoordinates PointpOut
- the Point in FileCoordinatesimage
- the ModelImage for which the point is being transformed.orientation
- the given PatientCoordinates orientation.bFlip
- when true use axisFlip to flip the PatientCoordinates axis
-
patientToFile
public static final void patientToFile(WildMagic.LibFoundation.Mathematics.Vector3f pIn, WildMagic.LibFoundation.Mathematics.Vector3f pOut, ModelStorageBase image, boolean bFlip, int[] axisOrder, boolean[] axisFlip)
PatientToFile transform. Transforms points that are in PatientCoordinates into FileCoordinates space, based on the ModelImage and the desired oriented view -- either FileInfoBase.AXIAL, FileInfoBase.CORONAL, FileInfoBase.SAGITTAL, or FileInfoBase.UNKNOWN_ORIENT:- Parameters:
pIn
- input point in FileCoordinatespOut
- output point in PatientCoordinatesimage
- input imagebFlip
- flag to use axisFlip for inverting axesaxisOrder
- mapping of input and output image orientation axes.axisFlip
- invert flags for the output orientation axes.
-
scannerToFile
public static final void scannerToFile(WildMagic.LibFoundation.Mathematics.Vector3f kInput, WildMagic.LibFoundation.Mathematics.Vector3f kOutput, ModelImage kImage)
Translates the input point into FileCoordinates, based on the input image, kImage.- Parameters:
kInput
- the input point in ScannerCoordinateskOutput
- the transformed point in FileCoordinateskImage
- the image for which the point is being transformed.
-
scannerToFile
public static final void scannerToFile(WildMagic.LibFoundation.Mathematics.Vector3f kInput, WildMagic.LibFoundation.Mathematics.Vector3f kOutput, WildMagic.LibFoundation.Mathematics.Vector3f kOriginLPS, ModelImage kImage)
Translates the input point into FileCoordinates, based on the input image, kImage.- Parameters:
kInput
- the input point in ScannerCoordinateskOutput
- the transformed point in FileCoordinateskImage
- the image for which the point is being transformed.
-
getPatientTextureCoordinates
public static final float[][] getPatientTextureCoordinates(WildMagic.LibFoundation.Mathematics.Vector3f pIn, ModelStorageBase image, int orientation, boolean bFlip)
- Parameters:
pIn
- the FileCoordinates Pointimage
- the ModelImage for which the point is being transformed.orientation
- the desired PatientCoordinates orientation.bFlip
- when true use axisFlip to flip the PatientCoordinates axis
-
fileToModel
public static final int fileToModel(int iIndex, ModelStorageBase image)
FileToModel transform. Transforms points in FileCoordinates into ModelCoordinates. ModelCoordinates map the Axial, Coronal, and Sagittal values from the FileCoordinates point into the x, y, and z positions of the output point.- Parameters:
image
- the ModelImage for which the transform is done.
-
fileToPatient
public static final int fileToPatient(int iIndex, ModelStorageBase image, int orientation)
FileToModel transform. Transforms points in FileCoordinates into ModelCoordinates. ModelCoordinates map the Axial, Coronal, and Sagittal values from the FileCoordinates point into the x, y, and z positions of the output point.- Parameters:
image
- the ModelImage for which the transform is done.
-
toLPS
public static final boolean toLPS(ModelImage kImage, int[] axisOrder, boolean[] axisFlip)
Returns the axisOrder and axisFlip mapping of the input image to LPS coordinates.- Parameters:
kImage
- input image.axisOrder
- output mapping axis re-order.axisFlip
- output mapping axis flip.- Returns:
- true if the image is not already LPS i.e the image would change to convert to LPS.
-
fromLPS
public static final boolean fromLPS(ModelImage kImage, int[] axisOrder, boolean[] axisFlip)
Returns the axisOrder and axisFlip mapping of the input image from LPS coordinates.- Parameters:
kImage
- input image.axisOrder
- output mapping axis re-order.axisFlip
- output mapping axis flip.- Returns:
- true if the image is not already LPS i.e the image would change to convert to LPS.
-
matchOrientation
public static final boolean matchOrientation(int[] axisA, int[] axisB, int[] axisOrder, boolean[] axisFlip)
Returns the axisOrder and axisFlip arrays for mapping axisB image orientation onto axisA image orientation. The returned arrays describe how to reorient axisB so that it is in the target orientation axisA.- Parameters:
axisA
- target image orientation (L2R, R2L, A2P, P2A, I2S, S2I, etc.)axisB
- image orientation to re-map so that it matches axisAaxisOrder
- re-mapping of the axes.axisFlip
- invert flags for the new axes.- Returns:
- false when the orientations already match, true when the axisOrder and axisFlip arrays are set.
-
originLPS
public static final WildMagic.LibFoundation.Mathematics.Vector3f originLPS(ModelImage kImage)
Returns the image origin in LPS space. Determines the mapping of the current image space to LPS (x = R2L, y = A2P, z = I2S) space. Returns the origin in the new coordinate space.- Returns:
- image origin in LPS coordinate space.
-
CartesianToPolar2D
public static final void CartesianToPolar2D(WildMagic.LibFoundation.Mathematics.Vector2f in, WildMagic.LibFoundation.Mathematics.Vector2f out, ModelImage image)
Convert the Cartesian coordinate into the Polar coordinate, point based.- Parameters:
in
- image pixel coordinate, in.x = x, in.y = y.out
- polar coordinate out.x = r, out.y = theta.image
- source image.
-
CartesianToPolar2D
public static final void CartesianToPolar2D(WildMagic.LibFoundation.Mathematics.Vector2f in, WildMagic.LibFoundation.Mathematics.Vector2f out, WildMagic.LibFoundation.Mathematics.Vector3f center)
Convert the Cartesian coordinate into the Polar coordinate, point based.- Parameters:
in
- image pixel coordinate, in.x = x, in.y = y.out
- polar coordinate out.x = r, out.y = theta.center
- polar coordinate center
-
CartesianToPolar2D
public static final void CartesianToPolar2D(ModelImage image, ModelSimpleImage imageR, ModelSimpleImage imageTheta)
Convert the Cartesian coordinate into the Polar coordinate.- Parameters:
image
- source model image.imageR
- image R buffer to save the r value of Polar coordinate.imageTheta
- image Theta buffer to save the theta value of the Polar coordinate.
-
PolarToCartesian2D
public static void PolarToCartesian2D(WildMagic.LibFoundation.Mathematics.Vector2f in, WildMagic.LibFoundation.Mathematics.Vector2f out, ModelImage image)
Convert the Polar coordinate to Cartesian coordinate, point based.- Parameters:
in
- polar coordinate, in.x = r, in.y = theta.out
- image pixel coordinate, out.x = x, out.y = y;image
- source image.
-
PolarToCartisian2D
public static void PolarToCartisian2D(ModelImage image, ModelSimpleImage imageR, ModelSimpleImage imageTheta)
Whether this routine is necessary, the question will to be decided in the future. This approach just converts x, y Cartesian from polar coordinate perspective. Actually, the imageR and imageTheta should be the input images, and the source image should hold the Cartesian coordinate results. We need to decide this later. Reference: imageJ Polar coordinate transformer.- Parameters:
image
- source imageimageR
- polar coordinate R image.imageTheta
- polar coordinate Theta image.
-
getCartesianX
private static float getCartesianX(float r, float angle)
Givem Polar coordinate system r and theta, calculate the Cartesian coordinate X.- Parameters:
r
- polar coordinate r value.angle
- poloar coordinate theta value.- Returns:
- Cartesian coordinate X value.
-
getCartesianY
private static float getCartesianY(float r, float angle)
Givem Polar coordinate system r and theta, calculate the Cartesian coordinate Y.- Parameters:
r
- polar coordinate r value.angle
- poloar coordinate theta value.- Returns:
- Cartesian coordinate Y value.
-
getRadius
private static float getRadius(float x, float y)
Get the radius for the polar coordinate from the given Cartesian coordinate- Parameters:
x
- Cartesian x coordinatey
- Cartesian y coordinate- Returns:
- polar coordinate radius
-
getAngleInDegree
private static float getAngleInDegree(float x, float y)
Get the polar theta angle in Degree [0, 360]. Reference: imageJ polar coordinate transformer.- Parameters:
x
- Cartesian x coordinatey
- Cartesian y coordinate- Returns:
- the polar theta angle in degree.
-
getAngleInRadians
private static float getAngleInRadians(float x, float y)
Get the polar theta value in radians [0 , 2*PI]. Reference: http://en.wikipedia.org/wiki/Polar_coordinate_system.- Parameters:
x
- Cartesian x coordinatey
- Cartesian y coordinate- Returns:
- the polar theta angle in radians.
-
-