Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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
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&);
00142 void operator=(const Self&);
00143
00144 OutputImagePixelType m_BackgroundValue;
00145 OutputImagePixelType m_ForegroundValue;
00146
00147 typename Barrier::Pointer m_Barrier;
00148
00149 };
00150
00151 }
00152
00153 #ifndef ITK_MANUAL_INSTANTIATION
00154 #include "itkLabelMapToBinaryImageFilter.txx"
00155 #endif
00156
00157 #endif
00158