]> Creatis software - clitk.git/blob - itk/clitkExtractImageFilter.h
First version to convert image to dicomrtstruct
[clitk.git] / itk / clitkExtractImageFilter.h
1
2 /*=========================================================================
3   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
4
5   Authors belong to: 
6   - University of LYON              http://www.universite-lyon.fr/
7   - Léon Bérard cancer center       http://www.centreleonberard.fr
8   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
9
10   This software is distributed WITHOUT ANY WARRANTY; without even
11   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12   PURPOSE.  See the copyright notices for more information.
13
14   It is distributed under dual licence
15
16   - BSD        See included LICENSE.txt file
17   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
18 ===========================================================================**/
19 #ifndef __clitkExtractImageFilter_h
20 #define __clitkExtractImageFilter_h
21
22 #include "itkImageToImageFilter.h"
23 #include "itkSmartPointer.h"
24 #include "itkExtractImageFilterRegionCopier.h"
25
26 namespace clitk
27 {
28
29 template <class TInputImage, class TOutputImage>
30 class ITK_EXPORT ExtractImageFilter:
31     public itk::ImageToImageFilter<TInputImage,TOutputImage>
32 {
33 public:
34   /** Standard class typedefs. */
35   typedef ExtractImageFilter         Self;
36   typedef itk::ImageToImageFilter<TInputImage,TOutputImage>  Superclass;
37   typedef itk::SmartPointer<Self>  Pointer;
38   typedef itk::SmartPointer<const Self>  ConstPointer;
39
40   /** Method for creation through the object factory. */
41   itkNewMacro(Self);  
42
43   /** Run-time type information (and related methods). */
44   itkTypeMacro(ExtractImageFilter, ImageToImageFilter);
45
46   /** Image type information. */
47   typedef TInputImage  InputImageType;
48   typedef TOutputImage OutputImageType;
49
50   /** Typedef to describe the output and input image region types. */
51   typedef typename TOutputImage::RegionType OutputImageRegionType;
52   typedef typename TInputImage::RegionType InputImageRegionType;
53
54   /** Typedef to describe the type of pixel. */
55   typedef typename TOutputImage::PixelType OutputImagePixelType;
56   typedef typename TInputImage::PixelType InputImagePixelType;
57
58   /** Typedef to describe the output and input image index and size types. */
59   typedef typename TOutputImage::IndexType OutputImageIndexType;
60   typedef typename TInputImage::IndexType InputImageIndexType;
61   typedef typename TOutputImage::SizeType OutputImageSizeType;
62   typedef typename TInputImage::SizeType InputImageSizeType;
63
64   /** ImageDimension enumeration */
65   itkStaticConstMacro(InputImageDimension, unsigned int,
66                       TInputImage::ImageDimension);
67   itkStaticConstMacro(OutputImageDimension, unsigned int,
68                       TOutputImage::ImageDimension);
69
70   typedef itk::ImageToImageFilterDetail::ExtractImageFilterRegionCopier<
71     itkGetStaticConstMacro(InputImageDimension), 
72     itkGetStaticConstMacro(OutputImageDimension)> ExtractImageFilterRegionCopierType;
73
74   void SetExtractionRegion(InputImageRegionType extractRegion);
75   itkGetMacro(ExtractionRegion, InputImageRegionType);
76
77 #ifdef ITK_USE_CONCEPT_CHECKING
78   /** Begin concept checking */
79   itkConceptMacro(InputCovertibleToOutputCheck,
80                   (itk::Concept::Convertible<InputImagePixelType, OutputImagePixelType>));
81   /** End concept checking */
82 #endif
83
84 protected:
85   ExtractImageFilter();
86   ~ExtractImageFilter() {};
87   void PrintSelf(std::ostream& os, itk::Indent indent) const;
88
89
90   virtual void GenerateOutputInformation();
91
92
93   virtual void CallCopyOutputRegionToInputRegion(InputImageRegionType &destRegion,
94                                                  const OutputImageRegionType &srcRegion);
95
96
97 #if ITK_VERSION_MAJOR >= 4
98   void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId );
99 #else
100   void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, int threadId );
101 #endif
102
103   InputImageRegionType m_ExtractionRegion;
104   OutputImageRegionType m_OutputImageRegion;
105
106 private:
107   ExtractImageFilter(const Self&); //purposely not implemented
108   void operator=(const Self&); //purposely not implemented
109   
110 };
111
112   
113 } // end namespace itk
114   
115 #ifndef ITK_MANUAL_INSTANTIATION
116 #include "clitkExtractImageFilter.txx"
117 #endif
118   
119 #endif