]> Creatis software - clitk.git/blob - segmentation/clitkRelativePositionList.h
Put back and refactored manual rigid registration
[clitk.git] / segmentation / clitkRelativePositionList.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://oncora1.lyon.fnclcc.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 CLITKRELATIVEPOSITIONLIST_H
20 #define CLITKRELATIVEPOSITIONLIST_H
21
22 // clitk
23 #include "clitkSegmentationUtils.h"
24 #include "clitkFilterWithAnatomicalFeatureDatabaseManagement.h"
25 #include "clitkRelativePosition_ggo.h"
26
27 namespace clitk {
28   
29   /*--------------------------------------------------------------------
30     Manage a list of RelativePosition operations, to be performed on
31     the same input image, with different objects and parameters.
32     ------------------------------------------------------------------*/
33   
34   template <class TImageType>
35   class ITK_EXPORT RelativePositionList:
36     public virtual clitk::FilterBase, 
37     public clitk::FilterWithAnatomicalFeatureDatabaseManagement,
38     public itk::ImageToImageFilter<TImageType, TImageType>
39   {
40
41   public:
42     /** Standard class typedefs. */
43     typedef itk::ImageToImageFilter<TImageType, TImageType> Superclass;
44     typedef RelativePositionList           Self;
45     typedef itk::SmartPointer<Self>        Pointer;
46     typedef itk::SmartPointer<const Self>  ConstPointer;
47     
48     /** Method for creation through the object factory. */
49     itkNewMacro(Self);
50     
51     /** Run-time type information (and related methods). */
52     itkTypeMacro(RelativePositionList, ImageToImageFilter);
53
54       /** Some convenient typedefs. */
55     typedef TImageType                       ImageType;
56     typedef typename ImageType::ConstPointer ImageConstPointer;
57     typedef typename ImageType::Pointer      ImagePointer;
58     typedef typename ImageType::RegionType   ImageRegionType; 
59     typedef typename ImageType::PixelType    ImagePixelType; 
60     typedef typename ImageType::SizeType     ImageSizeType; 
61     typedef typename ImageType::IndexType    ImageIndexType; 
62     typedef typename ImageType::PointType    ImagePointType;     
63     typedef struct args_info_clitkRelativePosition ArgsInfoType;
64     typedef SliceBySliceRelativePositionFilter<ImageType> SliceRelPosFilterType;
65     typedef AddRelativePositionConstraintToLabelImageFilter<ImageType> RelPosFilterType;
66
67     /** ImageDimension constants */
68     itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
69     FILTERBASE_INIT;
70    
71     itkGetConstMacro(BackgroundValue, ImagePixelType);
72     itkGetConstMacro(ForegroundValue, ImagePixelType);
73     itkSetMacro(BackgroundValue, ImagePixelType);
74     itkSetMacro(ForegroundValue, ImagePixelType);
75
76     itkSetMacro(InputName, std::string);
77     itkGetConstMacro(InputName, std::string);
78
79     void Read(std::string filename);     
80     void SetFilterOptions(typename RelPosFilterType::Pointer filter, ArgsInfoType & options);
81
82   protected:
83     RelativePositionList();
84     virtual ~RelativePositionList() {}
85
86   private:
87     RelativePositionList(const Self&); //purposely not implemented
88     void operator=(const Self&); //purposely not implemented
89     
90     void GenerateInputRequestedRegion();
91     void GenerateOutputInformation();
92     void GenerateData();
93
94     std::string m_InputName;
95     ImagePixelType m_BackgroundValue;
96     ImagePixelType m_ForegroundValue;
97     typename SliceRelPosFilterType::Pointer mFilter;
98     std::vector<ArgsInfoType> mArgsInfoList;
99     ImagePointer m_working_input;
100
101   }; // end class
102   //--------------------------------------------------------------------
103
104 } // end namespace clitk
105 //--------------------------------------------------------------------
106
107 #include "clitkRelativePositionList.txx"
108
109 #endif