itkBinaryImageToStatisticsLabelMapFilter.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 __itkBinaryImageToStatisticsLabelMapFilter_h
00018 #define __itkBinaryImageToStatisticsLabelMapFilter_h
00019
00020 #include "itkImageToImageFilter.h"
00021 #include "itkStatisticsLabelObject.h"
00022 #include "itkLabelMap.h"
00023 #include "itkBinaryImageToLabelMapFilter.h"
00024 #include "itkStatisticsLabelMapFilter.h"
00025
00026
00027 namespace itk {
00028
00041 template<class TInputImage, class TFeatureImage, class TOutputImage=LabelMap< StatisticsLabelObject< unsigned long, ::itk::GetImageDimension<TInputImage>::ImageDimension > > >
00042 class ITK_EXPORT BinaryImageToStatisticsLabelMapFilter :
00043 public ImageToImageFilter<TInputImage, TOutputImage>
00044 {
00045 public:
00047 typedef BinaryImageToStatisticsLabelMapFilter 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 BinaryImageToLabelMapFilter< InputImageType, OutputImageType > LabelizerType;
00081 typedef StatisticsLabelMapFilter< OutputImageType, FeatureImageType > LabelObjectValuatorType;
00082
00084 itkNewMacro(Self);
00085
00087 itkTypeMacro(BinaryImageToStatisticsLabelMapFilter,
00088 ImageToImageFilter);
00089
00096 itkSetMacro(FullyConnected, bool);
00097 itkGetConstReferenceMacro(FullyConnected, bool);
00098 itkBooleanMacro(FullyConnected);
00100
00101 #ifdef ITK_USE_CONCEPT_CHECKING
00102
00103 itkConceptMacro(InputEqualityComparableCheck,
00104 (Concept::EqualityComparable<InputImagePixelType>));
00105 itkConceptMacro(IntConvertibleToInputCheck,
00106 (Concept::Convertible<int, InputImagePixelType>));
00107 itkConceptMacro(InputOStreamWritableCheck,
00108 (Concept::OStreamWritable<InputImagePixelType>));
00109
00111 #endif
00112
00117 itkSetMacro(OutputBackgroundValue, OutputImagePixelType);
00118 itkGetConstMacro(OutputBackgroundValue, OutputImagePixelType);
00120
00125 itkSetMacro(InputForegroundValue, InputImagePixelType);
00126 itkGetConstMacro(InputForegroundValue, InputImagePixelType);
00128
00133 itkSetMacro(ComputeFeretDiameter, bool);
00134 itkGetConstReferenceMacro(ComputeFeretDiameter, bool);
00135 itkBooleanMacro(ComputeFeretDiameter);
00137
00142 itkSetMacro(ComputePerimeter, bool);
00143 itkGetConstReferenceMacro(ComputePerimeter, bool);
00144 itkBooleanMacro(ComputePerimeter);
00146
00148 void SetFeatureImage(const TFeatureImage *input)
00149 {
00150
00151 this->SetNthInput( 1, const_cast<TFeatureImage *>(input) );
00152 }
00153
00155 const FeatureImageType * GetFeatureImage()
00156 {
00157 return static_cast<const FeatureImageType*>(this->ProcessObject::GetInput(1));
00158 }
00159
00161 void SetInput1(const InputImageType *input)
00162 {
00163 this->SetInput( input );
00164 }
00165
00167 void SetInput2(const FeatureImageType *input)
00168 {
00169 this->SetFeatureImage( input );
00170 }
00171
00178 itkSetMacro(ComputeHistogram, bool);
00179 itkGetConstReferenceMacro(ComputeHistogram, bool);
00180 itkBooleanMacro(ComputeHistogram);
00182
00188 itkSetMacro(NumberOfBins, unsigned int);
00189 itkGetConstReferenceMacro(NumberOfBins, unsigned int);
00191
00192
00193 protected:
00194 BinaryImageToStatisticsLabelMapFilter();
00195 ~BinaryImageToStatisticsLabelMapFilter() {};
00196 void PrintSelf(std::ostream& os, Indent indent) const;
00197
00201 void GenerateInputRequestedRegion();
00202
00204 void EnlargeOutputRequestedRegion(DataObject *itkNotUsed(output));
00205
00208 void GenerateData();
00209
00210
00211 private:
00212 BinaryImageToStatisticsLabelMapFilter(const Self&);
00213 void operator=(const Self&);
00214
00215 bool m_FullyConnected;
00216 OutputImagePixelType m_OutputBackgroundValue;
00217 InputImagePixelType m_InputForegroundValue;
00218 bool m_ComputeFeretDiameter;
00219 bool m_ComputePerimeter;
00220 unsigned int m_NumberOfBins;
00221 bool m_ComputeHistogram;
00222
00223 };
00224
00225 }
00226
00227 #ifndef ITK_MANUAL_INSTANTIATION
00228 #include "itkBinaryImageToStatisticsLabelMapFilter.txx"
00229 #endif
00230
00231 #endif
00232