itkLabelImageToStatisticsLabelMapFilter.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkLabelImageToStatisticsLabelMapFilter_h
00018 #define __itkLabelImageToStatisticsLabelMapFilter_h
00019
00020 #include "itkImageToImageFilter.h"
00021 #include "itkStatisticsLabelObject.h"
00022 #include "itkLabelMap.h"
00023 #include "itkLabelImageToLabelMapFilter.h"
00024 #include "itkStatisticsLabelMapFilter.h"
00025
00026
00027 namespace itk {
00028
00041 template<class TInputImage, class TFeatureImage, class TOutputImage=LabelMap< StatisticsLabelObject< ITK_TYPENAME TInputImage::PixelType, ::itk::GetImageDimension<TInputImage>::ImageDimension> > >
00042 class ITK_EXPORT LabelImageToStatisticsLabelMapFilter :
00043 public ImageToImageFilter<TInputImage, TOutputImage>
00044 {
00045 public:
00047 typedef LabelImageToStatisticsLabelMapFilter Self;
00048 typedef ImageToImageFilter<TInputImage, TOutputImage> Superclass;
00049 typedef SmartPointer<Self> Pointer;
00050 typedef SmartPointer<const Self> ConstPointer;
00051
00053 typedef TInputImage InputImageType;
00054 typedef typename InputImageType::Pointer InputImagePointer;
00055 typedef typename InputImageType::ConstPointer InputImageConstPointer;
00056 typedef typename InputImageType::RegionType InputImageRegionType;
00057 typedef typename InputImageType::PixelType InputImagePixelType;
00058
00059 typedef TOutputImage OutputImageType;
00060 typedef typename OutputImageType::Pointer OutputImagePointer;
00061 typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
00062 typedef typename OutputImageType::RegionType OutputImageRegionType;
00063 typedef typename OutputImageType::PixelType OutputImagePixelType;
00064 typedef typename OutputImageType::LabelObjectType LabelObjectType;
00065
00066 typedef TFeatureImage FeatureImageType;
00067 typedef typename FeatureImageType::Pointer FeatureImagePointer;
00068 typedef typename FeatureImageType::ConstPointer FeatureImageConstPointer;
00069 typedef typename FeatureImageType::PixelType FeatureImagePixelType;
00070
00072 itkStaticConstMacro(InputImageDimension, unsigned int,
00073 TInputImage::ImageDimension);
00074 itkStaticConstMacro(OutputImageDimension, unsigned int,
00075 TInputImage::ImageDimension);
00076 itkStaticConstMacro(ImageDimension, unsigned int,
00077 TInputImage::ImageDimension);
00079
00080 typedef LabelImageToLabelMapFilter< InputImageType, OutputImageType > LabelizerType;
00081 typedef StatisticsLabelMapFilter< OutputImageType, FeatureImageType > LabelObjectValuatorType;
00082
00084 itkNewMacro(Self);
00085
00087 itkTypeMacro(LabelImageToStatisticsLabelMapFilter,
00088 ImageToImageFilter);
00089
00090 #ifdef ITK_USE_CONCEPT_CHECKING
00091
00092 itkConceptMacro(InputEqualityComparableCheck,
00093 (Concept::EqualityComparable<InputImagePixelType>));
00094 itkConceptMacro(IntConvertibleToInputCheck,
00095 (Concept::Convertible<int, InputImagePixelType>));
00096 itkConceptMacro(InputOStreamWritableCheck,
00097 (Concept::OStreamWritable<InputImagePixelType>));
00098
00100 #endif
00101
00106 itkSetMacro(BackgroundValue, OutputImagePixelType);
00107 itkGetConstMacro(BackgroundValue, OutputImagePixelType);
00109
00114 itkSetMacro(ComputeFeretDiameter, bool);
00115 itkGetConstReferenceMacro(ComputeFeretDiameter, bool);
00116 itkBooleanMacro(ComputeFeretDiameter);
00118
00123 itkSetMacro(ComputePerimeter, bool);
00124 itkGetConstReferenceMacro(ComputePerimeter, bool);
00125 itkBooleanMacro(ComputePerimeter);
00127
00129 void SetFeatureImage(const TFeatureImage *input)
00130 {
00131
00132 this->SetNthInput( 1, const_cast<TFeatureImage *>(input) );
00133 }
00134
00136 const FeatureImageType * GetFeatureImage()
00137 {
00138 return static_cast<FeatureImageType*>(this->ProcessObject::GetInput(1));
00139 }
00140
00142 void SetInput1(const InputImageType *input)
00143 {
00144 this->SetInput( input );
00145 }
00146
00148 void SetInput2(const FeatureImageType *input)
00149 {
00150 this->SetFeatureImage( input );
00151 }
00152
00159 itkSetMacro(ComputeHistogram, bool);
00160 itkGetConstReferenceMacro(ComputeHistogram, bool);
00161 itkBooleanMacro(ComputeHistogram);
00163
00169 itkSetMacro(NumberOfBins, unsigned int);
00170 itkGetConstReferenceMacro(NumberOfBins, unsigned int);
00172
00173
00174 protected:
00175 LabelImageToStatisticsLabelMapFilter();
00176 ~LabelImageToStatisticsLabelMapFilter() {};
00177 void PrintSelf(std::ostream& os, Indent indent) const;
00178
00182 void GenerateInputRequestedRegion();
00183
00185 void EnlargeOutputRequestedRegion(DataObject *itkNotUsed(output));
00186
00189 void GenerateData();
00190
00191
00192 private:
00193 LabelImageToStatisticsLabelMapFilter(const Self&);
00194 void operator=(const Self&);
00195
00196 OutputImagePixelType m_BackgroundValue;
00197 bool m_ComputeFeretDiameter;
00198 bool m_ComputePerimeter;
00199 unsigned int m_NumberOfBins;
00200 bool m_ComputeHistogram;
00201
00202 };
00203
00204 }
00205
00206 #ifndef ITK_MANUAL_INSTANTIATION
00207 #include "itkLabelImageToStatisticsLabelMapFilter.txx"
00208 #endif
00209
00210 #endif
00211