ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkWatershedBoundaryResolver.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkWatershedBoundaryResolver_h
00019 #define __itkWatershedBoundaryResolver_h
00020 
00021 
00022 #include "itkWatershedSegmenter.h"
00023 
00024 namespace itk
00025 {
00026 namespace watershed
00027 {
00063 template< class TPixelType, unsigned int TDimension >
00064 class ITK_EXPORT BoundaryResolver:public ProcessObject
00065 {
00066 public:
00068   typedef BoundaryResolver           Self;
00069   typedef ProcessObject              Superclass;
00070   typedef SmartPointer< Self >       Pointer;
00071   typedef SmartPointer< const Self > ConstPointer;
00072   itkNewMacro(Self);
00073   itkTypeMacro(WatershedBoundaryResolver, ProcessObject);
00075 
00077   itkStaticConstMacro(ImageDimension, unsigned int, TDimension);
00078 
00080   typedef TPixelType                                   PixelType;
00081   typedef Boundary< PixelType, TDimension >            BoundaryType;
00082   typedef EquivalencyTable                             EquivalencyTableType;
00083   typedef Segmenter< Image< TPixelType, TDimension > > SegmenterType;
00084   typedef DataObject::Pointer                          DataObjectPointer;
00085 
00087   void SetBoundaryA(BoundaryType *bd)
00088   { this->ProcessObject::SetNthInput(0, bd); }
00089   typename BoundaryType::Pointer GetBoundaryA()
00090   { 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) );  }
00099 
00102   itkSetMacro(Face, unsigned short);
00103   itkGetConstMacro(Face, unsigned short);
00105 
00109   void SetEquivalencyTable(EquivalencyTableType::Pointer a)
00110   { this->ProcessObject::SetNthOutput( 0, a.GetPointer() ); }
00111   EquivalencyTableType::Pointer GetEquivalencyTable()
00112   {
00113     return static_cast< EquivalencyTableType * >
00114            ( this->ProcessObject::GetOutput(0) );
00115   }
00117 
00119   void GenerateData();
00120 
00122   typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType;
00123   using Superclass::MakeOutput;
00124   virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx);
00125 
00126 protected:
00127   BoundaryResolver():m_Face(0)
00128   {
00129     EquivalencyTable::Pointer eq =
00130       static_cast< EquivalencyTable * >( this->MakeOutput(0).GetPointer() );
00131 
00132     this->SetNumberOfRequiredOutputs(1);
00133     this->ProcessObject::SetNthOutput( 0, eq.GetPointer() );
00134   }
00135 
00136   virtual ~BoundaryResolver() {}
00137   BoundaryResolver(const Self &) {}
00138   void operator=(const Self &) {}
00139   void PrintSelf(std::ostream & os, Indent indent) const;
00140 
00141   unsigned short m_Face;
00142   void GenerateOutputRequestedRegion(DataObject *output);
00143 };
00144 } // end namespace watershed
00145 } // end namespace itk
00146 
00147 #ifndef ITK_MANUAL_INSTANTIATION
00148 #include "itkWatershedBoundaryResolver.hxx"
00149 #endif
00150 
00151 #endif
00152