00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkWatershedRelabeler_h
00018 #define __itkWatershedRelabeler_h
00019
00020 #include "itkWatershedEquivalencyTable.h"
00021 #include "itkWatershedSegmentTree.h"
00022 #include "itkWatershedSegmenter.h"
00023 #include "itkImage.h"
00024
00025 namespace itk
00026 {
00027 namespace watershed
00028 {
00029
00063 template <class TScalarType, unsigned int TImageDimension>
00064 class Relabeler
00065 : public ProcessObject
00066 {
00067 public:
00069 typedef Relabeler Self;
00070 typedef ProcessObject Superclass;
00071 typedef SmartPointer<Self> Pointer;
00072 typedef SmartPointer<const Self> ConstPointer;
00073 itkNewMacro(Self);
00074 itkTypeMacro(Relabeler, ProcessObject);
00075
00077 itkStaticConstMacro(ImageDimension, unsigned int,TImageDimension);
00078
00080 typedef TScalarType ScalarType;
00081 typedef Image<unsigned long, TImageDimension> ImageType;
00082 typedef SegmentTree<ScalarType> SegmentTreeType;
00083 typedef Segmenter<Image<ScalarType, TImageDimension> > SegmenterType;
00084 typedef DataObject::Pointer DataObjectPointer;
00085
00087 virtual DataObjectPointer MakeOutput(unsigned int idx);
00088
00090 void SetInputImage(ImageType *img)
00091 {
00092 this->ProcessObject::SetNthInput(0, img);
00093 }
00094 ImageType * GetInputImage(void)
00095 {
00096 return static_cast<ImageType *>
00097 (this->ProcessObject::GetInput(0) );
00098 }
00099
00101 void SetOutputImage(ImageType * img)
00102 {
00103 this->ProcessObject::SetNthOutput(0,img);
00104 }
00105 ImageType * GetOutputImage(void)
00106 { return static_cast<ImageType *>
00107 (this->ProcessObject::GetOutput(0) ); }
00108
00110 void SetInputSegmentTree(SegmentTreeType *et)
00111 {
00112 this->ProcessObject::SetNthInput(1, et);
00113 }
00114 SegmentTreeType * GetInputSegmentTree(void)
00115 {
00116 return static_cast<SegmentTreeType *>
00117 (this->ProcessObject::GetInput(1));
00118 }
00119
00121 void GenerateData();
00122
00125 itkSetClampMacro(FloodLevel, double, 0.0, 1.0);
00126 itkGetMacro(FloodLevel, double);
00127
00129 void GraftOutput(ImageType *graft);
00130 void GraftNthOutput(unsigned int idx, ImageType *graft);
00131
00132 protected:
00133 Relabeler();
00134 virtual ~Relabeler() {}
00135 Relabeler(const Self&) {}
00136 void operator=(const Self&) {}
00137 void PrintSelf(std::ostream& os, Indent indent) const;
00138
00139 double m_FloodLevel;
00140 void GenerateOutputRequestedRegion(DataObject *output);
00141 void GenerateInputRequestedRegion();
00142 };
00143
00144 }
00145 }
00146
00147 #ifndef ITK_MANUAL_INSTANTIATION
00148 #include "itkWatershedRelabeler.txx"
00149 #endif
00150
00151 #endif
00152