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

itkStatisticsRelabelImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkStatisticsRelabelImageFilter.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 __itkStatisticsRelabelImageFilter_h
00018 #define __itkStatisticsRelabelImageFilter_h
00019 
00020 #include "itkImageToImageFilter.h"
00021 #include "itkStatisticsLabelObject.h"
00022 #include "itkLabelMap.h"
00023 #include "itkLabelImageToLabelMapFilter.h"
00024 #include "itkStatisticsLabelMapFilter.h"
00025 #include "itkStatisticsRelabelLabelMapFilter.h"
00026 #include "itkLabelMapToLabelImageFilter.h"
00027 
00028 
00029 namespace itk {
00030 
00046 template<class TInputImage, class TFeatureImage>
00047 class ITK_EXPORT StatisticsRelabelImageFilter : 
00048     public ImageToImageFilter<TInputImage, TInputImage>
00049 {
00050 public:
00052   typedef StatisticsRelabelImageFilter                 Self;
00053   typedef ImageToImageFilter<TInputImage, TInputImage> Superclass;
00054   typedef SmartPointer<Self>                           Pointer;
00055   typedef SmartPointer<const Self>                     ConstPointer;
00056 
00058   typedef TInputImage                              InputImageType;
00059   typedef TInputImage                              OutputImageType;
00060   typedef typename InputImageType::Pointer         InputImagePointer;
00061   typedef typename InputImageType::ConstPointer    InputImageConstPointer;
00062   typedef typename InputImageType::RegionType      InputImageRegionType;
00063   typedef typename InputImageType::PixelType       InputImagePixelType;
00064   typedef typename OutputImageType::Pointer        OutputImagePointer;
00065   typedef typename OutputImageType::ConstPointer   OutputImageConstPointer;
00066   typedef typename OutputImageType::RegionType     OutputImageRegionType;
00067   typedef typename OutputImageType::PixelType      OutputImagePixelType;
00068 
00069   typedef TFeatureImage                              FeatureImageType;
00070   typedef typename FeatureImageType::Pointer         FeatureImagePointer;
00071   typedef typename FeatureImageType::ConstPointer    FeatureImageConstPointer;
00072   typedef typename FeatureImageType::PixelType       FeatureImagePixelType;
00073 
00075   itkStaticConstMacro(InputImageDimension, unsigned int,
00076                       TInputImage::ImageDimension);
00077   itkStaticConstMacro(OutputImageDimension, unsigned int,
00078                       TInputImage::ImageDimension);
00079   itkStaticConstMacro(ImageDimension, unsigned int,
00080                       TInputImage::ImageDimension);
00082 
00083   typedef StatisticsLabelObject<InputImagePixelType, itkGetStaticConstMacro(ImageDimension)>                LabelObjectType;
00084   typedef LabelMap< LabelObjectType >                                               LabelMapType;
00085   typedef LabelImageToLabelMapFilter< InputImageType, LabelMapType >                LabelizerType;
00086   typedef StatisticsLabelMapFilter< LabelMapType, TFeatureImage >                   LabelObjectValuatorType;
00087   typedef typename LabelObjectType::AttributeType                                   AttributeType;
00088   typedef StatisticsRelabelLabelMapFilter< LabelMapType >                           RelabelType;
00089   typedef LabelMapToLabelImageFilter< LabelMapType, OutputImageType >               BinarizerType;
00090 
00092   itkNewMacro(Self);  
00093 
00095   itkTypeMacro(StatisticsRelabelImageFilter, 
00096                ImageToImageFilter);
00097 
00098 #ifdef ITK_USE_CONCEPT_CHECKING
00099 
00100   itkConceptMacro(InputEqualityComparableCheck,
00101     (Concept::EqualityComparable<InputImagePixelType>));
00102   itkConceptMacro(IntConvertibleToInputCheck,
00103     (Concept::Convertible<int, InputImagePixelType>));
00104   itkConceptMacro(InputOStreamWritableCheck,
00105     (Concept::OStreamWritable<InputImagePixelType>));
00106 
00108 #endif
00109 
00114   itkSetMacro(BackgroundValue, OutputImagePixelType);
00115   itkGetConstMacro(BackgroundValue, OutputImagePixelType);
00117 
00123   itkGetConstMacro( ReverseOrdering, bool );
00124   itkSetMacro( ReverseOrdering, bool );
00125   itkBooleanMacro( ReverseOrdering );
00127 
00131   itkGetConstMacro( Attribute, AttributeType );
00132   itkSetMacro( Attribute, AttributeType );
00133   void SetAttribute( const std::string & s )
00134     {
00135     this->SetAttribute( LabelObjectType::GetAttributeFromName( s ) );
00136     }
00138 
00139 
00141   void SetFeatureImage(TFeatureImage *input)
00142     {
00143     // Process object is not const-correct so the const casting is required.
00144     this->SetNthInput( 1, const_cast<TFeatureImage *>(input) );
00145     }
00146 
00148   FeatureImageType * GetFeatureImage()
00149     {
00150     return static_cast<FeatureImageType*>(const_cast<DataObject *>(this->ProcessObject::GetInput(1)));
00151     }
00152 
00154   void SetInput1(InputImageType *input)
00155     {
00156     this->SetInput( input );
00157     }
00158 
00160   void SetInput2(FeatureImageType *input)
00161     {
00162     this->SetFeatureImage( input );
00163     }
00164 
00165 protected:
00166   StatisticsRelabelImageFilter();
00167   ~StatisticsRelabelImageFilter() {};
00168   void PrintSelf(std::ostream& os, Indent indent) const;
00169 
00173   void GenerateInputRequestedRegion();
00174 
00176   void EnlargeOutputRequestedRegion(DataObject *itkNotUsed(output));
00177 
00180   void GenerateData();
00181 
00182 private:
00183   StatisticsRelabelImageFilter(const Self&); //purposely not implemented
00184   void operator=(const Self&); //purposely not implemented
00185 
00186   OutputImagePixelType m_BackgroundValue;
00187   bool                 m_ReverseOrdering;
00188   AttributeType        m_Attribute;
00189 }; // end of class
00190 
00191 } // end namespace itk
00192   
00193 #ifndef ITK_MANUAL_INSTANTIATION
00194 #include "itkStatisticsRelabelImageFilter.txx"
00195 #endif
00196 
00197 #endif
00198 

Generated at Fri Apr 16 19:46:25 2010 for ITK by doxygen 1.6.1 written by Dimitri van Heesch, © 1997-2000