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 CLITKRELATIVEPOSITIONANALYZERFILTER_H
20 #define CLITKRELATIVEPOSITIONANALYZERFILTER_H
23 #include "clitkFilterWithAnatomicalFeatureDatabaseManagement.h"
24 #include "clitkFilterBase.h"
25 #include "clitkSliceBySliceRelativePositionFilter.h"
28 #include <itkImageToImageFilter.h>
29 #include <itkLabelStatisticsImageFilter.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 RelativePositionAnalyzerFilter:
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 RelativePositionAnalyzerFilter<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(RelativePositionAnalyzerFilter, 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;
76 /** Input : initial image and object */
77 void SetInputSupport(const ImageType * image);
78 void SetInputObject(const ImageType * image);
79 void SetInputTarget(const ImageType * image);
82 itkGetConstMacro(BackgroundValue, PixelType);
83 itkSetMacro(BackgroundValue, PixelType);
85 itkGetConstMacro(ForegroundValue, PixelType);
86 itkSetMacro(ForegroundValue, PixelType);
91 // I dont want to verify inputs information
92 virtual void VerifyInputInformation() { }
95 RelativePositionAnalyzerFilter();
96 virtual ~RelativePositionAnalyzerFilter() {}
98 PixelType m_BackgroundValue;
99 PixelType m_ForegroundValue;
100 ImagePointer m_Support;
101 ImagePointer m_Object;
102 ImagePointer m_Target;
104 virtual void GenerateOutputInformation();
105 virtual void GenerateInputRequestedRegion();
106 virtual void GenerateData();
108 typename FloatImageType::Pointer
109 ComputeFuzzyMap(ImageType * object, ImageType * target, double angle);
112 ComputeOptimalThresholds(FloatImageType * map, ImageType * target, int bins, double tolerance,
113 double & threshold, double & reverseThreshold);
115 RelativePositionAnalyzerFilter(const Self&); //purposely not implemented
116 void operator=(const Self&); //purposely not implemented
119 //--------------------------------------------------------------------
121 } // end namespace clitk
122 //--------------------------------------------------------------------
124 #include "clitkRelativePositionAnalyzerFilter.txx"