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 __itkRobustAutomaticThresholdCalculator_h 00019 #define __itkRobustAutomaticThresholdCalculator_h 00020 00021 #include "itkMacro.h" 00022 #include "itkImage.h" 00023 00024 namespace itk 00025 { 00040 template< class TInputImage, class TGradientImage > 00041 class ITK_EXPORT RobustAutomaticThresholdCalculator:public Object 00042 { 00043 public: 00045 typedef RobustAutomaticThresholdCalculator Self; 00046 typedef Object Superclass; 00047 typedef SmartPointer< Self > Pointer; 00048 typedef SmartPointer< const Self > ConstPointer; 00049 00051 itkNewMacro(Self); 00052 00054 itkTypeMacro(RobustAutomaticThresholdCalculator, Object); 00055 00057 itkStaticConstMacro(ImageDimension, unsigned int, 00058 TInputImage::ImageDimension); 00059 00061 typedef TInputImage InputImageType; 00062 typedef TGradientImage GradientImageType; 00063 00065 typedef typename InputImageType::Pointer InputImagePointer; 00066 typedef typename InputImageType::ConstPointer InputImageConstPointer; 00067 typedef typename GradientImageType::Pointer GradientImagePointer; 00068 typedef typename GradientImageType::ConstPointer GradientImageConstPointer; 00069 typedef typename InputImageType::PixelType InputPixelType; 00070 typedef typename GradientImageType::PixelType GradientPixelType; 00071 00073 virtual void SetInput(const InputImageType *image) 00074 { 00075 if ( m_Input != image ) 00076 { 00077 m_Input = image; 00078 this->Modified(); 00079 m_Valid = false; 00080 } 00081 } 00083 00084 virtual void SetGradient(const GradientImageType *image) 00085 { 00086 if ( m_Gradient != image ) 00087 { 00088 m_Gradient = image; 00089 this->Modified(); 00090 m_Valid = false; 00091 } 00092 } 00093 00094 itkSetMacro(Pow, double); 00095 itkGetConstMacro(Pow, double); 00096 00102 void Compute(void); 00103 00104 const InputPixelType & GetOutput() const; 00105 00106 protected: 00107 RobustAutomaticThresholdCalculator(); 00108 virtual ~RobustAutomaticThresholdCalculator() {} 00109 void PrintSelf(std::ostream & os, Indent indent) const; 00110 00111 private: 00112 RobustAutomaticThresholdCalculator(const Self &); //purposely not implemented 00113 void operator=(const Self &); //purposely not implemented 00114 00115 bool m_Valid; // Have moments been computed 00116 // yet? 00117 double m_Pow; 00118 InputPixelType m_Output; 00119 00120 InputImageConstPointer m_Input; 00121 GradientImageConstPointer m_Gradient; 00122 }; // class RobustAutomaticThresholdCalculator 00123 } // end namespace itk 00124 00125 #ifndef ITK_MANUAL_INSTANTIATION 00126 #include "itkRobustAutomaticThresholdCalculator.hxx" 00127 #endif 00128 00129 #endif /* __itkRobustAutomaticThresholdCalculator_h */ 00130