ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
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 __itkWatershedEquivalenceRelabeler_h 00019 #define __itkWatershedEquivalenceRelabeler_h 00020 00021 #include "itkWatershedSegmenter.h" 00022 00023 namespace itk 00024 { 00025 namespace watershed 00026 { 00052 template< class TScalarType, unsigned int TImageDimension > 00053 class ITK_EXPORT EquivalenceRelabeler: 00054 public ProcessObject 00055 { 00056 public: 00058 itkStaticConstMacro(ImageDimension, unsigned int, TImageDimension); 00059 00061 typedef Image< IdentifierType, TImageDimension > ImageType; 00062 typedef EquivalenceRelabeler Self; 00063 typedef ProcessObject Superclass; 00064 typedef TScalarType ScalarType; 00065 typedef EquivalencyTable EquivalencyTableType; 00066 typedef Segmenter< Image< ScalarType, TImageDimension > > SegmenterType; 00067 typedef DataObject::Pointer DataObjectPointer; 00068 00070 typedef SmartPointer< Self > Pointer; 00071 typedef SmartPointer< const Self > ConstPointer; 00072 itkNewMacro(Self); 00073 itkTypeMacro(WatershedEquivalenceRelabeler, ProcessObject); 00075 00077 void SetInputImage(ImageType *img) 00078 { this->ProcessObject::SetNthInput(0, img); } 00079 const ImageType * GetInputImage(void) 00080 { 00081 return static_cast< ImageType * > 00082 ( this->ProcessObject::GetInput(0) ); 00083 } 00085 00087 void SetOutputImage(ImageType *img) 00088 { 00089 this->ProcessObject::SetNthOutput(0, img); 00090 } 00091 00092 typename ImageType::Pointer GetOutputImage() 00093 { 00094 return static_cast< ImageType * > 00095 ( this->ProcessObject::GetOutput(0) ); 00096 } 00097 00099 void SetEquivalencyTable(EquivalencyTableType *et) 00100 { 00101 this->ProcessObject::SetNthInput(1, et); 00102 } 00103 00104 EquivalencyTableType::Pointer GetEquivalencyTable() 00105 { 00106 return static_cast< EquivalencyTableType * > 00107 ( this->ProcessObject::GetInput(1) ); 00108 } 00109 00111 void GenerateData(); 00112 00114 typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; 00115 using Superclass::MakeOutput; 00116 virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); 00117 00118 protected: 00119 EquivalenceRelabeler() 00120 { 00121 typename ImageType::Pointer img = 00122 static_cast< ImageType * >( this->MakeOutput(0).GetPointer() ); 00123 this->SetNumberOfRequiredOutputs(1); 00124 this->ProcessObject::SetNthOutput( 0, img.GetPointer() ); 00125 } 00126 00127 virtual ~EquivalenceRelabeler() {} 00128 EquivalenceRelabeler(const Self &) {} 00129 void operator=(const Self &) {} 00130 void PrintSelf(std::ostream & os, Indent indent) const; 00131 00132 void GenerateOutputRequestedRegion(DataObject *output); 00133 00134 void GenerateInputRequestedRegion(); 00135 }; 00136 } // end namespace watershed 00137 } // end namespace itk 00138 00139 #ifndef ITK_MANUAL_INSTANTIATION 00140 #include "itkWatershedEquivalenceRelabeler.hxx" 00141 #endif 00142 00143 #endif 00144