Class DemonsRegistrationLite


  • public class DemonsRegistrationLite
    extends java.lang.Object
    This algorithm handles registration algorithms of images with the Demons algorithm and a simple multiscale technique (Demons variant from Tom Vercauteren's 2009 paper, "Diffeomorphic demons: Efficient non-parametric image registration by Tom Vercauteren, Xavier Pennec, Aymeric Perchant, and Nicholas Ayache, NeuroImage, 45, 2009, S61-S72.)
    Version:
    November 2009
    Author:
    Pierre-Louis Bazin
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private float[][] c  
      private static boolean debug  
      static int DIFFUSION  
      private boolean do2D  
      private float[] fixed  
      static int FLUID  
      private float[][] gaussKernel  
      private float[] image  
      private float imax  
      private float imin  
      private static float INF  
      private boolean isCompleted  
      private boolean isWorking  
      private int kx  
      private int ky  
      private int kz  
      private int levels  
      private float[] moving  
      private int nfx  
      private int nfy  
      private int nfz  
      private int Niter  
      private int[] nix  
      private int[] niy  
      private int[] niz  
      private int nmx  
      private int nmy  
      private int nmz  
      private int[] ntx  
      private int[] nty  
      private int[] ntz  
      private int regType  
      private float rfx  
      private float rfy  
      private float rfz  
      private float rix  
      private float riy  
      private float riz  
      private float rmx  
      private float rmy  
      private float rmz  
      private float rtx  
      private float rty  
      private float rtz  
      private float[][] s  
      private float sigma2  
      private float smoothingKernel  
      private float spatialScale  
      private static int T  
      private float[] target  
      private float tmax  
      private float tmin  
      private float[][] transform  
      private float[][] u  
      private static boolean verbose  
      private static int X  
      private static int Y  
      private static int Z  
      private static float ZERO  
    • Constructor Summary

      Constructors 
      Constructor Description
      DemonsRegistrationLite​(float[] image_, float[] target_, int nix_, int niy_, int niz_, float rix_, float riy_, float riz_, int ntx_, int nty_, int ntz_, float rtx_, float rty_, float rtz_, float smoothing_, float scale_, int lev_, int Ni_, int reg_, float[][] trans_)
      constructor note: the membership function mems_ must have sum = 0 on the masked areas
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      float[] exportTransformedImage()
      returns the transformed image
      float[] exportTransformField()
      returns the transform field v defined as X' = X+v (=s)
      void finalize()  
      float[][] getCurrentTransform()  
      float[][] getCurrentUpdate()  
      private void initializeImages​(int lvl)
      create an image pyramid from the original data, initialize Jacobians, etc
      private void initializeImages2D​(int lvl)
      create an image pyramid from the original data, initialize Jacobians, etc
      private void initializeTransform​(int lvl)
      initialize the transform from previous estimate, if exists
      private void initializeTransform2D​(int lvl)
      initialize the transform from previous estimate, if exists
      boolean isCompleted()  
      boolean isWorking()  
      private float linearInterpolation​(float[] image, float value, float x, float y, float z, int nx, int ny, int nz)
      linear interpolation, with value outside the image
      private float linearInterpolation​(float[] image, float value, float x, float y, int nx, int ny)
      linear interpolation, with value outside the image
      private void preprocessInputImages​(float[] img, float[] trg)  
      private void preprocessInputImages2D​(float[] img, float[] trg)  
      void registerImageToTarget​(int lvl, int iterations)
      compute the image position given the target for a given level l performs only one iteration
      void registerImageToTarget2D​(int lvl, int iterations)
      compute the image position given the target for a given level l performs only one iteration
      void runGaussianPyramid()
      runs the gaussian pyramid algorithm
      private float[] separableConvolution​(float[] image, int nx, int ny, float[][] kernel, int kx, int ky)
      convolution with a separable kernel (the kernel is 3x{kx,ky,kz})
      private float[] separableConvolution​(float[] image, int nx, int ny, int nz, float[][] kernel, int kx, int ky, int kz)
      convolution with a separable kernel (the kernel is 3x{kx,ky,kz})
      private float[][] separableGaussianKernel​(float sx, float sy)  
      private float[][] separableGaussianKernel​(float sx, float sy, float sz)  
      private float[] subsample​(float[] image, int nx, int ny, int factor)
      scale down by a factor
      private float[] subsample​(float[] image, int nx, int ny, int nz, int factor)
      scale down by a factor
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • image

        private float[] image
      • target

        private float[] target
      • fixed

        private float[] fixed
      • moving

        private float[] moving
      • c

        private float[][] c
      • s

        private float[][] s
      • u

        private float[][] u
      • nix

        private int[] nix
      • niy

        private int[] niy
      • niz

        private int[] niz
      • ntx

        private int[] ntx
      • nty

        private int[] nty
      • ntz

        private int[] ntz
      • rix

        private float rix
      • riy

        private float riy
      • riz

        private float riz
      • rtx

        private float rtx
      • rty

        private float rty
      • rtz

        private float rtz
      • imin

        private float imin
      • imax

        private float imax
      • tmin

        private float tmin
      • tmax

        private float tmax
      • nmx

        private int nmx
      • nmy

        private int nmy
      • nmz

        private int nmz
      • nfx

        private int nfx
      • nfy

        private int nfy
      • nfz

        private int nfz
      • rmx

        private float rmx
      • rmy

        private float rmy
      • rmz

        private float rmz
      • rfx

        private float rfx
      • rfy

        private float rfy
      • rfz

        private float rfz
      • transform

        private float[][] transform
      • levels

        private int levels
      • Niter

        private int Niter
      • smoothingKernel

        private float smoothingKernel
      • spatialScale

        private float spatialScale
      • regType

        private int regType
      • sigma2

        private float sigma2
      • gaussKernel

        private float[][] gaussKernel
      • kx

        private int kx
      • ky

        private int ky
      • kz

        private int kz
      • isWorking

        private boolean isWorking
      • isCompleted

        private boolean isCompleted
      • do2D

        private boolean do2D
    • Constructor Detail

      • DemonsRegistrationLite

        public DemonsRegistrationLite​(float[] image_,
                                      float[] target_,
                                      int nix_,
                                      int niy_,
                                      int niz_,
                                      float rix_,
                                      float riy_,
                                      float riz_,
                                      int ntx_,
                                      int nty_,
                                      int ntz_,
                                      float rtx_,
                                      float rty_,
                                      float rtz_,
                                      float smoothing_,
                                      float scale_,
                                      int lev_,
                                      int Ni_,
                                      int reg_,
                                      float[][] trans_)
        constructor note: the membership function mems_ must have sum = 0 on the masked areas
    • Method Detail

      • finalize

        public final void finalize()
        Overrides:
        finalize in class java.lang.Object
      • getCurrentTransform

        public final float[][] getCurrentTransform()
      • getCurrentUpdate

        public final float[][] getCurrentUpdate()
      • isWorking

        public final boolean isWorking()
      • isCompleted

        public final boolean isCompleted()
      • preprocessInputImages2D

        private final void preprocessInputImages2D​(float[] img,
                                                   float[] trg)
      • preprocessInputImages

        private final void preprocessInputImages​(float[] img,
                                                 float[] trg)
      • initializeImages2D

        private final void initializeImages2D​(int lvl)
        create an image pyramid from the original data, initialize Jacobians, etc
      • initializeImages

        private final void initializeImages​(int lvl)
        create an image pyramid from the original data, initialize Jacobians, etc
      • initializeTransform2D

        private final void initializeTransform2D​(int lvl)
        initialize the transform from previous estimate, if exists
      • initializeTransform

        private final void initializeTransform​(int lvl)
        initialize the transform from previous estimate, if exists
      • registerImageToTarget2D

        public final void registerImageToTarget2D​(int lvl,
                                                  int iterations)
        compute the image position given the target for a given level l performs only one iteration
      • registerImageToTarget

        public final void registerImageToTarget​(int lvl,
                                                int iterations)
        compute the image position given the target for a given level l performs only one iteration
      • runGaussianPyramid

        public final void runGaussianPyramid()
        runs the gaussian pyramid algorithm
      • exportTransformedImage

        public final float[] exportTransformedImage()
        returns the transformed image
      • exportTransformField

        public final float[] exportTransformField()
        returns the transform field v defined as X' = X+v (=s)
      • separableGaussianKernel

        private float[][] separableGaussianKernel​(float sx,
                                                  float sy)
      • separableGaussianKernel

        private float[][] separableGaussianKernel​(float sx,
                                                  float sy,
                                                  float sz)
      • subsample

        private float[] subsample​(float[] image,
                                  int nx,
                                  int ny,
                                  int factor)
        scale down by a factor
      • subsample

        private float[] subsample​(float[] image,
                                  int nx,
                                  int ny,
                                  int nz,
                                  int factor)
        scale down by a factor
      • linearInterpolation

        private float linearInterpolation​(float[] image,
                                          float value,
                                          float x,
                                          float y,
                                          int nx,
                                          int ny)
        linear interpolation, with value outside the image
      • linearInterpolation

        private float linearInterpolation​(float[] image,
                                          float value,
                                          float x,
                                          float y,
                                          float z,
                                          int nx,
                                          int ny,
                                          int nz)
        linear interpolation, with value outside the image
      • separableConvolution

        private float[] separableConvolution​(float[] image,
                                             int nx,
                                             int ny,
                                             float[][] kernel,
                                             int kx,
                                             int ky)
        convolution with a separable kernel (the kernel is 3x{kx,ky,kz})
      • separableConvolution

        private float[] separableConvolution​(float[] image,
                                             int nx,
                                             int ny,
                                             int nz,
                                             float[][] kernel,
                                             int kx,
                                             int ky,
                                             int kz)
        convolution with a separable kernel (the kernel is 3x{kx,ky,kz})