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

itkLabelMapToBinaryImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkLabelMapToBinaryImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-08-07 11:28:02 $
00007   Version:   $Revision: 1.2 $
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 __itkLabelMapToBinaryImageFilter_h
00018 #define __itkLabelMapToBinaryImageFilter_h
00019 
00020 #include "itkLabelMapFilter.h"
00021 #include "itkBarrier.h"
00022 
00023 namespace itk {
00024 
00043 template<class TInputImage, class TOutputImage>
00044 class ITK_EXPORT LabelMapToBinaryImageFilter : 
00045     public LabelMapFilter<TInputImage, TOutputImage>
00046 {
00047 public:
00049   typedef LabelMapToBinaryImageFilter               Self;
00050   typedef LabelMapFilter<TInputImage, TOutputImage> Superclass;
00051   typedef SmartPointer<Self>                        Pointer;
00052   typedef SmartPointer<const Self>                  ConstPointer;
00053 
00055   typedef TInputImage                              InputImageType;
00056   typedef TOutputImage                             OutputImageType;
00057   typedef typename InputImageType::Pointer         InputImagePointer;
00058   typedef typename InputImageType::ConstPointer    InputImageConstPointer;
00059   typedef typename InputImageType::RegionType      InputImageRegionType;
00060   typedef typename InputImageType::PixelType       InputImagePixelType;
00061   typedef typename InputImageType::LabelObjectType LabelObjectType;
00062 
00063   typedef typename OutputImageType::Pointer        OutputImagePointer;
00064   typedef typename OutputImageType::ConstPointer   OutputImageConstPointer;
00065   typedef typename OutputImageType::RegionType     OutputImageRegionType;
00066   typedef typename OutputImageType::PixelType      OutputImagePixelType;
00067   typedef typename OutputImageType::IndexType      IndexType;
00068   
00070   itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
00071   itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
00073 
00075   itkNewMacro(Self);  
00076 
00078   itkTypeMacro(LabelMapToBinaryImageFilter, ImageToImageFilter);
00079 
00084   itkSetMacro(BackgroundValue, OutputImagePixelType);
00085   itkGetConstMacro(BackgroundValue, OutputImagePixelType);
00087 
00092   itkSetMacro(ForegroundValue, OutputImagePixelType);
00093   itkGetConstMacro(ForegroundValue, OutputImagePixelType);
00095 
00097   void SetBackgroundImage( const OutputImageType *input)
00098     {
00099     // Process object is not const-correct so the const casting is required.
00100     this->SetNthInput( 1, const_cast<OutputImageType *>(input) );
00101     }
00102 
00103   OutputImageType * GetBackgroundImage()
00104     {
00105     return static_cast<OutputImageType*>(const_cast<DataObject *>(this->ProcessObject::GetInput(1)));
00106     }
00107 
00109   void SetInput1( const InputImageType * input )
00110     {
00111     this->SetInput( input );
00112     }
00113 
00115   void SetInput2( const OutputImageType * input )
00116     {
00117     this->SetBackgroundImage( input );
00118     }
00119 
00120 protected:
00121   LabelMapToBinaryImageFilter();
00122   ~LabelMapToBinaryImageFilter() {};
00123 
00127   void GenerateInputRequestedRegion();
00128 
00130   void EnlargeOutputRequestedRegion(DataObject *itkNotUsed(output));
00131 
00132   virtual void BeforeThreadedGenerateData();
00133 
00134   virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, int threadId );
00135 
00136   virtual void ThreadedProcessLabelObject( LabelObjectType * labelObject );
00137   
00138   void PrintSelf(std::ostream& os, Indent indent) const;
00139 
00140 private:
00141   LabelMapToBinaryImageFilter(const Self&); //purposely not implemented
00142   void operator=(const Self&); //purposely not implemented
00143   
00144   OutputImagePixelType          m_BackgroundValue;
00145   OutputImagePixelType          m_ForegroundValue;
00146 
00147   typename Barrier::Pointer     m_Barrier;
00148 
00149 }; // end of class
00150 
00151 } // end namespace itk
00152   
00153 #ifndef ITK_MANUAL_INSTANTIATION
00154 #include "itkLabelMapToBinaryImageFilter.txx"
00155 #endif
00156 
00157 #endif
00158 

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