itkInPlaceImageFilter.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
00018
00019
00020 #ifndef __itkInPlaceImageFilter_h
00021 #define __itkInPlaceImageFilter_h
00022
00023 #include "itkImageToImageFilter.h"
00024
00025 namespace itk
00026 {
00027
00061 template <class TInputImage, class TOutputImage=TInputImage>
00062 class ITK_EXPORT InPlaceImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
00063 {
00064 public:
00066 typedef InPlaceImageFilter Self;
00067 typedef ImageToImageFilter<TInputImage, TOutputImage> Superclass;
00068 typedef SmartPointer<Self> Pointer;
00069 typedef SmartPointer<const Self> ConstPointer;
00070
00071
00073 itkTypeMacro(InPlaceImageFilter,ImageToImageFilter);
00074
00076 typedef typename Superclass::OutputImageType OutputImageType;
00077 typedef typename Superclass::OutputImagePointer OutputImagePointer;
00078 typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00079 typedef typename Superclass::OutputImagePixelType OutputImagePixelType;
00080
00082 typedef TInputImage InputImageType;
00083 typedef typename InputImageType::Pointer InputImagePointer;
00084 typedef typename InputImageType::ConstPointer InputImageConstPointer;
00085 typedef typename InputImageType::RegionType InputImageRegionType;
00086 typedef typename InputImageType::PixelType InputImagePixelType;
00087
00089 itkStaticConstMacro(InputImageDimension, unsigned int,
00090 TInputImage::ImageDimension);
00091 itkStaticConstMacro(OutputImageDimension, unsigned int,
00092 TOutputImage::ImageDimension);
00094
00097 itkSetMacro(InPlace, bool);
00098 itkGetMacro(InPlace, bool);
00099 itkBooleanMacro(InPlace);
00101
00108 bool CanRunInPlace() const
00109 {
00110 return (typeid(TInputImage) == typeid(TOutputImage));
00111 }
00112
00113 protected:
00114 InPlaceImageFilter();
00115 ~InPlaceImageFilter();
00116
00117 virtual void PrintSelf(std::ostream& os, Indent indent) const;
00118
00131 virtual void AllocateOutputs();
00132
00142 virtual void ReleaseInputs();
00143
00144 private:
00145 InPlaceImageFilter(const Self&);
00146 void operator=(const Self&);
00147
00148 bool m_InPlace;
00149
00150 };
00151
00152 }
00153
00154
00155 #define ITK_TEMPLATE_InPlaceImageFilter(_, EXPORT, x, y) namespace itk { \
00156 _(2(class EXPORT InPlaceImageFilter< ITK_TEMPLATE_2 x >)) \
00157 namespace Templates { typedef InPlaceImageFilter< ITK_TEMPLATE_2 x > InPlaceImageFilter##y; } \
00158 }
00159
00160 #if ITK_TEMPLATE_EXPLICIT
00161 # include "Templates/itkInPlaceImageFilter+-.h"
00162 #endif
00163
00164 #if ITK_TEMPLATE_TXX
00165 # include "itkInPlaceImageFilter.txx"
00166 #endif
00167
00168 #endif
00169