00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkWatershedEquivalenceRelabeler_h
00018 #define __itkWatershedEquivalenceRelabeler_h
00019
00020 #include "itkEquivalencyTable.h"
00021 #include "itkWatershedSegmenter.h"
00022 #include "itkImage.h"
00023
00024 namespace itk
00025 {
00026 namespace watershed
00027 {
00051 template <class TScalarType, unsigned int TImageDimension>
00052 class ITK_EXPORT EquivalenceRelabeler
00053 : public ProcessObject
00054 {
00055 public:
00057 itkStaticConstMacro(ImageDimension, unsigned int,TImageDimension);
00058
00060 typedef Image<unsigned long, TImageDimension> ImageType;
00061 typedef EquivalenceRelabeler Self;
00062 typedef ProcessObject Superclass;
00063 typedef TScalarType ScalarType;
00064 typedef EquivalencyTable EquivalencyTableType;
00065 typedef Segmenter<Image<ScalarType, TImageDimension> > SegmenterType;
00066 typedef DataObject::Pointer DataObjectPointer;
00067
00069 typedef SmartPointer<Self> Pointer;
00070 typedef SmartPointer<const Self> ConstPointer;
00071 itkNewMacro(Self);
00072 itkTypeMacro(EquivalenceRelabeler, ProcessObject);
00074
00076 void SetInputImage(ImageType *img)
00077 { this->ProcessObject::SetNthInput(0, img); }
00078 const ImageType * GetInputImage(void)
00079 {
00080 return static_cast<ImageType *>
00081 (this->ProcessObject::GetInput(0));
00082 }
00084
00086 void SetOutputImage(ImageType * img)
00087 {
00088 this->ProcessObject::SetNthOutput(0,img);
00089 }
00090 typename ImageType::Pointer GetOutputImage()
00091 { return static_cast<ImageType *>
00092 (this->ProcessObject::GetOutput(0)); }
00094
00096 void SetEquivalencyTable(EquivalencyTableType *et)
00097 {
00098 this->ProcessObject::SetNthInput(1, et);
00099 }
00100 EquivalencyTableType::Pointer GetEquivalencyTable()
00101 {
00102 return static_cast<EquivalencyTableType *>
00103 (this->ProcessObject::GetInput(1));
00104 }
00106
00108 void GenerateData();
00109
00111 virtual DataObjectPointer MakeOutput(unsigned int idx);
00112
00113 protected:
00114 EquivalenceRelabeler()
00115 {
00116 typename ImageType::Pointer img
00117 = static_cast<ImageType*>(this->MakeOutput(0).GetPointer());
00118 this->SetNumberOfRequiredOutputs(1);
00119 this->ProcessObject::SetNthOutput(0, img.GetPointer());
00120 }
00121 virtual ~EquivalenceRelabeler() {}
00122 EquivalenceRelabeler(const Self&) {}
00123 void operator=(const Self&) {}
00124 void PrintSelf(std::ostream& os, Indent indent) const;
00125
00126 void GenerateOutputRequestedRegion(DataObject *output);
00127 void GenerateInputRequestedRegion();
00128 };
00129
00130 }
00131 }
00132
00133 #ifndef ITK_MANUAL_INSTANTIATION
00134 #include "itkWatershedEquivalenceRelabeler.txx"
00135 #endif
00136
00137 #endif
00138