ITK
4.0.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 00019 #ifndef __itkHistogramThresholdImageFilter_h 00020 #define __itkHistogramThresholdImageFilter_h 00021 00022 #include "itkImageToImageFilter.h" 00023 #include "itkHistogram.h" 00024 #include "itkHistogramThresholdCalculator.h" 00025 00026 namespace itk { 00027 00049 template<class TInputImage, class TOutputImage> 00050 class ITK_EXPORT HistogramThresholdImageFilter : 00051 public ImageToImageFilter<TInputImage, TOutputImage> 00052 { 00053 public: 00055 typedef HistogramThresholdImageFilter Self; 00056 typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass; 00057 typedef SmartPointer<Self> Pointer; 00058 typedef SmartPointer<const Self> ConstPointer; 00059 00061 itkNewMacro(Self); 00062 00064 itkTypeMacro(HistogramThresholdImageFilter, ImageToImageFilter); 00065 00066 typedef TInputImage InputImageType; 00067 typedef TOutputImage OutputImageType; 00068 00070 typedef typename InputImageType::PixelType InputPixelType; 00071 typedef typename OutputImageType::PixelType OutputPixelType; 00072 00074 typedef typename InputImageType::Pointer InputImagePointer; 00075 typedef typename OutputImageType::Pointer OutputImagePointer; 00076 00077 typedef typename InputImageType::SizeType InputSizeType; 00078 typedef typename InputImageType::IndexType InputIndexType; 00079 typedef typename InputImageType::RegionType InputImageRegionType; 00080 typedef typename OutputImageType::SizeType OutputSizeType; 00081 typedef typename OutputImageType::IndexType OutputIndexType; 00082 typedef typename OutputImageType::RegionType OutputImageRegionType; 00083 00084 typedef typename NumericTraits< InputPixelType >::ValueType ValueType; 00085 typedef typename NumericTraits< ValueType >::RealType ValueRealType; 00086 typedef Statistics::Histogram< ValueRealType > HistogramType; 00087 typedef typename HistogramType::Pointer HistogramPointer; 00088 typedef typename HistogramType::ConstPointer HistogramConstPointer; 00089 typedef typename HistogramType::SizeType HistogramSizeType; 00090 typedef typename HistogramType::MeasurementType HistogramMeasurementType; 00091 typedef typename HistogramType::MeasurementVectorType HistogramMeasurementVectorType; 00092 typedef HistogramThresholdCalculator<HistogramType, InputPixelType> 00093 CalculatorType; 00094 typedef typename CalculatorType::Pointer CalculatorPointer; 00095 00097 itkStaticConstMacro(InputImageDimension, unsigned int, 00098 InputImageType::ImageDimension ); 00099 itkStaticConstMacro(OutputImageDimension, unsigned int, 00100 OutputImageType::ImageDimension ); 00102 00105 itkSetMacro(OutsideValue,OutputPixelType); 00106 00108 itkGetConstMacro(OutsideValue,OutputPixelType); 00109 00112 itkSetMacro(InsideValue,OutputPixelType); 00113 00115 itkGetConstMacro(InsideValue,OutputPixelType); 00116 00118 itkSetMacro(NumberOfHistogramBins, unsigned int); 00119 itkGetConstMacro(NumberOfHistogramBins, unsigned int); 00121 00124 itkSetMacro(AutoMinimumMaximum, bool); 00125 itkGetConstMacro(AutoMinimumMaximum, bool); 00126 itkBooleanMacro(AutoMinimumMaximum); 00128 00130 itkGetConstMacro(Threshold,InputPixelType); 00131 00133 itkSetObjectMacro(Calculator, CalculatorType); 00134 itkGetObjectMacro(Calculator, CalculatorType); 00136 00137 #ifdef ITK_USE_CONCEPT_CHECKING 00138 00139 itkConceptMacro(OutputEqualityComparableCheck, 00140 (Concept::EqualityComparable<OutputPixelType>)); 00141 itkConceptMacro(InputOStreamWritableCheck, 00142 (Concept::OStreamWritable<InputPixelType>)); 00143 itkConceptMacro(OutputOStreamWritableCheck, 00144 (Concept::OStreamWritable<OutputPixelType>)); 00145 00147 #endif 00148 protected: 00149 HistogramThresholdImageFilter(); 00150 ~HistogramThresholdImageFilter(){}; 00151 void PrintSelf(std::ostream& os, Indent indent) const; 00153 00154 void GenerateInputRequestedRegion(); 00155 void GenerateData (); 00156 00157 private: 00158 HistogramThresholdImageFilter(const Self&); //purposely not implemented 00159 void operator=(const Self&); //purposely not implemented 00160 00161 OutputPixelType m_InsideValue; 00162 OutputPixelType m_OutsideValue; 00163 InputPixelType m_Threshold; 00164 CalculatorPointer m_Calculator; 00165 unsigned m_NumberOfHistogramBins; 00166 bool m_AutoMinimumMaximum; 00167 }; // end of class 00168 00169 } // end namespace itk 00170 00171 #ifndef ITK_MANUAL_INSTANTIATION 00172 #include "itkHistogramThresholdImageFilter.hxx" 00173 #endif 00174 00175 #endif 00176