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);
00077
00079 itkStaticConstMacro(ImageDimension, unsigned int, TDimension);
00080
00082 typedef TPixelType PixelType;
00083 typedef Boundary<PixelType, TDimension> BoundaryType;
00084 typedef EquivalencyTable EquivalencyTableType;
00085 typedef Segmenter<Image<TPixelType, TDimension> > SegmenterType;
00086 typedef DataObject::Pointer DataObjectPointer;
00087
00089 void SetBoundaryA(BoundaryType *bd)
00090 { this->ProcessObject::SetNthInput(0, bd); }
00091 typename BoundaryType::Pointer GetBoundaryA()
00092 { return static_cast<BoundaryType *>(this->GetInput(0)); }
00094
00096 void SetBoundaryB(BoundaryType *bd)
00097 { this->ProcessObject::SetNthInput(1, bd); }
00098 typename BoundaryType::Pointer GetBoundaryB()
00099 { return static_cast<BoundaryType *>(this->GetInput(1)); }
00101
00104 itkSetMacro(Face, unsigned short);
00105 itkGetMacro(Face, unsigned short);
00107
00111 void SetEquivalencyTable(EquivalencyTableType::Pointer a)
00112 { this->ProcessObject::SetNthOutput(0, a.GetPointer()); }
00113 EquivalencyTableType::Pointer GetEquivalencyTable()
00114 { return static_cast<EquivalencyTableType *>
00115 (this->ProcessObject::GetOutput(0)); }
00117
00119 void GenerateData();
00120
00122 virtual DataObjectPointer MakeOutput(unsigned int idx);
00123 protected:
00124 BoundaryResolver() : m_Face(0)
00125 {
00126 EquivalencyTable::Pointer eq
00127 = static_cast<EquivalencyTable*>(this->MakeOutput(0).GetPointer());
00128 this->SetNumberOfRequiredOutputs(1);
00129 this->ProcessObject::SetNthOutput(0, eq.GetPointer());
00130 }
00131 virtual ~BoundaryResolver() {}
00132 BoundaryResolver(const Self&) {}
00133 void operator=(const Self&) {}
00134 void PrintSelf(std::ostream& os, Indent indent) const;
00136
00137 unsigned short m_Face;
00138 void GenerateOutputRequestedRegion(DataObject *output);
00139 };
00140
00141 }
00142 }
00143
00144 #ifndef ITK_MANUAL_INSTANTIATION
00145 #include "itkWatershedBoundaryResolver.txx"
00146 #endif
00147
00148 #endif
00149