Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkLabelImageToStatisticsLabelMapFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkLabelImageToStatisticsLabelMapFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-08-10 11:54:59 $
00007   Version:   $Revision: 1.3 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
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     // Process object is not const-correct so the const casting is required.
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&); //purposely not implemented
00194   void operator=(const Self&); //purposely not implemented
00195 
00196   OutputImagePixelType  m_BackgroundValue;
00197   bool                  m_ComputeFeretDiameter;
00198   bool                  m_ComputePerimeter;
00199   unsigned int          m_NumberOfBins;
00200   bool                  m_ComputeHistogram;
00201 
00202 }; // end of class
00203 
00204 } // end namespace itk
00205   
00206 #ifndef ITK_MANUAL_INSTANTIATION
00207 #include "itkLabelImageToStatisticsLabelMapFilter.txx"
00208 #endif
00209 
00210 #endif
00211 

Generated at Mon Jul 12 2010 18:57:02 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000