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 "itkEquivalencyTable.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 ITK_EXPORT 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);
00076
00078 itkStaticConstMacro(ImageDimension, unsigned int,TImageDimension);
00079
00081 typedef TScalarType ScalarType;
00082 typedef Image<unsigned long, TImageDimension> ImageType;
00083 typedef SegmentTree<ScalarType> SegmentTreeType;
00084 typedef Segmenter<Image<ScalarType, TImageDimension> > SegmenterType;
00085 typedef DataObject::Pointer DataObjectPointer;
00086
00088 virtual DataObjectPointer MakeOutput(unsigned int idx);
00089
00091 void SetInputImage(ImageType *img)
00092 {
00093 this->ProcessObject::SetNthInput(0, img);
00094 }
00095 ImageType * GetInputImage(void)
00096 {
00097 return static_cast<ImageType *>
00098 (this->ProcessObject::GetInput(0) );
00099 }
00101
00103 void SetOutputImage(ImageType * img)
00104 {
00105 this->ProcessObject::SetNthOutput(0,img);
00106 }
00107 ImageType * GetOutputImage(void)
00108 { return static_cast<ImageType *>
00109 (this->ProcessObject::GetOutput(0) ); }
00111
00113 void SetInputSegmentTree(SegmentTreeType *et)
00114 {
00115 this->ProcessObject::SetNthInput(1, et);
00116 }
00117 SegmentTreeType * GetInputSegmentTree(void)
00118 {
00119 return static_cast<SegmentTreeType *>
00120 (this->ProcessObject::GetInput(1));
00121 }
00123
00125 void GenerateData();
00126
00129 itkSetClampMacro(FloodLevel, double, 0.0, 1.0);
00130 itkGetMacro(FloodLevel, double);
00132
00134 void GraftOutput(ImageType *graft);
00135 void GraftNthOutput(unsigned int idx, ImageType *graft);
00137
00138 protected:
00139 Relabeler();
00140 virtual ~Relabeler() {}
00141 Relabeler(const Self&) {}
00142 void operator=(const Self&) {}
00143 void PrintSelf(std::ostream& os, Indent indent) const;
00144
00145 double m_FloodLevel;
00146 void GenerateOutputRequestedRegion(DataObject *output);
00147 void GenerateInputRequestedRegion();
00148 };
00149
00150 }
00151 }
00152
00153 #ifndef ITK_MANUAL_INSTANTIATION
00154 #include "itkWatershedRelabeler.txx"
00155 #endif
00156
00157 #endif
00158
00159