]> Creatis software - clitk.git/blob - segmentation/clitkExtractImageFilter.h
1d888f72875e37525026b0ea82c457c91ae8f90f
[clitk.git] / segmentation / clitkExtractImageFilter.h
1
2 #ifndef __clitkExtractImageFilter_h
3 #define __clitkExtractImageFilter_h
4
5 #include "itkImageToImageFilter.h"
6 #include "itkSmartPointer.h"
7 #include "itkExtractImageFilterRegionCopier.h"
8
9 namespace clitk
10 {
11
12 template <class TInputImage, class TOutputImage>
13 class ITK_EXPORT ExtractImageFilter:
14     public itk::ImageToImageFilter<TInputImage,TOutputImage>
15 {
16 public:
17   /** Standard class typedefs. */
18   typedef ExtractImageFilter         Self;
19   typedef itk::ImageToImageFilter<TInputImage,TOutputImage>  Superclass;
20   typedef itk::SmartPointer<Self>  Pointer;
21   typedef itk::SmartPointer<const Self>  ConstPointer;
22
23   /** Method for creation through the object factory. */
24   itkNewMacro(Self);  
25
26   /** Run-time type information (and related methods). */
27   itkTypeMacro(ExtractImageFilter, ImageToImageFilter);
28
29   /** Image type information. */
30   typedef TInputImage  InputImageType;
31   typedef TOutputImage OutputImageType;
32
33   /** Typedef to describe the output and input image region types. */
34   typedef typename TOutputImage::RegionType OutputImageRegionType;
35   typedef typename TInputImage::RegionType InputImageRegionType;
36
37   /** Typedef to describe the type of pixel. */
38   typedef typename TOutputImage::PixelType OutputImagePixelType;
39   typedef typename TInputImage::PixelType InputImagePixelType;
40
41   /** Typedef to describe the output and input image index and size types. */
42   typedef typename TOutputImage::IndexType OutputImageIndexType;
43   typedef typename TInputImage::IndexType InputImageIndexType;
44   typedef typename TOutputImage::SizeType OutputImageSizeType;
45   typedef typename TInputImage::SizeType InputImageSizeType;
46
47   /** ImageDimension enumeration */
48   itkStaticConstMacro(InputImageDimension, unsigned int,
49                       TInputImage::ImageDimension);
50   itkStaticConstMacro(OutputImageDimension, unsigned int,
51                       TOutputImage::ImageDimension);
52
53   typedef itk::ImageToImageFilterDetail::ExtractImageFilterRegionCopier<
54     itkGetStaticConstMacro(InputImageDimension), 
55     itkGetStaticConstMacro(OutputImageDimension)> ExtractImageFilterRegionCopierType;
56
57   void SetExtractionRegion(InputImageRegionType extractRegion);
58   itkGetMacro(ExtractionRegion, InputImageRegionType);
59
60 #ifdef ITK_USE_CONCEPT_CHECKING
61   /** Begin concept checking */
62   itkConceptMacro(InputCovertibleToOutputCheck,
63                   (itk::Concept::Convertible<InputImagePixelType, OutputImagePixelType>));
64   /** End concept checking */
65 #endif
66
67 protected:
68   ExtractImageFilter();
69   ~ExtractImageFilter() {};
70   void PrintSelf(std::ostream& os, itk::Indent indent) const;
71
72
73   virtual void GenerateOutputInformation();
74
75
76   virtual void CallCopyOutputRegionToInputRegion(InputImageRegionType &destRegion,
77                                                  const OutputImageRegionType &srcRegion);
78
79
80   void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
81                             int threadId );
82   InputImageRegionType m_ExtractionRegion;
83   OutputImageRegionType m_OutputImageRegion;
84
85 private:
86   ExtractImageFilter(const Self&); //purposely not implemented
87   void operator=(const Self&); //purposely not implemented
88   
89 };
90
91   
92 } // end namespace itk
93   
94 #ifndef ITK_MANUAL_INSTANTIATION
95 #include "clitkExtractImageFilter.txx"
96 #endif
97   
98 #endif