]> Creatis software - clitk.git/blob - tools/clitkCropImageGenericFilter.h
Merge branch 'master' of https://github.com/open-vv/vv
[clitk.git] / tools / clitkCropImageGenericFilter.h
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to:
5   - University of LYON              http://www.universite-lyon.fr/
6   - Léon Bérard cancer center       http://www.centreleonberard.fr
7   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
8
9   This software is distributed WITHOUT ANY WARRANTY; without even
10   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11   PURPOSE.  See the copyright notices for more information.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
18
19 #ifndef CLITKCROPIMAGEGENERICFILTER_H
20 #define CLITKCROPIMAGEGENERICFILTER_H
21
22 // clitk
23 #include "clitkIO.h"
24 #include "clitkImageToImageGenericFilter.h"
25 #include "clitkCropLikeImageFilter.h"
26 #include "clitkAutoCropFilter.h"
27 #include "clitkCropImage_ggo.h"
28
29 // itk
30 #include <itkCropImageFilter.h>
31
32 //--------------------------------------------------------------------
33 namespace clitk
34 {
35
36   class ITK_EXPORT CropImageGenericFilter:
37     public ImageToImageGenericFilter<CropImageGenericFilter>
38   {
39   public:
40     //--------------------------------------------------------------------
41     CropImageGenericFilter();
42
43     //--------------------------------------------------------------------
44     typedef CropImageGenericFilter   Self;
45     typedef ImageToImageGenericFilter<CropImageGenericFilter> Superclass;
46     typedef itk::SmartPointer<Self>       Pointer;
47     typedef itk::SmartPointer<const Self> ConstPointer;
48     typedef args_info_clitkCropImage       args_info_type;
49
50     //--------------------------------------------------------------------
51     itkNewMacro(Self);
52     itkTypeMacro( CropImageGenericFilter, LightObject );
53
54     //--------------------------------------------------------------------
55     void SetArgsInfo(const args_info_type& a);
56
57     //--------------------------------------------------------------------
58     // Main function called each time the filter is updated
59     template<class ImageType>
60     void UpdateWithInputImageType();
61
62   protected:
63     template <class ImageType>
64     class AutoCrop
65     {
66     public:
67       typedef typename ImageType::Pointer ImagePointer;
68       ImagePointer Do(args_info_type &, ImagePointer);
69     private:
70       template<unsigned int> struct PixelDimType {};
71       template<unsigned int Dim> ImagePointer Do(args_info_type &,ImagePointer, PixelDimType<Dim> *);
72       ImagePointer Do(args_info_type &, ImagePointer, PixelDimType<1> *);
73     };
74
75     template<unsigned int Dim> void InitializeImageType();
76     args_info_type mArgsInfo;
77
78   };// end class
79   //--------------------------------------------------------------------
80 } // end namespace clitk
81
82 #endif // #define CLITKCROPIMAGEGENERICFILTER_H