Class AlgorithmTransform

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.awt.event.WindowListener, java.lang.Runnable, java.util.EventListener

    public class AlgorithmTransform
    extends AlgorithmBase
    Transforms Volume by resampling using transformation matrix and the choice of nearest-neighbor, trilinear interpolation, 3rd order Bspline, 4th order Bspline, cubic Lagrangian, quintic Lagrangian, heptic Lagrangian, or windowed sinc. Must indicate output volume's desired resolutions and dimensions.

    Also includes static methods to transform images. Once caution - these static methods are NOT run in a separate thread. Consequently, if a progress bar is sent into the method to update progress, it should not include a cancel button because the user is unable to cancel a static transformation. If we want a transformation to have the ability to be cancelled, we should NOT use the static method, but rather construct a new AlgorithmTransform and run the algorithm using the standard .run() method.

    NOTE for possible improvements in the future. To move images into "mm" space we presently multiple by voxel resolutions as we loop through the dimensions. A more efficent method is to modify the scale values of the the transformation matrix (i.e. the diagonals). This would speed the process by reducing the number of mults and divisions. Not sure how much but faster is better. Change should happen here and in the JDialogTransform interface.

    This version of AlgorithmTransform includes a flag (passed as the last parameter) indicating whether to pad the image volume.

    Version:
    0.1 Nov, 1999
    Author:
    Delia McGarry, William Gandler, Matthew McAuliffe, Zohara Cohen
    • Field Detail

      • NEAREST_NEIGHBOR

        public static final int NEAREST_NEIGHBOR
        Nearest neighbor interpolation.
        See Also:
        Constant Field Values
      • BSPLINE3

        public static final int BSPLINE3
        Cubic bspline interpolation.
        See Also:
        Constant Field Values
      • BSPLINE4

        public static final int BSPLINE4
        Quadratic bspline interpolation.
        See Also:
        Constant Field Values
      • CUBIC_LAGRANGIAN

        public static final int CUBIC_LAGRANGIAN
        Cubic lagrangian interpolation.
        See Also:
        Constant Field Values
      • QUINTIC_LAGRANGIAN

        public static final int QUINTIC_LAGRANGIAN
        Quintic lagrangian interpolation.
        See Also:
        Constant Field Values
      • HEPTIC_LAGRANGIAN

        public static final int HEPTIC_LAGRANGIAN
        Heptic lagrangian interpolation.
        See Also:
        Constant Field Values
      • updateOrigin

        private static boolean updateOrigin
        DOCUMENT ME!
      • imgOrigin

        private static float[] imgOrigin
        DOCUMENT ME!
      • imgOrient

        private static int imgOrient
        DOCUMENT ME!
      • axisOrient

        private static int[] axisOrient
        DOCUMENT ME!
      • direct

        private static int[] direct
        DOCUMENT ME!
      • margins

        private static int[] margins
        DOCUMENT ME!
      • startPos

        private static float startPos
        DOCUMENT ME!
      • startTime

        private static float startTime
      • bufferFactor

        private int bufferFactor
        DOCUMENT ME!
      • center

        private WildMagic.LibFoundation.Mathematics.Vector3f center
        DOCUMENT ME!
      • clip

        private boolean clip
        DOCUMENT ME!
      • destResolutions

        private float[] destResolutions
        DOCUMENT ME!
      • DIM

        private int DIM
        DOCUMENT ME!
      • do25D

        private boolean do25D
        DOCUMENT ME!
      • doCenter

        private boolean doCenter
        DOCUMENT ME!
      • imgBuf

        private double[] imgBuf
        DOCUMENT ME!
      • imgBuf2

        private float[] imgBuf2
        DOCUMENT ME!
      • imgLength

        private int imgLength
        DOCUMENT ME!
      • imgLength2

        private int imgLength2
        DOCUMENT ME!
      • interp

        private final int interp
        DOCUMENT ME!
      • isSATransform

        private boolean isSATransform
        flag for determining if the transform is for scanner anatomical (->AXIAL).
      • iXdim

        private final int iXdim
        DOCUMENT ME!
      • iYdim

        private final int iYdim
        DOCUMENT ME!
      • iZdim

        private int iZdim
      • iTdim

        private int iTdim
      • iXres

        private float iXres
        DOCUMENT ME!
      • iYres

        private float iYres
        DOCUMENT ME!
      • iZres

        private float iZres
      • oUnits

        private final int[] oUnits
        DOCUMENT ME!
      • oXdim

        private int oXdim
        DOCUMENT ME!
      • oYdim

        private int oYdim
        DOCUMENT ME!
      • oZdim

        private int oZdim
        DOCUMENT ME!
      • oTdim

        private int oTdim
        DOCUMENT ME!
      • oXres

        private final float oXres
        DOCUMENT ME!
      • oYres

        private final float oYres
        DOCUMENT ME!
      • oZres

        private float oZres
      • pad

        private boolean pad
        DOCUMENT ME!
      • fillValue

        private float fillValue
        Used for out of bounds values in the transformation routines. Set to (float)srcImage.getMin() in the constructors.
      • srcImage

        private ModelImage srcImage
        DOCUMENT ME!
      • destImage

        private ModelImage destImage
        DOCUMENT ME!
      • maskImage

        private ModelImage maskImage
        DOCUMENT ME!
      • transformVOI

        private boolean transformVOI
        DOCUMENT ME!
      • transMatrix

        private final TransMatrix transMatrix
        DOCUMENT ME!
      • haveCentered

        private boolean haveCentered
      • suppressProgressBar

        private boolean suppressProgressBar
    • Constructor Detail

      • AlgorithmTransform

        public AlgorithmTransform​(ModelImage srcImage,
                                  TransMatrix xfrm,
                                  int interp,
                                  float oXres,
                                  float oYres,
                                  int oXdim,
                                  int oYdim,
                                  boolean tVOI,
                                  boolean clip,
                                  boolean pad)
        2D constructor for transformation algorithm. Also used for 2.5D algorithms on 3D and 4D images.
        Parameters:
        srcImage - ModelImage to be transformed
        xfrm - Transformation matrix to be applied
        interp - Type of interpolation (NEAREST_NEIGHBOR, BILINEAR, BSPLINE3, BSPLINE4, etc)
        oXres - X resolution of output image
        oYres - Y resolution of output image
        oXdim - X dimension of output image
        oYdim - Y dimension of output image
        tVOI - if true the VOI should be transformed with the volume
        clip - if true output range is clipped to input range
        pad - if true output image is padded so that none of the image is clipped
      • AlgorithmTransform

        public AlgorithmTransform​(ModelImage srcImage,
                                  TransMatrix xfrm,
                                  int interp,
                                  float oXres,
                                  float oYres,
                                  int oXdim,
                                  int oYdim,
                                  int[] units,
                                  boolean tVOI,
                                  boolean clip,
                                  boolean pad)
        Creates a new AlgorithmTransform object.
        Parameters:
        srcImage - ModelImage to be transformed
        xfrm - Transformation matrix to be applied
        interp - Type of interpolation (NEAREST_NEIGHBOR, BILINEAR, BSPLINE3, BSPLINE4, etc)
        oXres - X resolution of output image
        oYres - Y resolution of output image
        oXdim - X dimension of output image
        oYdim - Y dimension of output image
        units - DOCUMENT ME!
        tVOI - if true the VOI should be transformed with the volume
        clip - if true output range is clipped to input range
        pad - if true output image is padded so that none of the image is clipped
      • AlgorithmTransform

        public AlgorithmTransform​(ModelImage srcImage,
                                  TransMatrix xfrm,
                                  int interp,
                                  float oXres,
                                  float oYres,
                                  int oXdim,
                                  int oYdim,
                                  int[] units,
                                  boolean tVOI,
                                  boolean clip,
                                  boolean pad,
                                  boolean doCenter,
                                  WildMagic.LibFoundation.Mathematics.Vector3f center)
        Creates a new AlgorithmTransform object.
        Parameters:
        srcImage - DOCUMENT ME!
        xfrm - DOCUMENT ME!
        interp - DOCUMENT ME!
        oXres - DOCUMENT ME!
        oYres - DOCUMENT ME!
        oXdim - DOCUMENT ME!
        oYdim - DOCUMENT ME!
        units - DOCUMENT ME!
        tVOI - DOCUMENT ME!
        clip - DOCUMENT ME!
        pad - DOCUMENT ME!
        doCenter -
        center -
      • AlgorithmTransform

        public AlgorithmTransform​(ModelImage _srcImage,
                                  TransMatrix xfrm,
                                  int interp,
                                  float _oXres,
                                  float _oYres,
                                  float _oZres,
                                  int _oXdim,
                                  int _oYdim,
                                  int _oZdim,
                                  boolean tVOI,
                                  boolean clip,
                                  boolean pad)
        3D constructor for transformation algorithm. Also used for 3D algorithms on 4D images.
        Parameters:
        _srcImage - ModelImage to be transformed
        xfrm - Transformation matrix to be applied
        interp - Type of interpolation (NEAREST_NEIGHBOR, TRILINEAR, BSPLINE3, BSPLINE4, etc)
        _oXres - X resolution of output image
        _oYres - Y resolution of output image
        _oZres - Z resolution of output image
        _oXdim - X dimension of output image
        _oYdim - Y dimension of output image
        _oZdim - Z dimension of output image
        tVOI - if true the VOI should be transformed with the volume
        clip - if true output range is clipped to input range
        pad - if true output image is padded so that none of the image is clipped
      • AlgorithmTransform

        public AlgorithmTransform​(ModelImage _srcImage,
                                  TransMatrix xfrm,
                                  int interp,
                                  float _oXres,
                                  float _oYres,
                                  float _oZres,
                                  int _oXdim,
                                  int _oYdim,
                                  int _oZdim,
                                  int[] units,
                                  boolean tVOI,
                                  boolean clip,
                                  boolean pad)
        Creates a new $class.name$ object.
        Parameters:
        _srcImage - DOCUMENT ME!
        xfrm - DOCUMENT ME!
        interp - DOCUMENT ME!
        _oXres - DOCUMENT ME!
        _oYres - DOCUMENT ME!
        _oZres - DOCUMENT ME!
        _oXdim - DOCUMENT ME!
        _oYdim - DOCUMENT ME!
        _oZdim - DOCUMENT ME!
        units - DOCUMENT ME!
        tVOI - DOCUMENT ME!
        clip - DOCUMENT ME!
        pad - DOCUMENT ME!
      • AlgorithmTransform

        public AlgorithmTransform​(ModelImage _srcImage,
                                  TransMatrix xfrm,
                                  int interp,
                                  float _oXres,
                                  float _oYres,
                                  float _oZres,
                                  int _oXdim,
                                  int _oYdim,
                                  int _oZdim,
                                  int[] units,
                                  boolean tVOI,
                                  boolean clip,
                                  boolean pad,
                                  boolean doCenter,
                                  WildMagic.LibFoundation.Mathematics.Vector3f center)
        Creates a new $class.name$ object.
        Parameters:
        _srcImage - DOCUMENT ME!
        xfrm - DOCUMENT ME!
        interp - DOCUMENT ME!
        _oXres - DOCUMENT ME!
        _oYres - DOCUMENT ME!
        _oZres - DOCUMENT ME!
        _oXdim - DOCUMENT ME!
        _oYdim - DOCUMENT ME!
        _oZdim - DOCUMENT ME!
        units - DOCUMENT ME!
        tVOI - DOCUMENT ME!
        clip - DOCUMENT ME!
        pad - DOCUMENT ME!
        doCenter -
        center -
    • Method Detail

      • setSuppressProgressBar

        public void setSuppressProgressBar​(boolean suppressProgressBar)
        Parameters:
        suppressProgressBar -
      • bspline

        public static ModelImage bspline​(ModelImage image,
                                         ModelImage resultImage,
                                         int degree,
                                         TransMatrix xfrm,
                                         ViewJProgressBar progressBar)
        Performs bspline interpolation on black and white image data.
        Parameters:
        image - Image from which the data is derived
        resultImage - Image to put result in; can be null.
        degree - Degree of the spline algorithm, either 3 or 4.
        xfrm - Transformation to apply.
        progressBar - Buffer containing image data.
        Returns:
        DOCUMENT ME!
      • bspline4D

        public static ModelImage bspline4D​(ModelImage image,
                                           ModelImage resultImage,
                                           int degree,
                                           TransMatrix xfrm,
                                           ViewJProgressBar progressBar)
        Performs bspline interpolation on black and white image data in 4D image. Works time slice by time slice.
        Parameters:
        image - Image from which the data is derived
        resultImage - Image to put result in; can be null.
        degree - Degree of the spline algorithm, either 3 or 4.
        xfrm - Transformation to apply.
        progressBar - Buffer containing image data.
        Returns:
        DOCUMENT ME!
      • bsplineC

        public static ModelImage bsplineC​(ModelImage image,
                                          ModelImage resultImage,
                                          int degree,
                                          TransMatrix xfrm,
                                          ViewJProgressBar progressBar)
        Performs bspline interpolation on color image data.
        Parameters:
        image - Image from which the data is derived
        resultImage - Image to put result in; can be null.
        degree - Degree of the spline algorithm, either 3 or 4.
        xfrm - Transformation to apply.
        progressBar - Buffer containing image data.
        Returns:
        DOCUMENT ME!
      • bsplineC4D

        public static ModelImage bsplineC4D​(ModelImage image,
                                            ModelImage resultImage,
                                            int degree,
                                            TransMatrix xfrm,
                                            ViewJProgressBar progressBar)
        Performs bspline interpolation on color image data in 4D image. Works time slice by time slice.
        Parameters:
        image - Image from which the data is derived
        resultImage - Image to put result in; can be null.
        degree - Degree of the spline algorithm, either 3 or 4.
        xfrm - Transformation to apply.
        progressBar - Buffer containing image data.
        Returns:
        DOCUMENT ME!
      • getImageMargins

        public static int[] getImageMargins​(ModelImage srcImage,
                                            TransMatrix transMatrix,
                                            float dxOut,
                                            float dyOut,
                                            float dzOut)
        Calculate necessary padding for image given applied transform.
        Parameters:
        srcImage - DOCUMENT ME!
        transMatrix - array with transformation matrix
        dxOut - DOCUMENT ME!
        dyOut - DOCUMENT ME!
        dzOut - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • matrixtoInverseArray

        public static final TransMatrix matrixtoInverseArray​(TransMatrix transMatrix)
        Converts matrix to inverse array.
        Parameters:
        transMatrix - Matrix to convert.
        Returns:
        The inverted array.
      • transformBilinear

        public static final void transformBilinear​(ModelImage image,
                                                   ModelImage transformedImg,
                                                   TransMatrix trans,
                                                   ViewJProgressBar progressBar)
        Transforms using bilinear interpolation.
        Parameters:
        image - Image to be transformed
        transformedImg - Transformed image
        trans - Transformation matrix to be applied
        progressBar - Progress bar to update. Can be null. Should NOT have cancel button.
      • transformBilinear

        public static final void transformBilinear​(ModelImage image,
                                                   ModelImage transformedImg,
                                                   TransMatrix trans,
                                                   ViewJProgressBar progressBar,
                                                   boolean activeImage)
        Transforms using bilinear interpolation.
        Parameters:
        image - Image to be transformed
        transformedImg - Transformed image
        trans - Transformation matrix to be applied
        progressBar - Progress bar to update. Can be null. Should NOT have cancel button.
        activeImage - true if the algorithm is being run in a separate thread, false otherwise, to control progress bar repainting
      • transformBilinear

        public static final void transformBilinear​(ModelImage image,
                                                   ModelImage transformedImg,
                                                   TransMatrix trans,
                                                   ViewJProgressBar progressBar,
                                                   boolean activeImage,
                                                   float fillValue)
        Transforms using bilinear interpolation.
        Parameters:
        image - Image to be transformed
        transformedImg - Transformed image
        trans - Transformation matrix to be applied
        progressBar - Progress bar to update. Can be null. Should NOT have cancel button.
        activeImage - true if the algorithm is being run in a separate thread, false otherwise, to control progress bar repainting
        fillValue - value used for out of bounds pixels
      • transformBilinear

        public static final void transformBilinear​(float[] imgBuf,
                                                   ModelImage transformedImg,
                                                   TransMatrix trans,
                                                   int iXdim,
                                                   int iYdim,
                                                   float iXres,
                                                   float iYres,
                                                   ViewJProgressBar progressBar)
        Transforms using bilinear interpolation.
        Parameters:
        imgBuf - Image buffer to be transformed
        transformedImg - Transformed image
        trans - Transformation matrix to be applied
        iXdim - X dimension of input image
        iYdim - Y dimension of input image
        iXres - X resolution of input image
        iYres - Y resolution of input image
        progressBar - Progress bar to update. Can be null. Should NOT have cancel button.
      • transformBilinear

        public static final void transformBilinear​(float[] imgBuf,
                                                   ModelImage transformedImg,
                                                   TransMatrix trans,
                                                   int iXdim,
                                                   int iYdim,
                                                   float iXres,
                                                   float iYres,
                                                   ViewJProgressBar progressBar,
                                                   boolean activeImage)
        Transforms using bilinear interpolation.
        Parameters:
        imgBuf - Image buffer to be transformed
        transformedImg - Transformed image
        trans - Transformation matrix to be applied
        iXdim - X dimension of input image
        iYdim - Y dimension of input image
        iXres - X resolution of input image
        iYres - Y resolution of input image
        progressBar - Progress bar to update. Can be null. Should NOT have cancel button.
        activeImage - true if the algorithm is being run in a separate thread, false otherwise, to control progress bar repainting
      • transformBilinear

        public static final void transformBilinear​(float[] imgBuf,
                                                   float[] tImgBuf,
                                                   TransMatrix trans,
                                                   int iXdim,
                                                   int iYdim,
                                                   float iXres,
                                                   float iYres,
                                                   int oXdim,
                                                   int oYdim,
                                                   float oXres,
                                                   float oYres,
                                                   ViewJProgressBar progressBar)
        Transforms using bilinear interpolation.
        Parameters:
        imgBuf - Image buffer to be transformed
        tImgBuf - Transformed image
        trans - Transformation matrix to be applied
        iXdim - X dimension of input image
        iYdim - Y dimension of input image
        iXres - X resolution of input image
        iYres - Y resolution of input image
        oXdim - X dimension of output image
        oYdim - Y dimension of output image
        oXres - X resolution of output image
        oYres - Y resolution of output image
        progressBar - Progress bar to be updated. Can be null. Should NOT have cancel button.
      • transformBilinear

        public static final void transformBilinear​(float[] imgBuf,
                                                   float[] tImgBuf,
                                                   TransMatrix trans,
                                                   int iXdim,
                                                   int iYdim,
                                                   float iXres,
                                                   float iYres,
                                                   int oXdim,
                                                   int oYdim,
                                                   float oXres,
                                                   float oYres,
                                                   ViewJProgressBar progressBar,
                                                   boolean activeImage)
        Transforms using bilinear interpolation.
        Parameters:
        imgBuf - Image buffer to be transformed
        tImgBuf - Transformed image
        trans - Transformation matrix to be applied
        iXdim - X dimension of input image
        iYdim - Y dimension of input image
        iXres - X resolution of input image
        iYres - Y resolution of input image
        oXdim - X dimension of output image
        oYdim - Y dimension of output image
        oXres - X resolution of output image
        oYres - Y resolution of output image
        progressBar - Progress bar to be updated. Can be null. Should NOT have cancel button.
        activeImage - true if the algorithm is being run in a separate thread, false otherwise, to control progress bar repainting
      • transformBilinearC

        public static final void transformBilinearC​(ModelImage image,
                                                    ModelImage transformedImg,
                                                    TransMatrix trans,
                                                    int oXdim,
                                                    int oYdim,
                                                    float oXres,
                                                    float oYres)
        Used on color images. USE THIS IF OUTPUT IMAGE HAS DIFFERENT DIM/RES THAN INPUT IMAGE
        Parameters:
        image - Input image to be transformed
        transformedImg - Transformed image
        trans - Transformation matrix to be applied
        oXdim - Dimensions of output image
        oYdim - Dimensions of output image
        oXres - Resolutions of output image
        oYres - Resolutions of output image
      • transformBilinearC

        public static final void transformBilinearC​(ModelImage image,
                                                    ModelImage transformedImg,
                                                    TransMatrix trans,
                                                    int oXdim,
                                                    int oYdim,
                                                    float oXres,
                                                    float oYres,
                                                    float fillValue)
        Used on color images. USE THIS IF OUTPUT IMAGE HAS DIFFERENT DIM/RES THAN INPUT IMAGE
        Parameters:
        image - Input image to be transformed
        transformedImg - Transformed image
        trans - Transformation matrix to be applied
        oXdim - Dimensions of output image
        oYdim - Dimensions of output image
        oXres - Resolutions of output image
        oYres - Resolutions of output image
        fillValue - value used for out of bounds pixel transformations
      • transformNearestNeighbor2D

        public static final void transformNearestNeighbor2D​(float[] imgBuf,
                                                            float[] tImgBuf,
                                                            TransMatrix trans,
                                                            int xdim,
                                                            int ydim)
        Transforms using Nearest neighbor interpolation.
        Parameters:
        imgBuf - Image buffer to be transformed
        tImgBuf - Transformed image buffer
        trans - Transformation matrix to be applied
        xdim - X dimension of input AND output image
        ydim - Y dimension of input AND output image
      • transformNearestNeighbor2D

        public static final void transformNearestNeighbor2D​(float[] imgBuf,
                                                            float[] tImgBuf,
                                                            TransMatrix trans,
                                                            int iXdim,
                                                            int iYdim,
                                                            float iXres,
                                                            float iYres,
                                                            int oXdim,
                                                            int oYdim,
                                                            float oXres,
                                                            float oYres)
        Transforms using Nearest neighbor interpolation.
        Parameters:
        imgBuf - Image buffer to be transformed
        tImgBuf - Transformed image buffer
        trans - Transformation matrix to be applied
        iXdim - X dimension of input image
        iYdim - Y dimension of input image
        iXres - X resolution of input image
        iYres - Y resolution of input image
        oXdim - X dimension of output image
        oYdim - Y dimension of output image
        oXres - X resolution of output image
        oYres - Y resolution of output image
      • transformNearestNeighbor3D

        public static final void transformNearestNeighbor3D​(float[] imgBuf,
                                                            ModelImage transformedImg,
                                                            int Xdim,
                                                            int Ydim,
                                                            int Zdim,
                                                            TransMatrix trans)
        Transforms and resamples volume using nearest neighbor interpolation.
        Parameters:
        imgBuf - Image array to transform
        transformedImg - Transformed image.
        Xdim - X dimension of input image
        Ydim - Y dimension of input image
        Zdim - Z dimension of input image
        trans - Transformation matrix to be applied
      • transformTrilinear

        public static final void transformTrilinear​(ModelImage image,
                                                    ModelImage transformedImg,
                                                    TransMatrix trans,
                                                    ViewJProgressBar progressBar)
        Transforms and resamples volume using trilinear interpolation.
        Parameters:
        image - Image to transform
        transformedImg - Transformed image.
        trans - Transformation matrix to be applied
        progressBar - The progress bar. Can be null. Should NOT have a cancel button.
      • transformTrilinear

        public static final void transformTrilinear​(ModelImage image,
                                                    ModelImage transformedImg,
                                                    TransMatrix trans,
                                                    ViewJProgressBar progressBar,
                                                    boolean activeImage)
        Transforms and resamples volume using trilinear interpolation.
        Parameters:
        image - Image to transform
        transformedImg - Transformed image.
        trans - Transformation matrix to be applied
        progressBar - The progress bar. Can be null. Should NOT have a cancel button.
        activeImage - true if the algorithm is being run in a separate thread, false otherwise, to control progress bar repainting
      • transformTrilinear

        public static final void transformTrilinear​(ModelImage image,
                                                    ModelImage transformedImg,
                                                    TransMatrix trans,
                                                    ViewJProgressBar progressBar,
                                                    boolean activeImage,
                                                    float fillValue)
        Transforms and resamples volume using trilinear interpolation.
        Parameters:
        image - Image to transform
        transformedImg - Transformed image.
        trans - Transformation matrix to be applied
        progressBar - The progress bar. Can be null. Should NOT have a cancel button.
        activeImage - true if the algorithm is being run in a separate thread, false otherwise, to control progress bar repainting
        fillValue - value used if transformed pixel is out of bounds
      • transformTrilinear

        public static final void transformTrilinear​(float[] imgBuffer,
                                                    ModelImage transformedImg,
                                                    TransMatrix trans,
                                                    int iXdim,
                                                    int iYdim,
                                                    int iZdim,
                                                    float iXres,
                                                    float iYres,
                                                    float iZres,
                                                    ViewJProgressBar progressBar)
        Transforms and resamples volume using trilinear interpolation.
        Parameters:
        imgBuffer - Image array
        transformedImg - Image after transform
        trans - Transformation matrix to be applied
        iXdim - X dimension of input image
        iYdim - Y dimension of input image
        iZdim - Z dimension of input image
        iXres - X resolution of input image
        iYres - Y resolution of input image
        iZres - Z resolution of input image
        progressBar - Progress bar to update. Can be null. Should NOT have a cancel button.
      • transformTrilinear

        public static final void transformTrilinear​(float[] imgBuffer,
                                                    ModelImage transformedImg,
                                                    TransMatrix trans,
                                                    int iXdim,
                                                    int iYdim,
                                                    int iZdim,
                                                    float iXres,
                                                    float iYres,
                                                    float iZres,
                                                    ViewJProgressBar progressBar,
                                                    boolean activeImage)
        Transforms and resamples volume using trilinear interpolation.
        Parameters:
        imgBuffer - Image array
        transformedImg - Image after transform
        trans - Transformation matrix to be applied
        iXdim - X dimension of input image
        iYdim - Y dimension of input image
        iZdim - Z dimension of input image
        iXres - X resolution of input image
        iYres - Y resolution of input image
        iZres - Z resolution of input image
        progressBar - Progress bar to update. Can be null. Should NOT have a cancel button.
        activeImage - true if the algorithm is being run in a separate thread, false otherwise, to control progress bar repainting
      • transformTrilinear

        public static final void transformTrilinear​(float[] imgBuffer,
                                                    float[] tImgBuf,
                                                    TransMatrix trans,
                                                    int iXdim,
                                                    int iYdim,
                                                    int iZdim,
                                                    float iXres,
                                                    float iYres,
                                                    float iZres,
                                                    int oXdim,
                                                    int oYdim,
                                                    int oZdim,
                                                    float oXres,
                                                    float oYres,
                                                    float oZres,
                                                    ViewJProgressBar progressBar)
        Transforms and resamples volume using trilinear interpolation.
        Parameters:
        imgBuffer - Image buffer to be transformed
        tImgBuf - Transformed image
        trans - Transformation matrix to be applied
        iXdim - X dimension of input image
        iYdim - Y dimension of input image
        iZdim - Z dimension of input image
        iXres - X resolution of input image
        iYres - Y resolution of input image
        iZres - Z resolution of input image
        oXdim - X dimension of output image
        oYdim - Y dimension of output image
        oZdim - Z dimension of output image
        oXres - X resolution of output image
        oYres - Y resolution of output image
        oZres - Z resolution of output image
        progressBar - Progress bar. Can be null. Should NOT have cancel button.
      • transformTrilinear

        public static final void transformTrilinear​(float[] imgBuffer,
                                                    float[] tImgBuf,
                                                    TransMatrix trans,
                                                    int iXdim,
                                                    int iYdim,
                                                    int iZdim,
                                                    float iXres,
                                                    float iYres,
                                                    float iZres,
                                                    int oXdim,
                                                    int oYdim,
                                                    int oZdim,
                                                    float oXres,
                                                    float oYres,
                                                    float oZres,
                                                    ViewJProgressBar progressBar,
                                                    boolean activeImage)
        Transforms and resamples volume using trilinear interpolation.
        Parameters:
        imgBuffer - Image buffer to be transformed
        tImgBuf - Transformed image
        trans - Transformation matrix to be applied
        iXdim - X dimension of input image
        iYdim - Y dimension of input image
        iZdim - Z dimension of input image
        iXres - X resolution of input image
        iYres - Y resolution of input image
        iZres - Z resolution of input image
        oXdim - X dimension of output image
        oYdim - Y dimension of output image
        oZdim - Z dimension of output image
        oXres - X resolution of output image
        oYres - Y resolution of output image
        oZres - Z resolution of output image
        progressBar - Progress bar. Can be null. Should NOT have cancel button.
        activeImage - true if the algorithm is being run in a separate thread, false otherwise, to control progress bar repainting
      • transformTrilinear4D

        public static ModelImage transformTrilinear4D​(ModelImage image,
                                                      ModelImage resultImage,
                                                      TransMatrix xfrm,
                                                      ViewJProgressBar progressBar)
        Performs trilinear interpolation on black and white image data in a 4D image. Works time slice by time slice
        Parameters:
        image - Image from which the data is derived
        resultImage - Image to put result in; can be null.
        xfrm - Transformation to apply.
        progressBar - Buffer containing image data.
        Returns:
        DOCUMENT ME!
      • transformTrilinearC

        public static ModelImage transformTrilinearC​(ModelImage image,
                                                     ModelImage resultImage,
                                                     float[] imgBuffer,
                                                     TransMatrix xfrm,
                                                     ViewJProgressBar progressBar)
        Performs trilinear interpolation on color image data.
        Parameters:
        image - Image from which the data is derived
        resultImage - Image to put result in; can be null.
        imgBuffer - Buffer containing image data.
        xfrm - Transformation to apply.
        progressBar - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • transformTrilinearC

        public static final void transformTrilinearC​(ModelImage image,
                                                     ModelImage transformedImg,
                                                     TransMatrix trans,
                                                     int oXdim,
                                                     int oYdim,
                                                     int oZdim,
                                                     float oXres,
                                                     float oYres,
                                                     float oZres)
        Transforms and resamples volume using trilinear interpolation Use on color images USE THIS IF OUTPUT IMAGE HAS DIFFERENT DIM/RES THAN INPUT IMAGE.
        Parameters:
        image - Image to transform
        transformedImg - Result image.
        trans - Transformation matrix to be applied
        oXdim - DOCUMENT ME!
        oYdim - DOCUMENT ME!
        oZdim - DOCUMENT ME!
        oXres - DOCUMENT ME!
        oYres - DOCUMENT ME!
        oZres - DOCUMENT ME!
      • transformTrilinearC

        public static final void transformTrilinearC​(ModelImage image,
                                                     ModelImage transformedImg,
                                                     TransMatrix trans,
                                                     int oXdim,
                                                     int oYdim,
                                                     int oZdim,
                                                     float oXres,
                                                     float oYres,
                                                     float oZres,
                                                     float fillValue)
        Transforms and resamples volume using trilinear interpolation Use on color images USE THIS IF OUTPUT IMAGE HAS DIFFERENT DIM/RES THAN INPUT IMAGE.
        Parameters:
        image - Image to transform
        transformedImg - Result image.
        trans - Transformation matrix to be applied
        oXdim - DOCUMENT ME!
        oYdim - DOCUMENT ME!
        oZdim - DOCUMENT ME!
        oXres - DOCUMENT ME!
        oYres - DOCUMENT ME!
        oZres - DOCUMENT ME!
        fillValue - value if transformed pixel is out of bounds
      • transformTrilinearC4D

        public static ModelImage transformTrilinearC4D​(ModelImage image,
                                                       ModelImage resultImage,
                                                       TransMatrix xfrm,
                                                       ViewJProgressBar progressBar)
        Performs trilinear interpolation on color image data in a 4D image. Works time slice by time slice.
        Parameters:
        image - Image from which the data is derived
        resultImage - Image to put result in; can be null.
        xfrm - Transformation to apply.
        progressBar - Buffer containing image data.
        Returns:
        DOCUMENT ME!
      • disposeLocal

        public void disposeLocal()
        Dispose of local variables that may be taking up lots of room.
      • finalize

        public void finalize()
        Prepares this class for destruction.
        Overrides:
        finalize in class AlgorithmBase
      • getImageMargins

        private int[] getImageMargins​(ModelImage srcImage,
                                      TransMatrix transMatrix,
                                      float dxOut,
                                      float dyOut)
        Calculate necessary padding for image given applied transform.
        Parameters:
        srcImage - DOCUMENT ME!
        transMatrix - array with transformation matrix
        dxOut - DOCUMENT ME!
        dyOut - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • getTransformedImage

        public ModelImage getTransformedImage()
        Returns transformed volume.
        Returns:
        destImage
      • setCenter

        public void setCenter​(WildMagic.LibFoundation.Mathematics.Vector3f center)
        DOCUMENT ME!
        Parameters:
        center - DOCUMENT ME!
      • setDoCenter

        public void setDoCenter​(boolean doCenter)
        DOCUMENT ME!
        Parameters:
        doCenter - DOCUMENT ME!
      • setFillValue

        public void setFillValue​(float fillValue)
        Set value for out of bounds transformation values. Set in constructors to a default of srcImage.getMin().
        Parameters:
        fillValue -
      • setPadValue

        @Deprecated
        public void setPadValue​(float padValue)
        Deprecated.
        The value is not just used for padding. Please use setFillValue().
        Set value for out of bounds transformation values. Set in constructors to a default of srcImage.getMin().
        Parameters:
        padValue -
      • setUpdateOriginFlag

        public void setUpdateOriginFlag​(boolean originFlag)
        Sets the origin flag used indicated that origin should be changed based using the supplied transformation matrix.
        Parameters:
        originFlag - if true sets the updateOrigin flag to true
      • setUseScannerAnatomical

        public void setUseScannerAnatomical​(boolean useSA)
        Sets the tranform to set orientation to AXIAL (this is a scanner anatomical transform).
        Parameters:
        useSA - set to axial orientation
      • updateFileInfo

        private static void updateFileInfo​(ModelImage image,
                                           ModelImage resultImage,
                                           float[] resolutions,
                                           int[] units,
                                           TransMatrix matrix,
                                           boolean useSATransform,
                                           AlgorithmBase srcAlg)
        Copy important file information to resultant image structure.
        Parameters:
        image - Source image.
        resultImage - Resultant image.
        resolutions - DOCUMENT ME!
        units - DOCUMENT ME!
        matrix - DOCUMENT ME!
        useSATransform - DOCUMENT ME!
        m -
      • updateOrigin

        private static void updateOrigin​(TransMatrix xfrm)
        Update origin. Translate the image origin from image space to patient space (scanner space). The basic ideas, tranlate the (0,0,0) point from scaner space to image space, then subtract the original image origin. The (0, 0, 0) point is the upper left corner of the scanner space's image.
        Parameters:
        xfrm - DOCUMENT ME!
      • updateOrigin

        private void updateOrigin()
        Translate the image origin from image space to patient space (scanner space). The basic ideas, tranlate the (0,0,0) point from scaner space to image space, then multiply the resolution, and subtract the image origin. The (0, 0, 0) point is the upper left corner of the scanner space's image.
      • transform

        private void transform()
        Creates buffer for new image, prepares transformation matrix, and calls transform function for interpolation specified.
      • transform2DVOI

        private void transform2DVOI​(ModelImage image,
                                    double[] imgBuffer,
                                    TransMatrix kTM)
        Transforms and resamples a 2D VOI using nearest neighbor interpolation.
          For each VOI in VOIVector:
        1. Export VOIs as a mask image
        2. Transform mask
        3. Extract VOI contours from mask image and put in new image.
        Parameters:
        image - Image where VOIs are stored
        imgBuffer - Image array
        xfrm - Transformation matrix to be applied
      • transform25DVOI

        private void transform25DVOI​(ModelImage image,
                                     double[] imgBuffer,
                                     TransMatrix kTM)
        Transforms and resamples a 3D VOI using nearest neighbor interpolation.
        1. Export VOIs as a mask image
        2. Transform mask
        3. Extract VOI contours from mask image and put in new image.
        Parameters:
        image - Image where VOIs are stored
        imgBuffer - Image array
        kTM - Transformation matrix to be applied
      • transform3DVOI

        private void transform3DVOI​(ModelImage image,
                                    double[] imgBuffer,
                                    TransMatrix kTM)
        Transforms and resamples a 3D VOI using nearest neighbor interpolation.
        1. Export VOIs as a mask image
        2. Transform mask
        3. Extract VOI contours from mask image and put in new image.
        Parameters:
        image - Image where VOIs are stored
        imgBuffer - Image array
        kTM - Transformation matrix to be applied
      • transform3DVOIByte

        private void transform3DVOIByte​(ModelImage image,
                                        byte[] imgBuffer,
                                        TransMatrix kTM)
        Transforms and resamples a 3D VOI using nearest neighbor interpolation.
        1. Export VOIs as a mask image
        2. Transform mask
        3. Extract VOI contours from mask image and put in new image.
        Parameters:
        image - Image where VOIs are stored
        imgBuffer - Image array
        kTM - Transformation matrix to be applied use byte imgBuffer to save a factor of 4 in memory in 3D ARGB color images.
      • transformBilinear

        private void transformBilinear​(double[] imgBuf,
                                       TransMatrix kTM)
        Transforms and resamples volume using bilinear interpolation.
        Parameters:
        imgBuf - Image array
        kTM - Matrix to be applied
      • transformBilinear3D

        private void transformBilinear3D​(double[] imgBuf,
                                         TransMatrix kTM)
        Transforms and resamples volume using bilinear interpolation. Used as a slice-only algorithm on 3D images.
        Parameters:
        imgBuf - Image array
        kTM - Matrix to be applied
      • transformBilinear3DC

        private void transformBilinear3DC​(double[] imgBuf,
                                          float[] imgBuf2,
                                          TransMatrix kTM)
        Transforms and resamples volume using bilinear interpolation (2.5D) This version used with color images. This alogorithm used on a slice by slice basis on 3D images.
        Parameters:
        imgBuf - Input image array
        imgBuf2 - Output image array
        kTM - Matrix to be applied
      • transformBilinear4D

        private void transformBilinear4D​(double[] imgBuf,
                                         TransMatrix kTM)
        Transforms and resamples volume using bilinear interpolation (2.5D) Used as a slice only algorithm on 3D images.
        Parameters:
        imgBuf - Image array
        kTM - Transformation matrix to be applied
      • transformBilinear4DC

        private void transformBilinear4DC​(double[] imgBuf,
                                          float[] imgBuf2,
                                          TransMatrix kTM)
        Transforms and resamples volume using bilinear interpolation This version used with color images This alogorithm used on a slice by slice basis on 4D images.
        Parameters:
        imgBuf - Input image array
        imgBuf2 - Output image array
        kTM - Matrix to be applied
      • transformBilinearC

        private void transformBilinearC​(double[] imgBuf,
                                        float[] imgBuf2,
                                        TransMatrix kTM)
        Transforms and resamples volume using bilinear interpolation. This version used with color images
        Parameters:
        imgBuf - Input image array
        imgBuf2 - Output image array
        kTM - Matrix to be applied
      • transformAlgorithmBspline2D

        private void transformAlgorithmBspline2D​(double[] imgBuf,
                                                 TransMatrix kTM,
                                                 int degree)
        Transforms and resamples volume using Bspline interpolation.
        Parameters:
        imgBuf - image array
        kTM - transformation matrix to be applied
        degree - degree of polynomial
      • transformAlgorithmBspline2DC

        private void transformAlgorithmBspline2DC​(double[] imgBuf,
                                                  TransMatrix kTM,
                                                  int degree)
        Transforms and resamples volume using Bspline interpolation.
        Parameters:
        imgBuf - image array
        kTM - transformation matrix to be applied
        degree - degree of polynomial
      • transformAlgorithmBspline3D

        private void transformAlgorithmBspline3D​(double[] imgBuf,
                                                 TransMatrix kTM,
                                                 int degree)
        Transforms and resamples volume using Bspline interpolation.
        Parameters:
        imgBuf - image array
        kTM - transformation matrix to be applied
        degree - degree of polynomial
      • transformAlgorithmBspline3DC

        private void transformAlgorithmBspline3DC​(double[] imgBuf,
                                                  TransMatrix kTM,
                                                  int degree)
        Transforms and resamples volume using Bspline interpolation.
        Parameters:
        imgBuf - image array
        kTM - transformation matrix to be applied
        degree - degree of polynomial
      • transformAlgorithmBspline4D

        private void transformAlgorithmBspline4D​(double[] imgBuf,
                                                 TransMatrix kTM,
                                                 int degree)
        Transforms and resamples volume using Bspline interpolation.
        Parameters:
        imgBuf - image array
        kTM - transformation matrix to be applied
        degree - degree of polynomial
      • transformAlgorithmBspline4DC

        private void transformAlgorithmBspline4DC​(double[] imgBuf,
                                                  TransMatrix kTM,
                                                  int degree)
        Transforms and resamples color volume using Bspline interpolation.
        Parameters:
        imgBuf - image array
        kTM - transformation matrix to be applied
        degree - degree of polynomial
      • transformCubicLagrangian2D

        private void transformCubicLagrangian2D​(double[] imgBuf,
                                                TransMatrix kTM,
                                                boolean clip)
        Transforms and resamples volume using cubic Lagrangian interpolation.
        Parameters:
        imgBuf - Image array
        kTM - Transformation matrix to be applied
        clip - if true clip output values to be within input range
      • transformCubicLagrangian2DC

        private void transformCubicLagrangian2DC​(double[] imgBuf,
                                                 float[] imgBuf2,
                                                 TransMatrix kTM,
                                                 boolean clip)
        Transforms and resamples volume using cubic Lagrangian interpolation. This version used with color images
        Parameters:
        imgBuf - Input image array
        imgBuf2 - Output image array
        kTM - Transformation matrix to be applied
        clip - if true clip output values to be within input range
      • transformCubicLagrangian3D

        private void transformCubicLagrangian3D​(double[] imgBuf,
                                                TransMatrix kTM,
                                                boolean clip)
        Transforms and resamples volume using cubic Lagrangian interpolation.
        Parameters:
        imgBuf - Image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformCubicLagrangian3DC

        private void transformCubicLagrangian3DC​(double[] imgBuf,
                                                 float[] imgBuf2,
                                                 TransMatrix kTM,
                                                 boolean clip)
        Transforms and resamples volume using cubic Lagrangian interpolation. This version used with color images
        Parameters:
        imgBuf - Input image array
        imgBuf2 - Output image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformCubicLagrangian3Dim2D

        private void transformCubicLagrangian3Dim2D​(double[] imgBuf,
                                                    TransMatrix kTM,
                                                    boolean clip)
        Transforms and resamples volume using cubic Lagrangian interpolation Does a slice by slice cubic Lagrangian interpolation on a 3 dimensional object.
        Parameters:
        imgBuf - Image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformCubicLagrangian3Dim2DC

        private void transformCubicLagrangian3Dim2DC​(double[] imgBuf,
                                                     float[] imgBuf2,
                                                     TransMatrix kTM,
                                                     boolean clip)
        Transforms and resamples volume using cubic Lagrangian interpolation This version used with color images This version performs a slice by slice algorithm on a 3 dimensional object.
        Parameters:
        imgBuf - Input image array
        imgBuf2 - Output image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformCubicLagrangian4D

        private void transformCubicLagrangian4D​(double[] imgBuf,
                                                TransMatrix kTM,
                                                boolean clip)
        Transforms and resamples 4 dimensional object using 3D cubic Lagrangian interpolation.
        Parameters:
        imgBuf - Image array
        kTM - Transformation matrix to be applied
        clip - if true clip output values to be within input range
      • transformCubicLagrangian4DC

        private void transformCubicLagrangian4DC​(double[] imgBuf,
                                                 float[] imgBuffer2,
                                                 TransMatrix kTM,
                                                 boolean clip)
        Transforms and resamples 4 dimensional object using 3D cubic Lagrangian interpolation.
        Parameters:
        imgBuf - Image array
        imgBuffer2 -
        kTM - Transformation matrix to be applied
        clip - if true clip output values to be within input range
      • transformCubicLagrangian4Dim2D

        private void transformCubicLagrangian4Dim2D​(double[] imgBuf,
                                                    TransMatrix kTM,
                                                    boolean clip)
        Transforms and resamples volume using cubic Lagrangian interpolation Does a slice by slice cubic Lagrangian interpolation on a 4 dimensional object.
        Parameters:
        imgBuf - Image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformCubicLagrangian4Dim2DC

        private void transformCubicLagrangian4Dim2DC​(double[] imgBuf,
                                                     float[] imgBuf2,
                                                     TransMatrix kTM,
                                                     boolean clip)
        Transforms and resamples volume using cubic Lagrangian interpolation This version used with color images This version performs a slice by slice algorithm on a 4 dimensional object.
        Parameters:
        imgBuf - Input image array
        imgBuf2 - Output image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformHepticLagrangian2D

        private void transformHepticLagrangian2D​(double[] imgBuf,
                                                 TransMatrix kTM,
                                                 boolean clip)
        Transforms and resamples volume using heptic Lagrangian interpolation.
        Parameters:
        imgBuf - Image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformHepticLagrangian2DC

        private void transformHepticLagrangian2DC​(double[] imgBuf,
                                                  float[] imgBuf2,
                                                  TransMatrix kTM,
                                                  boolean clip)
        Transforms and resamples volume using heptic Lagrangian interpolation This version used with color images.
        Parameters:
        imgBuf - Input image array
        imgBuf2 - Output image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformHepticLagrangian3D

        private void transformHepticLagrangian3D​(double[] imgBuf,
                                                 TransMatrix kTM,
                                                 boolean clip)
        Transforms and resamples volume using heptic Lagrangian interpolation.
        Parameters:
        imgBuf - Image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformHepticLagrangian3DC

        private void transformHepticLagrangian3DC​(double[] imgBuf,
                                                  float[] imgBuf2,
                                                  TransMatrix kTM,
                                                  boolean clip)
        Transforms and resamples volume using heptic Lagrangian interpolation This version used with color images.
        Parameters:
        imgBuf - Input image array
        imgBuf2 - Output image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformHepticLagrangian3Dim2D

        private void transformHepticLagrangian3Dim2D​(double[] imgBuf,
                                                     TransMatrix kTM,
                                                     boolean clip)
        Transforms and resamples volume using heptic Lagrangian interpolation Does a slice by slice heptic Lagrangian interpolation on a 3 dimensional object.
        Parameters:
        imgBuf - Image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformHepticLagrangian3Dim2DC

        private void transformHepticLagrangian3Dim2DC​(double[] imgBuf,
                                                      float[] imgBuf2,
                                                      TransMatrix kTM,
                                                      boolean clip)
        Transforms and resamples volume using heptic Lagrangian interpolation This version used with color images This version performs a slice by slice algorithm on a 3 dimensional object.
        Parameters:
        imgBuf - Input image array
        imgBuf2 - Output image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformHepticLagrangian4D

        private void transformHepticLagrangian4D​(double[] imgBuf,
                                                 TransMatrix kTM,
                                                 boolean clip)
        transforms and resamples 4 dimensional object using 3D heptic Lagrangian interpolation.
        Parameters:
        imgBuf - image array
        kTM - transformation matrix to be applied
        clip - if true clip output values to be within input range
      • transformHepticLagrangian4DC

        private void transformHepticLagrangian4DC​(double[] imgBuf,
                                                  float[] imgBuffer2,
                                                  TransMatrix kTM,
                                                  boolean clip)
        transforms and resamples 4 dimensional object using 3D heptic Lagrangian interpolation.
        Parameters:
        imgBuf - image array
        imgBuffer2 -
        kTM - transformation matrix to be applied
        clip - if true clip output values to be within input range
      • transformHepticLagrangian4Dim2D

        private void transformHepticLagrangian4Dim2D​(double[] imgBuf,
                                                     TransMatrix kTM,
                                                     boolean clip)
        Transforms and resamples volume using heptic Lagrangian interpolation Does a slice by slice heptic Lagrangian interpolation on a 4 dimensional object.
        Parameters:
        imgBuf - Image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformHepticLagrangian4Dim2DC

        private void transformHepticLagrangian4Dim2DC​(double[] imgBuf,
                                                      float[] imgBuf2,
                                                      TransMatrix kTM,
                                                      boolean clip)
        Transforms and resamples volume using heptic Lagrangian interpolation This version used with color images This version performs a slice by slice algorithm on a 4 dimensional object.
        Parameters:
        imgBuf - Input image array
        imgBuf2 - Output image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformNearestNeighbor2D

        private void transformNearestNeighbor2D​(double[] imgBuf,
                                                TransMatrix kTM)
        Transforms and resamples volume using nearest neighbor interpolation.
        Parameters:
        imgBuf - image array
        kTM - transformation matrix to be applied
      • transformNearestNeighbor2DC

        private void transformNearestNeighbor2DC​(double[] imgBuf,
                                                 float[] imgBuf2,
                                                 TransMatrix kTM)
        Transforms and resamples volume using nearest neighbor interpolation.
        Parameters:
        imgBuf - input image array
        imgBuf2 - output image array
        kTM - transformation matrix to be applied
      • transformNearestNeighbor3D

        private void transformNearestNeighbor3D​(double[] imgBuf,
                                                TransMatrix kTM)
        Transforms and resamples volume using nearest neighbor interpolation.
        Parameters:
        imgBuf - image array
        kTM - transformation matrix to be applied
      • transformNearestNeighbor3DC

        private void transformNearestNeighbor3DC​(double[] imgBuf,
                                                 float[] imgBuf2,
                                                 TransMatrix kTM)
        Transforms and resamples volume using nearest neighbor interpolation.
        Parameters:
        imgBuf - input image array
        imgBuf2 - output image array
        kTM - transformation matrix to be applied
      • transformNearestNeighbor3Dim2D

        private void transformNearestNeighbor3Dim2D​(double[] imgBuf,
                                                    TransMatrix kTM)
        Transforms and resamples volume using nearest neighbor interpolation.
        Parameters:
        imgBuf - image array
        kTM - transformation matrix to be applied
      • transformNearestNeighbor3Dim2DC

        private void transformNearestNeighbor3Dim2DC​(double[] imgBuf,
                                                     float[] imgBuf2,
                                                     TransMatrix kTM)
        Transforms and resamples volume using nearest neighbor interpolation.
        Parameters:
        imgBuf - input image array
        imgBuf2 - output image array
        kTM - transformation matrix to be applied
      • transformNearestNeighbor4D

        private void transformNearestNeighbor4D​(double[] imgBuf,
                                                TransMatrix kTM)
        Transforms and resamples 4 dimensional object using 3D algorithm using nearest neighbor interpolation.
        Parameters:
        imgBuf - image array
        kTM - transformation matrix to be applied
      • transformNearestNeighbor4DC

        private void transformNearestNeighbor4DC​(double[] imgBuf,
                                                 float[] imgBuffer2,
                                                 TransMatrix kTM)
        Transforms and resamples 4 dimensional object using 3D algorithm using nearest neighbor interpolation.
        Parameters:
        imgBuf - image array
        imgBufffer2 -
        kTM - transformation matrix to be applied
      • transformNearestNeighbor4Dim2D

        private void transformNearestNeighbor4Dim2D​(double[] imgBuf,
                                                    TransMatrix kTM)
        Transforms and resamples volume using nearest neighbor interpolation.
        Parameters:
        imgBuf - image array
        kTM - transformation matrix to be applied
      • transformNearestNeighbor4Dim2DC

        private void transformNearestNeighbor4Dim2DC​(double[] imgBuf,
                                                     float[] imgBuf2,
                                                     TransMatrix kTM)
        Transforms and resamples volume using nearest neighbor interpolation.
        Parameters:
        imgBuf - input image array
        imgBuf2 - output image array
        kTM - transformation matrix to be applied
      • transformQuinticLagrangian2D

        private void transformQuinticLagrangian2D​(double[] imgBuf,
                                                  TransMatrix kTM,
                                                  boolean clip)
        Transforms and resamples volume using quintic Lagrangian interpolation.
        Parameters:
        imgBuf - Image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformQuinticLagrangian2DC

        private void transformQuinticLagrangian2DC​(double[] imgBuf,
                                                   float[] imgBuf2,
                                                   TransMatrix kTM,
                                                   boolean clip)
        Transforms and resamples volume using quintic Lagrangian interpolation This version used with color images.
        Parameters:
        imgBuf - Input image array
        imgBuf2 - Output image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformQuinticLagrangian3D

        private void transformQuinticLagrangian3D​(double[] imgBuf,
                                                  TransMatrix kTM,
                                                  boolean clip)
        Transforms and resamples volume using quintic Lagrangian interpolation.
        Parameters:
        imgBuf - Image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformQuinticLagrangian3DC

        private void transformQuinticLagrangian3DC​(double[] imgBuf,
                                                   float[] imgBuf2,
                                                   TransMatrix kTM,
                                                   boolean clip)
        Transforms and resamples volume using quintic Lagrangian interpolation This version used with color images.
        Parameters:
        imgBuf - Input image array
        imgBuf2 - Output image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformQuinticLagrangian3Dim2D

        private void transformQuinticLagrangian3Dim2D​(double[] imgBuf,
                                                      TransMatrix kTM,
                                                      boolean clip)
        Transforms and resamples volume using quintic Lagrangian interpolation Does a slice by slice quintic Lagrangian interpolation on a 3 dimensional object.
        Parameters:
        imgBuf - Image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformQuinticLagrangian3Dim2DC

        private void transformQuinticLagrangian3Dim2DC​(double[] imgBuf,
                                                       float[] imgBuf2,
                                                       TransMatrix kTM,
                                                       boolean clip)
        Transforms and resamples volume using quintic Lagrangian interpolation This version used with color images This version performs a slice by slice algorithm on a 3 dimensional object.
        Parameters:
        imgBuf - Input image array
        imgBuf2 - Output image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformQuinticLagrangian4DC

        private void transformQuinticLagrangian4DC​(double[] imgBuf,
                                                   float[] imgBuffer2,
                                                   TransMatrix kTM,
                                                   boolean clip)
        Transforms and resamples 4 dimensional color object using 3D quintic Lagrangian interpolation.
        Parameters:
        imgBuf - Image array
        imgBuf2 -
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformQuinticLagrangian4D

        private void transformQuinticLagrangian4D​(double[] imgBuf,
                                                  TransMatrix kTM,
                                                  boolean clip)
        Transforms and resamples 4 dimensional object using 3D quintic Lagrangian interpolation.
        Parameters:
        imgBuf - Image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformQuinticLagrangian4Dim2D

        private void transformQuinticLagrangian4Dim2D​(double[] imgBuf,
                                                      TransMatrix kTM,
                                                      boolean clip)
        Transforms and resamples volume using quintic Lagrangian interpolation Does a slice by slice quintic Lagrangian interpolation on a 4 dimensional object.
        Parameters:
        imgBuf - Image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformQuinticLagrangian4Dim2DC

        private void transformQuinticLagrangian4Dim2DC​(double[] imgBuf,
                                                       float[] imgBuf2,
                                                       TransMatrix kTM,
                                                       boolean clip)
        Transforms and resamples volume using quintic Lagrangian interpolation This version used with color images This version performs a slice by slice algorithm on a 4 dimensional object.
        Parameters:
        imgBuf - Input image array
        imgBuf2 - Output image array
        kTM - Transformation matrix to be applied
        clip - if true clip output values to be within input range
      • transformTrilinear

        private void transformTrilinear​(double[] imgBuffer,
                                        TransMatrix kTM)
        Transforms and resamples a 3D volume using trilinear interpolation.
        Parameters:
        imgBuffer - Image array
        kTM - Transformation matrix to be applied
      • transformTrilinear4D

        private void transformTrilinear4D​(double[] imgBuffer,
                                          TransMatrix kTM)
        Transforms and resamples 4 dimensional object using trilinear interpolation.
        Parameters:
        imgBuffer - Image array
        kTM - Transformation matrix to be applied
      • transformTrilinear4DByteC

        private void transformTrilinear4DByteC​(byte[] imgBuffer,
                                               byte[] imgBuffer2,
                                               TransMatrix kTM)
        Transforms and resamples 4 dimensional color ARGB object using trilinear interpolation.
        Parameters:
        imgBuffer - Image array
        imgBuf2 -
        kTM - Transformation matrix to be applied Byte buffers are used to reduce memory requirements by a factor of 4
      • transformTrilinear4DC

        private void transformTrilinear4DC​(double[] imgBuffer,
                                           float[] imgBuffer2,
                                           TransMatrix kTM)
        Transforms and resamples 4 dimensional color object using trilinear interpolation.
        Parameters:
        imgBuffer - Image array
        imgBuf2 -
        kTM - Transformation matrix to be applied
      • transformTrilinearC

        private void transformTrilinearC​(double[] imgBuffer,
                                         float[] imgBuffer2,
                                         TransMatrix kTM)
        Transforms and resamples volume using trilinear interpolation This version is used with color images.
        Parameters:
        imgBuffer - Input image array
        imgBuffer2 - Output image array
        kTM - Transformation matrix to be applied
      • transformTrilinearByteC

        private void transformTrilinearByteC​(byte[] imgBuffer,
                                             byte[] imgBuffer2,
                                             TransMatrix kTM)
        Transforms and resamples volume using trilinear interpolation This version is used with ARGB color images. Use byte[] rather than float[] to save memory
        Parameters:
        imgBuffer - Input image array
        imgBuffer2 - Output image array
        kTM - Transformation matrix to be applied
      • transformWSinc2D

        private void transformWSinc2D​(double[] imgBuf,
                                      TransMatrix kTM,
                                      boolean clip)
        Transforms and resamples volume using windowed sinc interpolation.
        Parameters:
        imgBuf - Image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformWSinc2DC

        private void transformWSinc2DC​(double[] imgBuf,
                                       float[] imgBuf2,
                                       TransMatrix kTM,
                                       boolean clip)
        Transforms and resamples volume using windowed sinc interpolation This version used with color images.
        Parameters:
        imgBuf - Input image array
        imgBuf2 - Output image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformWSinc3D

        private void transformWSinc3D​(double[] imgBuf,
                                      TransMatrix kTM,
                                      boolean clip)
        Transforms and resamples volume using windowed sinc interpolation.
        Parameters:
        imgBuf - Image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformWSinc3DC

        private void transformWSinc3DC​(double[] imgBuf,
                                       float[] imgBuf2,
                                       TransMatrix kTM,
                                       boolean clip)
        Transforms and resamples volume using windowed sinc interpolation This version used with color images.
        Parameters:
        imgBuf - Input image array
        imgBuf2 - Output image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformWSinc3Dim2D

        private void transformWSinc3Dim2D​(double[] imgBuf,
                                          TransMatrix kTM,
                                          boolean clip)
        Transforms and resamples volume using windowed sinc interpolation Does a slice by slice windowed sinc interpolation on a 3 dimensional object.
        Parameters:
        imgBuf - Image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformWSinc3Dim2DC

        private void transformWSinc3Dim2DC​(double[] imgBuf,
                                           float[] imgBuf2,
                                           TransMatrix kTM,
                                           boolean clip)
        Transforms and resamples volume using windowed sinc interpolation This version used with color images This version performs a slice by slice algorithm on a 3 dimensional object.
        Parameters:
        imgBuf - Input image array
        imgBuf2 - Output image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformWSinc4D

        private void transformWSinc4D​(double[] imgBuf,
                                      TransMatrix kTM,
                                      boolean clip)
        Transforms and resamples 4 dimensional object using 3D windowed sinc interpolation.
        Parameters:
        imgBuf - Image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformWSinc4DC

        private void transformWSinc4DC​(double[] imgBuf,
                                       float[] imgBuffer2,
                                       TransMatrix kTM,
                                       boolean clip)
        Transforms and resamples 4 dimensional object using 3D windowed sinc interpolation.
        Parameters:
        imgBuf - Image array
        imgBuffer2 -
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformWSinc4Dim2D

        private void transformWSinc4Dim2D​(double[] imgBuf,
                                          TransMatrix kTM,
                                          boolean clip)
        Transforms and resamples volume using windowed sinc interpolation Does a slice by slice windowed sinc interpolation on a 4 dimensional object.
        Parameters:
        imgBuf - Image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • transformWSinc4Dim2DC

        private void transformWSinc4Dim2DC​(double[] imgBuf,
                                           float[] imgBuf2,
                                           TransMatrix kTM,
                                           boolean clip)
        Transforms and resamples volume using windowed sinc interpolation This version used with color images This version performs a slice by slice algorithm on a 4 dimensional object.
        Parameters:
        imgBuf - Input image array
        imgBuf2 - Output image array
        kTM - Transformation matrix to be applied
        clip - If true clip output values to be within input range
      • updateOriginMargins

        private void updateOriginMargins()
        Update origin to reflect padding.
      • updateOriginMargins2D

        private void updateOriginMargins2D()
        Update origin to reflect padding.