NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
itkInvResampleImageFilter.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 itkInvResampleImageFilter_h
16 #define itkInvResampleImageFilter_h
17 
18 // First make sure that the configuration is available.
19 // This line can be removed once the optimized versions
20 // gets integrated into the main directories.
21 #include <itkConfigure.h>
22 
23 #include <itkFixedArray.h>
24 #include <itkTransform.h>
25 #include <itkImageFunction.h>
26 #include <itkImageRegionIterator.h>
27 #include <itkImageToImageFilter.h>
28 #include <itkInterpolateImageFunction.h>
29 #include <itkSize.h>
30 
31 namespace itk
32 {
33 
71 template <class TInputImage, class TOutputImage,
72  class TInterpolatorPrecisionType=double>
73 class ITK_EXPORT InvResampleImageFilter:
74  public ImageToImageFilter<TInputImage, TOutputImage>
75 {
76 public:
79  typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
80  typedef SmartPointer<Self> Pointer;
81  typedef SmartPointer<const Self> ConstPointer;
82 
83  typedef TInputImage InputImageType;
84  typedef TOutputImage OutputImageType;
85  typedef typename InputImageType::Pointer InputImagePointer;
86  typedef typename InputImageType::ConstPointer InputImageConstPointer;
87  typedef typename OutputImageType::Pointer OutputImagePointer;
89 
91  itkNewMacro(Self);
92 
94  itkTypeMacro(InvResampleImageFilter, ImageToImageFilter);
95 
97  itkStaticConstMacro(ImageDimension, unsigned int,
98  TOutputImage::ImageDimension);
99  itkStaticConstMacro(InputImageDimension, unsigned int,
100  TInputImage::ImageDimension);
101 
102 
104  typedef Transform<TInterpolatorPrecisionType,
105  itkGetStaticConstMacro(ImageDimension),
106  itkGetStaticConstMacro(ImageDimension)> TransformType;
108 
110  typedef InterpolateImageFunction<InputImageType, TInterpolatorPrecisionType> InterpolatorType;
111  typedef typename InterpolatorType::Pointer InterpolatorPointerType;
112 
114  typedef Size<itkGetStaticConstMacro(ImageDimension)> SizeType;
115 
118 
120  typedef typename InterpolatorType::PointType PointType;
121  //typedef typename TOutputImage::PointType PointType;
122 
126 
129 
131  typedef typename TOutputImage::SpacingType SpacingType;
132  typedef typename TOutputImage::PointType OriginPointType;
133  typedef typename TOutputImage::DirectionType DirectionType;
134 
136  typedef ImageBase<itkGetStaticConstMacro(ImageDimension)> ImageBaseType;
137 
145  itkSetConstObjectMacro( Transform, TransformType );
146 
148  itkGetConstObjectMacro( Transform, TransformType );
149 
156  itkSetObjectMacro( Interpolator, InterpolatorType );
157 
159  itkGetConstObjectMacro( Interpolator, InterpolatorType );
160 
162  itkSetMacro( Size, SizeType );
163 
165  itkGetConstReferenceMacro( Size, SizeType );
166 
169  itkSetMacro( DefaultPixelValue, PixelType );
170 
172  itkGetConstReferenceMacro( DefaultPixelValue, PixelType );
173 
175  itkSetMacro( OutputSpacing, SpacingType );
176  virtual void SetOutputSpacing( const double* values );
177 
179  itkGetConstReferenceMacro( OutputSpacing, SpacingType );
180 
182  itkSetMacro( OutputOrigin, OriginPointType );
183  virtual void SetOutputOrigin( const double* values);
184 
186  itkGetConstReferenceMacro( OutputOrigin, OriginPointType );
187 
189  itkSetMacro( OutputDirection, DirectionType );
190  itkGetConstReferenceMacro( OutputDirection, DirectionType );
191 
193  void SetOutputParametersFromImage ( const ImageBaseType * image );
194 
197  itkLegacyMacro( void SetOutputParametersFromConstImage ( const ImageBaseType * image ) );
198 
201  itkSetMacro( OutputStartIndex, IndexType );
202 
204  itkGetConstReferenceMacro( OutputStartIndex, IndexType );
205 
212  void SetReferenceImage ( const TOutputImage *image );
213  const TOutputImage * GetReferenceImage( void ) const;
214 
215  itkSetMacro( UseReferenceImage, bool );
216  itkBooleanMacro( UseReferenceImage );
217  itkGetConstMacro( UseReferenceImage, bool );
218 
224  virtual void GenerateOutputInformation( void );
225 
231  virtual void GenerateInputRequestedRegion( void );
232 
235  virtual void BeforeThreadedGenerateData( void );
236 
239  virtual void AfterThreadedGenerateData( void );
240 
242  unsigned long GetMTime( void ) const;
243 
244 #ifdef ITK_USE_CONCEPT_CHECKING
245 
246  itkConceptMacro(OutputHasNumericTraitsCheck,
247  (Concept::HasNumericTraits<PixelType>));
249 #endif
250 
251 protected:
252  InvResampleImageFilter( void );
254 
255  void PrintSelf( std::ostream& os, Indent indent ) const;
256 
265  void ThreadedGenerateData( const OutputImageRegionType& outputRegionForThread,
266  ThreadIdType threadId );
267 
270  void NonlinearThreadedGenerateData( const OutputImageRegionType& outputRegionForThread,
271  int threadId );
272 
276  void LinearThreadedGenerateData( const OutputImageRegionType&
277  outputRegionForThread,
278  int threadId );
279 
280 
281 private:
282  InvResampleImageFilter( const Self& ); //purposely not implemented
283  void operator=( const Self& ); //purposely not implemented
284 
285  SizeType m_Size; // Size of the output image
286  TransformPointerType m_Transform; // Coordinate transform to use
287  InterpolatorPointerType m_Interpolator; // Image function for
288  // interpolation
289  PixelType m_DefaultPixelValue; // default pixel value
290  // if the point is
291  // outside the image
292  SpacingType m_OutputSpacing; // output image spacing
293  OriginPointType m_OutputOrigin; // output image origin
294  DirectionType m_OutputDirection; // output image direction cosines
295  IndexType m_OutputStartIndex; // output image start index
296  bool m_UseReferenceImage;
297 
298 };
299 
300 
301 } // end namespace itk
302 
303 #ifndef ITK_MANUAL_INSTANTIATION
304 #include "itkInvResampleImageFilter.txx"
305 #endif
306 
307 #endif
InputImageType::Pointer InputImagePointer
Definition: itkInvResampleImageFilter.h:85
Definition: itkInvResampleImageFilter.h:73
ImageBase< itkGetStaticConstMacro(ImageDimension)> ImageBaseType
Definition: itkInvResampleImageFilter.h:136
TOutputImage::IndexType IndexType
Definition: itkInvResampleImageFilter.h:117
GLenum GLsizei GLenum GLenum const GLvoid * image
Definition: glew.h:4052
InterpolatorType::PointType PointType
Definition: itkInvResampleImageFilter.h:120
Definition: niftkITKAffineResampleImage.cxx:74
Size< itkGetStaticConstMacro(ImageDimension)> SizeType
Definition: itkInvResampleImageFilter.h:114
ImageType::IndexType IndexType
Definition: niftkMakeLapUSProbeBasicModel.cxx:32
GLboolean GLenum GLenum GLvoid * values
Definition: glew.h:4068
TOutputImage::RegionType OutputImageRegionType
Definition: itkInvResampleImageFilter.h:128
TOutputImage::DirectionType DirectionType
Definition: itkInvResampleImageFilter.h:133
~InvResampleImageFilter(void)
Definition: itkInvResampleImageFilter.h:253
TransformType::ConstPointer TransformPointerType
Definition: itkInvResampleImageFilter.h:107
SmartPointer< Self > Pointer
Definition: itkInvResampleImageFilter.h:80
InputImageType::ConstPointer InputImageConstPointer
Definition: itkInvResampleImageFilter.h:86
TOutputImage::SpacingType SpacingType
Definition: itkInvResampleImageFilter.h:131
ImageToImageFilter< TInputImage, TOutputImage > Superclass
Definition: itkInvResampleImageFilter.h:79
float PixelType
Definition: niftkBreastDCEandADC.cxx:88
ImageType::RegionType RegionType
Definition: niftkMakeLapUSProbeBasicModel.cxx:30
InterpolatorType::Pointer InterpolatorPointerType
Definition: itkInvResampleImageFilter.h:111
TInputImage InputImageType
Definition: itkInvResampleImageFilter.h:83
InterpolateImageFunction< InputImageType, TInterpolatorPrecisionType > InterpolatorType
Definition: itkInvResampleImageFilter.h:110
TOutputImage::PointType OriginPointType
Definition: itkInvResampleImageFilter.h:132
SmartPointer< const Self > ConstPointer
Definition: itkInvResampleImageFilter.h:81
Transform< TInterpolatorPrecisionType, itkGetStaticConstMacro(ImageDimension), itkGetStaticConstMacro(ImageDimension)> TransformType
Definition: itkInvResampleImageFilter.h:106
TInputImage::PixelType InputPixelType
Definition: itkInvResampleImageFilter.h:125
OutputImageType::Pointer OutputImagePointer
Definition: itkInvResampleImageFilter.h:87
TOutputImage::PixelType PixelType
Definition: itkInvResampleImageFilter.h:124
InvResampleImageFilter Self
Definition: itkInvResampleImageFilter.h:78
TOutputImage OutputImageType
Definition: itkInvResampleImageFilter.h:84
InputImageType::RegionType InputImageRegionType
Definition: itkInvResampleImageFilter.h:88
SmartPointer< const Self > ConstPointer
Definition: itkEulerAffineTransform.h:50