1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
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
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.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ======================================================================-====*/
19 #ifndef CLITKSLICEBYSLICERELATIVEPOSITIONFILTER_H
20 #define CLITKSLICEBYSLICERELATIVEPOSITIONFILTER_H
23 #include "clitkFilterBase.h"
24 #include "clitkAddRelativePositionConstraintToLabelImageFilter.h"
28 //--------------------------------------------------------------------
30 Perform Relative Position filtering in a slice by slice manner.
32 //--------------------------------------------------------------------
34 template <class ImageType>
35 class ITK_EXPORT SliceBySliceRelativePositionFilter:
36 public AddRelativePositionConstraintToLabelImageFilter<ImageType>
40 /** Standard class typedefs. */
41 typedef AddRelativePositionConstraintToLabelImageFilter<ImageType> Superclass;
42 typedef SliceBySliceRelativePositionFilter Self;
43 typedef itk::SmartPointer<Self> Pointer;
44 typedef itk::SmartPointer<const Self> ConstPointer;
46 /** Method for creation through the object factory. */
49 /** Run-time type information (and related methods). */
50 itkTypeMacro(SliceBySliceRelativePositionFilter, ImageToImageFilter);
53 /** ImageDimension constants */
54 itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
55 typedef itk::Image<float, ImageDimension> FloatImageType;
56 typedef itk::Image<float, ImageDimension-1> FloatSliceType;
58 /** Some convenient typedefs. */
59 typedef typename ImageType::ConstPointer ImageConstPointer;
60 typedef typename ImageType::Pointer ImagePointer;
61 typedef typename ImageType::RegionType RegionType;
62 typedef typename ImageType::PixelType PixelType;
63 typedef typename ImageType::SpacingType SpacingType;
64 typedef typename ImageType::SizeType SizeType;
65 typedef itk::Image<PixelType, ImageDimension-1> SliceType;
66 typedef clitk::AddRelativePositionConstraintToLabelImageFilter<SliceType> RelPosFilterType;
67 typedef typename RelPosFilterType::OrientationTypeEnumeration OrientationTypeEnumeration;
69 /** Input : initial image and object */
70 void SetInput(const ImageType * image);
71 void SetInputObject(const ImageType * image);
74 void PrintOptions(std::ostream & os = std::cout);
75 itkGetConstMacro(Direction, int);
76 itkSetMacro(Direction, int);
78 itkGetConstMacro(UniqueConnectedComponentBySliceFlag, bool);
79 itkSetMacro(UniqueConnectedComponentBySliceFlag, bool);
80 itkBooleanMacro(UniqueConnectedComponentBySliceFlag);
82 itkGetConstMacro(IgnoreEmptySliceObjectFlag, bool);
83 itkSetMacro(IgnoreEmptySliceObjectFlag, bool);
84 itkBooleanMacro(IgnoreEmptySliceObjectFlag);
86 itkGetConstMacro(UseTheLargestObjectCCLFlag, bool);
87 itkSetMacro(UseTheLargestObjectCCLFlag, bool);
88 itkBooleanMacro(UseTheLargestObjectCCLFlag);
90 itkGetConstMacro(ObjectCCLSelectionFlag, bool);
91 itkSetMacro(ObjectCCLSelectionFlag, bool);
92 itkBooleanMacro(ObjectCCLSelectionFlag);
93 itkGetConstMacro(ObjectCCLSelectionDimension, int);
94 itkSetMacro(ObjectCCLSelectionDimension, int);
95 itkGetConstMacro(ObjectCCLSelectionDirection, int);
96 itkSetMacro(ObjectCCLSelectionDirection, int);
97 itkGetConstMacro(ObjectCCLSelectionIgnoreSingleCCLFlag, bool);
98 itkSetMacro(ObjectCCLSelectionIgnoreSingleCCLFlag, bool);
99 itkBooleanMacro(ObjectCCLSelectionIgnoreSingleCCLFlag);
101 itkGetConstMacro(VerboseSlicesFlag, bool);
102 itkSetMacro(VerboseSlicesFlag, bool);
103 itkBooleanMacro(VerboseSlicesFlag);
106 SliceBySliceRelativePositionFilter();
107 virtual ~SliceBySliceRelativePositionFilter() {}
109 virtual void GenerateOutputInformation();
110 virtual void GenerateInputRequestedRegion();
111 virtual void GenerateData();
115 ImagePointer m_working_input;
116 ImagePointer m_working_object;
117 bool m_UniqueConnectedComponentBySliceFlag;
119 bool m_IgnoreEmptySliceObjectFlag;
120 bool m_UseTheLargestObjectCCLFlag;
121 bool m_ObjectCCLSelectionFlag;
122 int m_ObjectCCLSelectionDimension;
123 int m_ObjectCCLSelectionDirection;
124 bool m_ObjectCCLSelectionIgnoreSingleCCLFlag;
125 bool m_VerboseSlicesFlag;
128 SliceBySliceRelativePositionFilter(const Self&); //purposely not implemented
129 void operator=(const Self&); //purposely not implemented
132 //--------------------------------------------------------------------
134 } // end namespace clitk
135 //--------------------------------------------------------------------
137 #ifndef ITK_MANUAL_INSTANTIATION
138 #include "clitkSliceBySliceRelativePositionFilter.txx"
141 typedef unsigned char PixelType_uchar;
142 typedef itk::Image<PixelType_uchar, 3> ImageType_uchar;
143 extern template class clitk::SliceBySliceRelativePositionFilter<ImageType_uchar>;