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 __itkIsolatedWatershedImageFilter_h 00019 #define __itkIsolatedWatershedImageFilter_h 00020 00021 #include "itkWatershedImageFilter.h" 00022 #include "itkGradientMagnitudeImageFilter.h" 00023 00024 namespace itk 00025 { 00040 template< class TInputImage, class TOutputImage > 00041 class ITK_EXPORT IsolatedWatershedImageFilter: 00042 public ImageToImageFilter< TInputImage, TOutputImage > 00043 { 00044 public: 00046 typedef IsolatedWatershedImageFilter Self; 00047 typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass; 00048 typedef SmartPointer< Self > Pointer; 00049 typedef SmartPointer< const Self > ConstPointer; 00050 00052 itkNewMacro(Self); 00053 00055 itkTypeMacro(IsolatedWatershedImageFilter, 00056 ImageToImageFilter); 00057 00058 typedef TInputImage InputImageType; 00059 typedef typename InputImageType::Pointer InputImagePointer; 00060 typedef typename InputImageType::ConstPointer InputImageConstPointer; 00061 typedef typename InputImageType::RegionType InputImageRegionType; 00062 typedef typename InputImageType::PixelType InputImagePixelType; 00063 typedef typename InputImageType::IndexType IndexType; 00064 typedef typename InputImageType::SizeType SizeType; 00065 00066 typedef TOutputImage OutputImageType; 00067 typedef typename OutputImageType::Pointer OutputImagePointer; 00068 typedef typename OutputImageType::RegionType OutputImageRegionType; 00069 typedef typename OutputImageType::PixelType OutputImagePixelType; 00070 00071 typedef typename NumericTraits<InputImagePixelType>::RealType RealPixelType; 00072 typedef Image<RealPixelType, TInputImage::ImageDimension> RealImageType; 00073 00074 typedef WatershedImageFilter< RealImageType > WatershedType; 00075 typedef GradientMagnitudeImageFilter< InputImageType, RealImageType > GradientMagnitudeType; 00076 void PrintSelf(std::ostream & os, Indent indent) const; 00077 00081 itkSetMacro(Seed1, IndexType); 00082 00086 itkSetMacro(Seed2, IndexType); 00087 00089 itkSetMacro(Threshold, double); 00090 itkGetConstMacro(Threshold, double); 00092 00095 itkSetMacro(IsolatedValueTolerance, double); 00096 itkGetConstMacro(IsolatedValueTolerance, double); 00098 00101 itkSetMacro(UpperValueLimit, double); 00102 itkGetConstMacro(UpperValueLimit, double); 00104 00108 itkSetMacro(ReplaceValue1, OutputImagePixelType); 00109 itkGetConstMacro(ReplaceValue1, OutputImagePixelType); 00110 itkSetMacro(ReplaceValue2, OutputImagePixelType); 00111 itkGetConstMacro(ReplaceValue2, OutputImagePixelType); 00113 00115 itkGetConstMacro(IsolatedValue, double); 00116 protected: 00117 IsolatedWatershedImageFilter(); 00118 ~IsolatedWatershedImageFilter(){} 00119 IndexType m_Seed1; 00120 IndexType m_Seed2; 00122 00123 OutputImagePixelType m_ReplaceValue1; 00124 OutputImagePixelType m_ReplaceValue2; 00125 00126 typename GradientMagnitudeType::Pointer m_GradientMagnitude; 00127 00128 typename WatershedType::Pointer m_Watershed; 00129 00130 double m_Threshold; 00131 double m_IsolatedValue; 00132 double m_IsolatedValueTolerance; 00133 double m_UpperValueLimit; 00134 00135 // Override since the filter needs all the data for the algorithm 00136 void GenerateInputRequestedRegion(); 00137 00138 // Override since the filter produces the entire dataset 00139 void EnlargeOutputRequestedRegion(DataObject *output); 00140 00141 void GenerateData(); 00142 00143 private: 00144 IsolatedWatershedImageFilter(const Self &); //purposely not implemented 00145 void operator=(const Self &); //purposely not implemented 00146 }; 00147 } // end namespace itk 00148 00149 #ifndef ITK_MANUAL_INSTANTIATION 00150 #include "itkIsolatedWatershedImageFilter.hxx" 00151 #endif 00152 00153 #endif 00154