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://www.centreleonberard.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 CLITKRelativePositionDataBaseBuilderFILTER_H
20 #define CLITKRelativePositionDataBaseBuilderFILTER_H
23 #include "clitkFilterWithAnatomicalFeatureDatabaseManagement.h"
24 #include "clitkFilterBase.h"
25 #include "clitkRelativePositionAnalyzerFilter.h"
26 #include "clitkRelativePositionDataBase.h"
29 #include <itkImageToImageFilter.h>
33 //--------------------------------------------------------------------
35 Analyze the relative position of a Target (mask image) according
36 to some Object, in a given Support. Indicate the main important
37 position of this Target according the Object.
39 //--------------------------------------------------------------------
41 template <class ImageType>
42 class RelativePositionDataBaseBuilderFilter:
43 public virtual FilterBase,
44 public clitk::FilterWithAnatomicalFeatureDatabaseManagement,
45 public itk::ImageToImageFilter<ImageType, ImageType>
49 /** Standard class typedefs. */
50 typedef itk::ImageToImageFilter<ImageType, ImageType> Superclass;
51 typedef RelativePositionDataBaseBuilderFilter<ImageType> Self;
52 typedef itk::SmartPointer<Self> Pointer;
53 typedef itk::SmartPointer<const Self> ConstPointer;
55 /** Method for creation through the object factory. */
58 /** Run-time type information (and related methods). */
59 itkTypeMacro(RelativePositionDataBaseBuilderFilter, ImageToImageFilter);
61 /** Some convenient typedefs. */
62 typedef typename ImageType::ConstPointer ImageConstPointer;
63 typedef typename ImageType::Pointer ImagePointer;
64 typedef typename ImageType::RegionType RegionType;
65 typedef typename ImageType::PixelType PixelType;
66 typedef typename ImageType::SpacingType SpacingType;
67 typedef typename ImageType::SizeType SizeType;
68 typedef typename ImageType::IndexType IndexType;
69 typedef typename ImageType::PointType PointType;
71 /** ImageDimension constants */
72 itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
74 typedef itk::Image<float, ImageDimension> FloatImageType;
77 itkGetConstMacro(SupportName, std::string);
78 itkSetMacro(SupportName, std::string);
80 itkGetConstMacro(TargetName, std::string);
81 itkSetMacro(TargetName, std::string);
83 void AddObjectName(std::string s) { m_ObjectNames.push_back(s); }
84 std::string & GetObjectName(int i) { return m_ObjectNames[i]; }
85 int GetNumberOfObjects() { return m_ObjectNames.size(); }
88 itkGetConstMacro(BackgroundValue, PixelType);
89 itkSetMacro(BackgroundValue, PixelType);
91 itkGetConstMacro(ForegroundValue, PixelType);
92 itkSetMacro(ForegroundValue, PixelType);
94 itkGetConstMacro(NumberOfBins, int);
95 itkSetMacro(NumberOfBins, int);
97 itkGetConstMacro(NumberOfAngles, int);
98 itkSetMacro(NumberOfAngles, int);
100 itkGetConstMacro(AreaLossTolerance, double);
101 itkSetMacro(AreaLossTolerance, double);
106 // I dont want to verify inputs information
107 virtual void VerifyInputInformation() { }
110 RelativePositionDataBaseBuilderFilter();
111 virtual ~RelativePositionDataBaseBuilderFilter() {}
113 PixelType m_BackgroundValue;
114 PixelType m_ForegroundValue;
116 ImagePointer m_Support;
117 ImagePointer m_Object;
118 ImagePointer m_Target;
120 std::string m_SupportName;
121 std::string m_TargetName;
122 std::vector<std::string> m_ObjectNames;
124 int m_NumberOfAngles;
125 std::vector<double> m_ListOfAngles;
126 std::vector<clitk::RelativePositionDirectionType> m_ListOfDirections;
129 double m_AreaLossTolerance;
131 virtual void GenerateOutputInformation();
132 virtual void GenerateInputRequestedRegion();
133 virtual void GenerateData();
135 typename FloatImageType::Pointer
136 ComputeFuzzyMap(ImageType * object, ImageType * target, double angle);
139 ComputeOptimalThresholds(FloatImageType * map, ImageType * target, int bins, double tolerance,
140 double & threshold, double & reverseThreshold);
142 RelativePositionDataBaseBuilderFilter(const Self&); //purposely not implemented
143 void operator=(const Self&); //purposely not implemented
146 //--------------------------------------------------------------------
148 } // end namespace clitk
149 //--------------------------------------------------------------------
151 #include "clitkRelativePositionDataBaseBuilderFilter.txx"