00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkWatershedBoundaryResolver_h
00018 #define __itkWatershedBoundaryResolver_h
00019
00020 #if defined(_MSC_VER)
00021 #pragma warning ( disable : 4786 )
00022 #endif
00023 #include "itkWatershedBoundary.h"
00024 #include "itkEquivalencyTable.h"
00025 #include "itkWatershedSegmenter.h"
00026
00027 namespace itk
00028 {
00029 namespace watershed
00030 {
00065 template <class TPixelType, unsigned int TDimension>
00066 class ITK_EXPORT BoundaryResolver : public ProcessObject
00067 {
00068 public:
00070 typedef BoundaryResolver Self;
00071 typedef ProcessObject Superclass;
00072 typedef SmartPointer<Self> Pointer;
00073 typedef SmartPointer<const Self> ConstPointer;
00074 itkNewMacro(Self);
00075 itkTypeMacro(BoundaryResolver, ProcessObject);
00076
00078 itkStaticConstMacro(ImageDimension, unsigned int, TDimension);
00079
00081 typedef TPixelType PixelType;
00082 typedef Boundary<PixelType, TDimension> BoundaryType;
00083 typedef EquivalencyTable EquivalencyTableType;
00084 typedef Segmenter<Image<TPixelType, TDimension> > SegmenterType;
00085 typedef DataObject::Pointer DataObjectPointer;
00086
00088 void SetBoundaryA(BoundaryType *bd)
00089 { this->ProcessObject::SetNthInput(0, bd); }
00090 typename BoundaryType::Pointer GetBoundaryA()
00091 { return static_cast<BoundaryType *>(this->GetInput(0)); }
00092
00094 void SetBoundaryB(BoundaryType *bd)
00095 { this->ProcessObject::SetNthInput(1, bd); }
00096 typename BoundaryType::Pointer GetBoundaryB()
00097 { return static_cast<BoundaryType *>(this->GetInput(1)); }
00098
00101 itkSetMacro(Face, unsigned short);
00102 itkGetMacro(Face, unsigned short);
00103
00107 void SetEquivalencyTable(EquivalencyTableType::Pointer a)
00108 { this->ProcessObject::SetNthOutput(0, a.GetPointer()); }
00109 EquivalencyTableType::Pointer GetEquivalencyTable()
00110 { return static_cast<EquivalencyTableType *>
00111 (this->ProcessObject::GetOutput(0)); }
00112
00114 void GenerateData();
00115
00117 virtual DataObjectPointer MakeOutput(unsigned int idx);
00118 protected:
00119 BoundaryResolver() : m_Face(0)
00120 {
00121 EquivalencyTable::Pointer eq
00122 = static_cast<EquivalencyTable*>(this->MakeOutput(0).GetPointer());
00123 this->SetNumberOfRequiredOutputs(1);
00124 this->ProcessObject::SetNthOutput(0, eq.GetPointer());
00125 }
00126 virtual ~BoundaryResolver() {}
00127 BoundaryResolver(const Self&) {}
00128 void operator=(const Self&) {}
00129 void PrintSelf(std::ostream& os, Indent indent) const;
00130
00131 unsigned short m_Face;
00132 void GenerateOutputRequestedRegion(DataObject *output);
00133 };
00134
00135 }
00136 }
00137
00138 #ifndef ITK_MANUAL_INSTANTIATION
00139 #include "itkWatershedBoundaryResolver.txx"
00140 #endif
00141
00142 #endif