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

itkLabelStatisticsOpeningImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkLabelStatisticsOpeningImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-08-11 14:24:44 $
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 __itkLabelStatisticsOpeningImageFilter_h
00018 #define __itkLabelStatisticsOpeningImageFilter_h
00019 
00020 #include "itkImageToImageFilter.h"
00021 #include "itkStatisticsLabelObject.h"
00022 #include "itkLabelMap.h"
00023 #include "itkLabelImageToLabelMapFilter.h"
00024 #include "itkStatisticsLabelMapFilter.h"
00025 #include "itkStatisticsOpeningLabelMapFilter.h"
00026 #include "itkLabelMapToLabelImageFilter.h"
00027 
00028 
00029 namespace itk {
00030 
00047 template<class TInputImage, class TFeatureImage>
00048 class ITK_EXPORT LabelStatisticsOpeningImageFilter : 
00049     public ImageToImageFilter<TInputImage, TInputImage>
00050 {
00051 public:
00053   typedef LabelStatisticsOpeningImageFilter            Self;
00054   typedef ImageToImageFilter<TInputImage, TInputImage> Superclass;
00055   typedef SmartPointer<Self>                           Pointer;
00056   typedef SmartPointer<const Self>                     ConstPointer;
00057 
00059   typedef TInputImage                              InputImageType;
00060   typedef TInputImage                              OutputImageType;
00061   typedef typename InputImageType::Pointer         InputImagePointer;
00062   typedef typename InputImageType::ConstPointer    InputImageConstPointer;
00063   typedef typename InputImageType::RegionType      InputImageRegionType;
00064   typedef typename InputImageType::PixelType       InputImagePixelType;
00065   typedef typename OutputImageType::Pointer        OutputImagePointer;
00066   typedef typename OutputImageType::ConstPointer   OutputImageConstPointer;
00067   typedef typename OutputImageType::RegionType     OutputImageRegionType;
00068   typedef typename OutputImageType::PixelType      OutputImagePixelType;
00069 
00070   typedef TFeatureImage                              FeatureImageType;
00071   typedef typename FeatureImageType::Pointer         FeatureImagePointer;
00072   typedef typename FeatureImageType::ConstPointer    FeatureImageConstPointer;
00073   typedef typename FeatureImageType::PixelType       FeatureImagePixelType;
00074 
00076   itkStaticConstMacro(InputImageDimension, unsigned int,
00077                       TInputImage::ImageDimension);
00078   itkStaticConstMacro(OutputImageDimension, unsigned int,
00079                       TInputImage::ImageDimension);
00080   itkStaticConstMacro(ImageDimension, unsigned int,
00081                       TInputImage::ImageDimension);
00083 
00084   typedef StatisticsLabelObject<InputImagePixelType, itkGetStaticConstMacro(ImageDimension)>                                                                       LabelObjectType;
00085   typedef LabelMap< LabelObjectType >                                               LabelMapType;
00086   typedef LabelImageToLabelMapFilter< InputImageType, LabelMapType >                LabelizerType;
00087   typedef StatisticsLabelMapFilter< LabelMapType, TFeatureImage >                   LabelObjectValuatorType;
00088   typedef typename LabelObjectType::AttributeType                                   AttributeType;
00089   typedef StatisticsOpeningLabelMapFilter< LabelMapType >                           OpeningType;
00090   typedef LabelMapToLabelImageFilter< LabelMapType, OutputImageType >               BinarizerType;
00091 
00093   itkNewMacro(Self);
00094 
00096   itkTypeMacro(LabelStatisticsOpeningImageFilter, 
00097                ImageToImageFilter);
00098 
00099 #ifdef ITK_USE_CONCEPT_CHECKING
00100 
00101   itkConceptMacro(InputEqualityComparableCheck,
00102     (Concept::EqualityComparable<InputImagePixelType>));
00103   itkConceptMacro(IntConvertibleToInputCheck,
00104     (Concept::Convertible<int, InputImagePixelType>));
00105   itkConceptMacro(InputOStreamWritableCheck,
00106     (Concept::OStreamWritable<InputImagePixelType>));
00107 
00109 #endif
00110 
00115   itkSetMacro(BackgroundValue, OutputImagePixelType);
00116   itkGetConstMacro(BackgroundValue, OutputImagePixelType);
00118 
00122   itkGetConstMacro(Lambda, double);
00123   itkSetMacro(Lambda, double);
00125 
00132   itkGetConstMacro( ReverseOrdering, bool );
00133   itkSetMacro( ReverseOrdering, bool );
00134   itkBooleanMacro( ReverseOrdering );
00136 
00141   itkGetConstMacro( Attribute, AttributeType );
00142   itkSetMacro( Attribute, AttributeType );
00143   void SetAttribute( const std::string & s )
00144     {
00145     this->SetAttribute( LabelObjectType::GetAttributeFromName( s ) );
00146     }
00148 
00150   void SetFeatureImage(const TFeatureImage *input)
00151     {
00152     // Process object is not const-correct so the const casting is required.
00153     this->SetNthInput( 1, const_cast<TFeatureImage *>(input) );
00154     }
00155 
00157   const FeatureImageType * GetFeatureImage()
00158     {
00159     return static_cast<const FeatureImageType*>(this->ProcessObject::GetInput(1));
00160     }
00161 
00163   void SetInput1(const InputImageType *input)
00164     {
00165     this->SetInput( input );
00166     }
00167 
00169   void SetInput2(const FeatureImageType *input)
00170     {
00171     this->SetFeatureImage( input );
00172     }
00173 
00174 protected:
00175   LabelStatisticsOpeningImageFilter();
00176   ~LabelStatisticsOpeningImageFilter() {};
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   LabelStatisticsOpeningImageFilter(const Self&); //purposely not implemented
00194   void operator=(const Self&); //purposely not implemented
00195 
00196   OutputImagePixelType m_BackgroundValue;
00197   double               m_Lambda;
00198   bool                 m_ReverseOrdering;
00199   AttributeType        m_Attribute;
00200 }; // end of class
00201 
00202 } // end namespace itk
00203   
00204 #ifndef ITK_MANUAL_INSTANTIATION
00205 #include "itkLabelStatisticsOpeningImageFilter.txx"
00206 #endif
00207 
00208 #endif
00209 

Generated at Tue Sep 15 03:49:18 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000