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

itkBinaryStatisticsOpeningImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkBinaryStatisticsOpeningImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-08-15 17:10:50 $
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 __itkBinaryStatisticsOpeningImageFilter_h
00018 #define __itkBinaryStatisticsOpeningImageFilter_h
00019 
00020 #include "itkImageToImageFilter.h"
00021 #include "itkStatisticsLabelObject.h"
00022 #include "itkLabelMap.h"
00023 #include "itkBinaryImageToLabelMapFilter.h"
00024 #include "itkStatisticsLabelMapFilter.h"
00025 #include "itkStatisticsOpeningLabelMapFilter.h"
00026 #include "itkLabelMapToBinaryImageFilter.h"
00027 
00028 
00029 namespace itk {
00030 
00047 template<class TInputImage, class TFeatureImage>
00048 class ITK_EXPORT BinaryStatisticsOpeningImageFilter : 
00049     public ImageToImageFilter<TInputImage, TInputImage>
00050 {
00051 public:
00053   typedef BinaryStatisticsOpeningImageFilter           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, TInputImage::ImageDimension);
00077   itkStaticConstMacro(OutputImageDimension, unsigned int, TInputImage::ImageDimension);
00078   itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension);
00080 
00081   typedef StatisticsLabelObject<unsigned long, itkGetStaticConstMacro(ImageDimension)>    LabelObjectType;
00082   typedef LabelMap< LabelObjectType >                                                LabelMapType;
00083   typedef BinaryImageToLabelMapFilter< InputImageType, LabelMapType >                LabelizerType;
00084   typedef StatisticsLabelMapFilter< LabelMapType, FeatureImageType >                 LabelObjectValuatorType;
00085   typedef typename LabelObjectType::AttributeType                                    AttributeType;
00086   typedef StatisticsOpeningLabelMapFilter< LabelMapType >                            OpeningType;
00087   typedef LabelMapToBinaryImageFilter< LabelMapType, OutputImageType >               BinarizerType;
00088 
00090   itkNewMacro(Self);  
00091 
00093   itkTypeMacro(BinaryStatisticsOpeningImageFilter, ImageToImageFilter );
00094 
00101   itkSetMacro( FullyConnected, bool );
00102   itkGetConstReferenceMacro( FullyConnected, bool );
00103   itkBooleanMacro( FullyConnected );
00105 
00106 #ifdef ITK_USE_CONCEPT_CHECKING
00107 
00108   itkConceptMacro(InputEqualityComparableCheck,
00109     (Concept::EqualityComparable<InputImagePixelType>));
00110   itkConceptMacro(IntConvertibleToInputCheck,
00111     (Concept::Convertible<int, InputImagePixelType>));
00112   itkConceptMacro(InputOStreamWritableCheck,
00113     (Concept::OStreamWritable<InputImagePixelType>));
00114 
00116 #endif
00117 
00122   itkSetMacro( BackgroundValue, OutputImagePixelType );
00123   itkGetConstMacro( BackgroundValue, OutputImagePixelType );
00125 
00130   itkSetMacro( ForegroundValue, OutputImagePixelType );
00131   itkGetConstMacro( ForegroundValue, OutputImagePixelType);
00133 
00137   itkGetConstMacro( Lambda, double );
00138   itkSetMacro( Lambda, double );
00140 
00147   itkGetConstMacro( ReverseOrdering, bool );
00148   itkSetMacro( ReverseOrdering, bool );
00149   itkBooleanMacro( ReverseOrdering );
00151 
00156   itkGetConstMacro( Attribute, AttributeType );
00157   itkSetMacro( Attribute, AttributeType );
00158   void SetAttribute( const std::string & s )
00159     {
00160     this->SetAttribute( LabelObjectType::GetAttributeFromName( s ) );
00161     }
00163 
00165   void SetFeatureImage(const TFeatureImage *input)
00166     {
00167     // Process object is not const-correct so the const casting is required.
00168     this->SetNthInput( 1, const_cast<TFeatureImage *>(input) );
00169     }
00170 
00172   const FeatureImageType * GetFeatureImage()
00173     {
00174     return static_cast<const FeatureImageType*>(this->ProcessObject::GetInput(1));
00175     }
00176 
00178   void SetInput1(const InputImageType *input)
00179     {
00180     this->SetInput( input );
00181     }
00182 
00184   void SetInput2(const FeatureImageType *input)
00185     {
00186     this->SetFeatureImage( input );
00187     }
00188 
00189 
00190 protected:
00191   BinaryStatisticsOpeningImageFilter();
00192   ~BinaryStatisticsOpeningImageFilter() {}
00193   void PrintSelf( std::ostream& os, Indent indent ) const;
00194 
00197   void GenerateInputRequestedRegion();
00198 
00200   void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) );
00201 
00204   void GenerateData();
00205 
00206 
00207 private:
00208   BinaryStatisticsOpeningImageFilter( const Self& ); //purposely not implemented
00209   void operator=( const Self& ); //purposely not implemented
00210 
00211   bool                 m_FullyConnected;
00212   OutputImagePixelType m_BackgroundValue;
00213   OutputImagePixelType m_ForegroundValue;
00214   double               m_Lambda;
00215   bool                 m_ReverseOrdering;
00216   AttributeType        m_Attribute;
00217 }; // end of class
00218 
00219 } // end namespace itk
00220   
00221 #ifndef ITK_MANUAL_INSTANTIATION
00222 #include "itkBinaryStatisticsOpeningImageFilter.txx"
00223 #endif
00224 
00225 #endif
00226 

Generated at Fri Apr 16 17:55:36 2010 for ITK by doxygen 1.6.1 written by Dimitri van Heesch, © 1997-2000