]> Creatis software - clitk.git/blob - segmentation/clitkRelativePositionList.h
Debug RTStruct conversion with empty struc
[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     itkGetConstMacro(ComputeOverlapFlag, bool);
80     itkSetMacro(ComputeOverlapFlag, bool);
81     itkBooleanMacro(ComputeOverlapFlag);
82
83     void Read(std::string filename);     
84     void SetFilterOptions(typename RelPosFilterType::Pointer filter, ArgsInfoType & options);
85     void SetReferenceImageForOverlapMeasure(ImagePointer ref);
86
87   protected:
88     RelativePositionList();
89     virtual ~RelativePositionList() {}
90
91   private:
92     RelativePositionList(const Self&); //purposely not implemented
93     void operator=(const Self&); //purposely not implemented
94     
95     void GenerateInputRequestedRegion();
96     void GenerateOutputInformation();
97     void GenerateData();
98
99     std::string m_InputName;
100     ImagePixelType m_BackgroundValue;
101     ImagePixelType m_ForegroundValue;
102     typename SliceRelPosFilterType::Pointer mFilter;
103     std::vector<ArgsInfoType> mArgsInfoList;
104     ImagePointer m_working_input;
105     ImagePointer m_reference;
106     bool m_ComputeOverlapFlag;
107
108   }; // end class
109   //--------------------------------------------------------------------
110
111 } // end namespace clitk
112 //--------------------------------------------------------------------
113
114 #include "clitkRelativePositionList.txx"
115
116 #endif