itkOptResampleImageFilter.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkOptResampleImageFilter_h
00018 #define __itkOptResampleImageFilter_h
00019
00020 #include "itkFixedArray.h"
00021 #include "itkTransform.h"
00022 #include "itkImageFunction.h"
00023 #include "itkImageRegionIterator.h"
00024 #include "itkImageToImageFilter.h"
00025 #include "itkInterpolateImageFunction.h"
00026 #include "itkLinearInterpolateImageFunction.h"
00027 #include "itkBSplineInterpolateImageFunction.h"
00028 #include "itkSize.h"
00029
00030 namespace itk
00031 {
00032
00071 template <class TInputImage,
00072 class TOutputImage,
00073 class TInterpolatorPrecisionType=double>
00074 class ITK_EXPORT ResampleImageFilter:
00075 public ImageToImageFilter<TInputImage, TOutputImage>
00076 {
00077 public:
00079 typedef ResampleImageFilter Self;
00080 typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
00081 typedef SmartPointer<Self> Pointer;
00082 typedef SmartPointer<const Self> ConstPointer;
00083
00084 typedef TInputImage InputImageType;
00085 typedef TOutputImage OutputImageType;
00086 typedef typename InputImageType::Pointer InputImagePointer;
00087 typedef typename InputImageType::ConstPointer InputImageConstPointer;
00088 typedef typename OutputImageType::Pointer OutputImagePointer;
00089 typedef typename InputImageType::RegionType InputImageRegionType;
00090
00092 itkNewMacro(Self);
00093
00095 itkTypeMacro(ResampleImageFilter, ImageToImageFilter);
00096
00098 itkStaticConstMacro(ImageDimension, unsigned int,
00099 TOutputImage::ImageDimension);
00100 itkStaticConstMacro(InputImageDimension, unsigned int,
00101 TInputImage::ImageDimension);
00103
00105 typedef ImageBase<itkGetStaticConstMacro(ImageDimension)> ImageBaseType;
00106
00110 typedef Transform<TInterpolatorPrecisionType,
00111 itkGetStaticConstMacro(ImageDimension),
00112 itkGetStaticConstMacro(ImageDimension)> TransformType;
00113 typedef typename TransformType::ConstPointer TransformPointerType;
00115
00117 typedef InterpolateImageFunction<InputImageType,
00118 TInterpolatorPrecisionType> InterpolatorType;
00119 typedef typename InterpolatorType::Pointer InterpolatorPointerType;
00120
00121 typedef LinearInterpolateImageFunction<InputImageType,
00122 TInterpolatorPrecisionType> LinearInterpolatorType;
00123 typedef typename LinearInterpolatorType::Pointer
00124 LinearInterpolatorPointerType;
00125
00126 typedef BSplineInterpolateImageFunction<InputImageType,
00127 TInterpolatorPrecisionType> BSplineInterpolatorType;
00128 typedef typename BSplineInterpolatorType::Pointer
00129 BSplineInterpolatorPointerType;
00130
00132 typedef Size<itkGetStaticConstMacro(ImageDimension)> SizeType;
00133
00135 typedef typename TOutputImage::IndexType IndexType;
00136
00138 typedef typename InterpolatorType::PointType PointType;
00139
00140
00142 typedef typename TOutputImage::PixelType PixelType;
00143 typedef typename TInputImage::PixelType InputPixelType;
00144
00146 typedef typename TOutputImage::RegionType OutputImageRegionType;
00147
00149 typedef typename TOutputImage::SpacingType SpacingType;
00150 typedef typename TOutputImage::PointType OriginPointType;
00151 typedef typename TOutputImage::DirectionType DirectionType;
00152
00160 itkSetConstObjectMacro( Transform, TransformType );
00161
00163 itkGetConstObjectMacro( Transform, TransformType );
00164
00172 itkSetObjectMacro( Interpolator, InterpolatorType );
00173
00175 itkGetConstObjectMacro( Interpolator, InterpolatorType );
00176
00178 itkSetMacro( Size, SizeType );
00179
00181 itkGetConstReferenceMacro( Size, SizeType );
00182
00185 itkSetMacro(DefaultPixelValue,PixelType);
00186
00188 itkGetConstReferenceMacro(DefaultPixelValue,PixelType);
00189
00191 itkSetMacro(OutputSpacing, SpacingType);
00192 virtual void SetOutputSpacing( const double* values);
00194
00196 itkGetConstReferenceMacro( OutputSpacing, SpacingType );
00197
00199 itkSetMacro(OutputOrigin, OriginPointType);
00200 virtual void SetOutputOrigin( const double* values);
00202
00204 itkGetConstReferenceMacro( OutputOrigin, OriginPointType );
00205
00207 itkSetMacro(OutputDirection, DirectionType);
00208 itkGetConstReferenceMacro(OutputDirection, DirectionType);
00210
00212 void SetOutputParametersFromImage ( const ImageBaseType * image );
00213
00216 itkSetMacro( OutputStartIndex, IndexType );
00217
00219 itkGetConstReferenceMacro( OutputStartIndex, IndexType );
00220
00226 void SetReferenceImage ( const TOutputImage *image );
00227 const TOutputImage * GetReferenceImage() const;
00229
00230 itkSetMacro(UseReferenceImage, bool);
00231 itkBooleanMacro(UseReferenceImage);
00232 itkGetConstMacro(UseReferenceImage, bool);
00233
00239 virtual void GenerateOutputInformation();
00240
00246 virtual void GenerateInputRequestedRegion();
00247
00250 virtual void BeforeThreadedGenerateData();
00251
00254 virtual void AfterThreadedGenerateData();
00255
00257 unsigned long GetMTime( void ) const;
00258
00259 #ifdef ITK_USE_CONCEPT_CHECKING
00260
00261 itkConceptMacro(OutputHasNumericTraitsCheck,
00262 (Concept::HasNumericTraits<PixelType>));
00263
00265 #endif
00266
00267 protected:
00268 ResampleImageFilter();
00269 ~ResampleImageFilter() {};
00270 void PrintSelf(std::ostream& os, Indent indent) const;
00271
00281 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00282 int threadId );
00283
00286 void NonlinearThreadedGenerateData(const OutputImageRegionType &
00287 outputRegionForThread,
00288 int threadId );
00289
00293 void LinearThreadedGenerateData(const OutputImageRegionType &
00294 outputRegionForThread,
00295 int threadId );
00296
00297
00298 private:
00299 ResampleImageFilter(const Self&);
00300 void operator=(const Self&);
00301
00302 SizeType m_Size;
00303 TransformPointerType m_Transform;
00304 InterpolatorPointerType m_Interpolator;
00305
00306 PixelType m_DefaultPixelValue;
00307
00308
00309 SpacingType m_OutputSpacing;
00310 OriginPointType m_OutputOrigin;
00311 DirectionType m_OutputDirection;
00312 IndexType m_OutputStartIndex;
00313 bool m_UseReferenceImage;
00314
00315 bool m_InterpolatorIsLinear;
00316 LinearInterpolatorPointerType m_LinearInterpolator;
00317 bool m_InterpolatorIsBSpline;
00318 BSplineInterpolatorPointerType m_BSplineInterpolator;
00319
00320 };
00321
00322
00323 }
00324
00325 #ifndef ITK_MANUAL_INSTANTIATION
00326 #include "itkOptResampleImageFilter.txx"
00327 #endif
00328
00329 #endif
00330