NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
itkMaskedImageRegistrationMethod.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 #ifndef itkMaskedImageRegistrationMethod_h
16 #define itkMaskedImageRegistrationMethod_h
17 
18 
20 #include <itkImageMaskSpatialObject.h>
21 #include <itkBinaryThresholdImageFilter.h>
22 #include <itkBinaryCrossStructuringElement.h>
23 #include <itkBinaryDilateImageFilter.h>
24 #include <itkCastImageFilter.h>
25 #include <itkSmoothingRecursiveGaussianImageFilter.h>
27 #include <itkMultiplyImageFilter.h>
28 
29 namespace itk
30 {
31 
54 template <typename TInputImageType>
56 : public SingleResolutionImageRegistrationMethod<TInputImageType, TInputImageType>
57 {
58 public:
59 
63  typedef SmartPointer<Self> Pointer;
64  typedef SmartPointer<const Self> ConstPointer;
65 
67  itkNewMacro(Self);
68 
71 
73  typedef TInputImageType InputImageType;
75  typedef typename InputImageType::Pointer InputImagePointer;
76  typedef typename InputImageType::ConstPointer InputImageConstPointer;
80  typedef typename InputImageType::SpacingType InputImageSpacingType;
81  typedef typename InputImageType::PointType InputImageOriginType;
82  typedef typename InputImageType::DirectionType InputImageDirectionType;
83 
85  void SetFixedMask( const InputImageType * fixedMask );
86  itkGetConstObjectMacro( FixedMask, InputImageType );
87 
89  void SetMovingMask( const InputImageType * movingMask );
90  itkGetConstObjectMacro( MovingMask, InputImageType );
91 
100  typedef typename RescaleFilterType::Pointer RescaleFilterPointer;
101 
103  typedef SmoothingRecursiveGaussianImageFilter<InputImageType, InputImageType > SmoothingFilterType;
104  typedef typename SmoothingFilterType::Pointer SmoothingFilterPointer;
105 
107  typedef BinaryThresholdImageFilter<InputImageType, InputImageType> ThresholdFilterType;
108  typedef typename ThresholdFilterType::Pointer ThresholdFilterPointer;
109 
111  typedef BinaryCrossStructuringElement<InputImagePixelType,
112  InputImageType::ImageDimension> StructuringType;
113  typedef BinaryDilateImageFilter<InputImageType,
114  InputImageType,
115  StructuringType> DilateMaskFilterType;
116  typedef typename DilateMaskFilterType::Pointer DilateMaskFilterPointer;
117 
119  typedef MultiplyImageFilter<InputImageType, InputImageType> MultiplyFilterType;
120  typedef typename MultiplyFilterType::Pointer MultiplyFilterPointer;
121 
123  typedef unsigned char MaskPixelType;
125  typedef CastImageFilter<InputImageType, MaskImageType > CastToMaskImageTypeFilterType;
126  typedef typename CastToMaskImageTypeFilterType::Pointer CastToMaskImageTypeFilterPointer;
127  typedef ImageMaskSpatialObject< InputImageType::ImageDimension > MaskFilterType;
128  typedef typename MaskFilterType::Pointer MaskFilterPointer;
135  itkSetMacro( UseFixedMask, bool );
136  itkGetConstMacro( UseFixedMask, bool );
137 
143  itkSetMacro( UseMovingMask, bool );
144  itkGetConstMacro( UseMovingMask, bool );
145 
151  itkSetMacro( NumberOfDilations, unsigned int );
152  itkGetMacro( NumberOfDilations, unsigned int );
153 
160  itkSetMacro( MaskImageDirectly, bool );
161  itkGetMacro( MaskImageDirectly, bool );
162 
171  itkSetMacro( RescaleFixedImage, bool );
172  itkGetConstMacro( RescaleFixedImage, bool );
173 
177  itkSetMacro( RescaleFixedMinimum, InputImagePixelType );
178  itkGetConstMacro( RescaleFixedMinimum, InputImagePixelType );
179 
183  itkSetMacro( RescaleFixedMaximum, InputImagePixelType );
184  itkGetConstMacro( RescaleFixedMaximum, InputImagePixelType );
185 
189  itkSetMacro( RescaleFixedBoundaryValue, InputImagePixelType );
190  itkGetConstMacro( RescaleFixedBoundaryValue, InputImagePixelType );
191 
195  itkSetMacro( RescaleFixedLowerThreshold, InputImagePixelType );
196  itkGetConstMacro( RescaleFixedLowerThreshold, InputImagePixelType );
197 
201  itkSetMacro( RescaleFixedUpperThreshold, InputImagePixelType );
202  itkGetConstMacro( RescaleFixedUpperThreshold, InputImagePixelType );
203 
212  itkSetMacro( RescaleMovingImage, bool );
213  itkGetConstMacro( RescaleMovingImage, bool );
214 
218  itkSetMacro( RescaleMovingMinimum, InputImagePixelType );
219  itkGetConstMacro( RescaleMovingMinimum, InputImagePixelType );
220 
224  itkSetMacro( RescaleMovingMaximum, InputImagePixelType );
225  itkGetConstMacro( RescaleMovingMaximum, InputImagePixelType );
226 
230  itkSetMacro( RescaleMovingBoundaryValue, InputImagePixelType );
231  itkGetConstMacro( RescaleMovingBoundaryValue, InputImagePixelType );
232 
236  itkSetMacro( RescaleMovingLowerThreshold, InputImagePixelType );
237  itkGetConstMacro( RescaleMovingLowerThreshold, InputImagePixelType );
238 
242  itkSetMacro( RescaleMovingUpperThreshold, InputImagePixelType );
243  itkGetConstMacro( RescaleMovingUpperThreshold, InputImagePixelType );
244 
250  itkSetMacro( ThresholdFixedMask, bool );
251  itkGetConstMacro( ThresholdFixedMask, bool );
252 
258  itkSetMacro( FixedMaskMinimum, InputImagePixelType );
259  itkGetConstMacro( FixedMaskMinimum, InputImagePixelType );
260 
266  itkSetMacro( FixedMaskMaximum, InputImagePixelType );
267  itkGetConstMacro( FixedMaskMaximum, InputImagePixelType );
268 
274  itkSetMacro( ThresholdMovingMask, bool );
275  itkGetConstMacro( ThresholdMovingMask, bool );
276 
282  itkSetMacro( MovingMaskMinimum, InputImagePixelType );
283  itkGetConstMacro( MovingMaskMinimum, InputImagePixelType );
284 
290  itkSetMacro( MovingMaskMaximum, InputImagePixelType );
291  itkGetConstMacro( MovingMaskMaximum, InputImagePixelType );
292 
298  itkSetMacro( Sigma, float);
299  itkGetMacro( Sigma, float);
300 
302  InputImageType* GetFixedImageCopy();
303 
305  InputImageType* GetMovingImageCopy();
306 
307 protected:
308 
311  void PrintSelf(std::ostream& os, Indent indent) const;
312 
314  virtual void Initialize() throw (ExceptionObject);
315 
317  void CopyImage(const InputImageType* source, InputImageType* target);
318 
319 private:
320 
321  MaskedImageRegistrationMethod(const Self&); // purposely not implemented
322  void operator=(const Self&); // purposely not implemented
323 
324  InputImageConstPointer m_FixedMask;
325  InputImageConstPointer m_MovingMask;
326 
327  bool m_UseFixedMask;
328  bool m_UseMovingMask;
329  bool m_MaskImageDirectly;
330  bool m_RescaleFixedImage;
331  bool m_RescaleMovingImage;
332  bool m_ThresholdFixedMask;
333  bool m_ThresholdMovingMask;
334  unsigned int m_NumberOfDilations;
335 
336  InputImagePixelType m_RescaleFixedMinimum;
337  InputImagePixelType m_RescaleFixedMaximum;
338  InputImagePixelType m_RescaleFixedBoundaryValue;
339  InputImagePixelType m_RescaleFixedLowerThreshold;
340  InputImagePixelType m_RescaleFixedUpperThreshold;
341  InputImagePixelType m_RescaleMovingMinimum;
342  InputImagePixelType m_RescaleMovingMaximum;
343  InputImagePixelType m_RescaleMovingBoundaryValue;
344  InputImagePixelType m_RescaleMovingLowerThreshold;
345  InputImagePixelType m_RescaleMovingUpperThreshold;
346 
347  RescaleFilterPointer m_FixedRescaler;
348  RescaleFilterPointer m_MovingRescaler;
349 
350  float m_Sigma;
351  SmoothingFilterPointer m_FixedSmoother;
352  SmoothingFilterPointer m_MovingSmoother;
353 
354  InputImagePixelType m_FixedMaskMinimum;
355  InputImagePixelType m_FixedMaskMaximum;
356  InputImagePixelType m_MovingMaskMinimum;
357  InputImagePixelType m_MovingMaskMaximum;
358  ThresholdFilterPointer m_FixedMaskThresholder;
359  ThresholdFilterPointer m_MovingMaskThresholder;
360 
361  DilateMaskFilterPointer m_FixedMaskDilater;
362  DilateMaskFilterPointer m_MovingMaskDilater;
363 
364  MultiplyFilterPointer m_FixedImageMuliplier;
365  MultiplyFilterPointer m_MovingImageMultiplier;
366 
367  CastToMaskImageTypeFilterPointer m_FixedMaskCaster;
368  CastToMaskImageTypeFilterPointer m_MovingMaskCaster;
369 
370  MaskFilterPointer m_FixedMasker;
371  MaskFilterPointer m_MovingMasker;
372 
373  InputImagePointer m_FixedImageCopy;
374  InputImagePointer m_MovingImageCopy;
375 
376 };
377 
378 
379 } // end namespace itk
380 
381 #ifndef ITK_MANUAL_INSTANTIATION
382 #include "itkMaskedImageRegistrationMethod.txx"
383 #endif
384 
385 #endif
386 
387 
388 
BoundaryValueRescaleIntensityImageFilter< InputImageType > RescaleFilterType
Definition: itkMaskedImageRegistrationMethod.h:90
MaskedImageRegistrationMethod Self
Definition: itkMaskedImageRegistrationMethod.h:61
Superclass::TransformType TransformType
Definition: itkSingleResolutionImageRegistrationMethod.h:56
MultiplyFilterType::Pointer MultiplyFilterPointer
Definition: itkMaskedImageRegistrationMethod.h:120
Image< MaskPixelType, InputImageType::ImageDimension > MaskImageType
Definition: itkMaskedImageRegistrationMethod.h:124
Base class for NifTK Image Registration Methods employing a binary mask.
Definition: itkMaskedImageRegistrationMethod.h:55
InputImageType::IndexType InputImageIndexType
Definition: itkMaskedImageRegistrationMethod.h:79
ImageType::SizeType SizeType
Definition: niftkMakeLapUSProbeBasicModel.cxx:31
InputImageType::ConstPointer InputImageConstPointer
Definition: itkMaskedImageRegistrationMethod.h:76
SmoothingRecursiveGaussianImageFilter< InputImageType, InputImageType > SmoothingFilterType
Definition: itkMaskedImageRegistrationMethod.h:103
SmartPointer< Self > Pointer
Definition: itkMaskedImageRegistrationMethod.h:63
RescaleFilterType::Pointer RescaleFilterPointer
Definition: itkMaskedImageRegistrationMethod.h:100
SmoothingFilterType::Pointer SmoothingFilterPointer
Definition: itkMaskedImageRegistrationMethod.h:104
Definition: niftkITKAffineResampleImage.cxx:74
ImageType::IndexType IndexType
Definition: niftkMakeLapUSProbeBasicModel.cxx:32
BinaryDilateImageFilter< InputImageType, InputImageType, StructuringType > DilateMaskFilterType
Definition: itkMaskedImageRegistrationMethod.h:115
ImageMaskSpatialObject< InputImageType::ImageDimension > MaskFilterType
Definition: itkMaskedImageRegistrationMethod.h:127
CastToMaskImageTypeFilterType::Pointer CastToMaskImageTypeFilterPointer
Definition: itkMaskedImageRegistrationMethod.h:126
InputImageType::PixelType InputImagePixelType
Definition: itkMaskedImageRegistrationMethod.h:74
DilateMaskFilterType::Pointer DilateMaskFilterPointer
Definition: itkMaskedImageRegistrationMethod.h:116
InputImageType::PointType InputImageOriginType
Definition: itkMaskedImageRegistrationMethod.h:81
BinaryCrossStructuringElement< InputImagePixelType, InputImageType::ImageDimension > StructuringType
Definition: itkMaskedImageRegistrationMethod.h:112
float PixelType
Definition: niftkBreastDCEandADC.cxx:88
Superclass::TransformType TransformType
Definition: itkMaskedImageRegistrationMethod.h:129
ImageType::RegionType RegionType
Definition: niftkMakeLapUSProbeBasicModel.cxx:30
MaskFilterType::Pointer MaskFilterPointer
Definition: itkMaskedImageRegistrationMethod.h:128
SmartPointer< const Self > ConstPointer
Definition: itkMaskedImageRegistrationMethod.h:64
virtual ~MaskedImageRegistrationMethod()
Definition: itkMaskedImageRegistrationMethod.h:310
InputImageType::Pointer InputImagePointer
Definition: itkMaskedImageRegistrationMethod.h:75
InputImageType::SizeType InputImageSizeType
Definition: itkMaskedImageRegistrationMethod.h:78
CastImageFilter< InputImageType, MaskImageType > CastToMaskImageTypeFilterType
Definition: itkMaskedImageRegistrationMethod.h:125
Applies a linear transformation to the intensity levels of the input Image, but takes into an upper a...
Definition: itkBoundaryValueRescaleIntensityImageFilter.h:45
BinaryThresholdImageFilter< InputImageType, InputImageType > ThresholdFilterType
Definition: itkMaskedImageRegistrationMethod.h:107
TInputImageType InputImageType
Definition: itkMaskedImageRegistrationMethod.h:70
InputImageType::SpacingType InputImageSpacingType
Definition: itkMaskedImageRegistrationMethod.h:80
InputImageType::RegionType InputImageRegionType
Definition: itkMaskedImageRegistrationMethod.h:77
MultiplyImageFilter< InputImageType, InputImageType > MultiplyFilterType
Definition: itkMaskedImageRegistrationMethod.h:119
Simultaneous itk::Image and itk::Array (and hence vnl_vector) class.
SingleResolutionImageRegistrationMethod< TInputImageType, TInputImageType > Superclass
Definition: itkMaskedImageRegistrationMethod.h:62
Base class for NifTK Image Registration Methods.
Definition: itkSingleResolutionImageRegistrationMethod.h:37
InputImageType::DirectionType InputImageDirectionType
Definition: itkMaskedImageRegistrationMethod.h:82
GLsizei GLsizei GLchar * source
Definition: glew.h:1816
ThresholdFilterType::Pointer ThresholdFilterPointer
Definition: itkMaskedImageRegistrationMethod.h:108
GLenum target
Definition: glew.h:5584
unsigned char MaskPixelType
Definition: itkMaskedImageRegistrationMethod.h:123