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 __itkStatisticsLabelMapFilter_h 00019 #define __itkStatisticsLabelMapFilter_h 00020 00021 #include "itkShapeLabelMapFilter.h" 00022 00023 namespace itk 00024 { 00040 template< class TImage, class TFeatureImage > 00041 class ITK_EXPORT StatisticsLabelMapFilter: 00042 public ShapeLabelMapFilter< TImage, 00043 Image< typename TImage::PixelType, ::itk::GetImageDimension< TImage >::ImageDimension > > 00044 { 00045 public: 00047 typedef StatisticsLabelMapFilter Self; 00048 typedef ShapeLabelMapFilter< TImage > Superclass; 00049 typedef SmartPointer< Self > Pointer; 00050 typedef SmartPointer< const Self > ConstPointer; 00051 00053 typedef TImage ImageType; 00054 typedef typename ImageType::Pointer ImagePointer; 00055 typedef typename ImageType::ConstPointer ImageConstPointer; 00056 typedef typename ImageType::PixelType PixelType; 00057 typedef typename ImageType::IndexType IndexType; 00058 typedef typename ImageType::PointType PointType; 00059 typedef typename ImageType::LabelObjectType LabelObjectType; 00060 typedef typename LabelObjectType::MatrixType MatrixType; 00061 typedef typename LabelObjectType::VectorType VectorType; 00062 00063 typedef TFeatureImage FeatureImageType; 00064 typedef typename FeatureImageType::Pointer FeatureImagePointer; 00065 typedef typename FeatureImageType::ConstPointer FeatureImageConstPointer; 00066 typedef typename FeatureImageType::PixelType FeatureImagePixelType; 00067 00069 itkStaticConstMacro(ImageDimension, unsigned int, 00070 TImage::ImageDimension); 00071 00073 itkNewMacro(Self); 00074 00076 itkTypeMacro(StatisticsLabelMapFilter, 00077 ShapeLabelMapFilter); 00078 00079 #ifdef ITK_USE_CONCEPT_CHECKING 00080 00081 /* itkConceptMacro(InputEqualityComparableCheck, 00082 (Concept::EqualityComparable<InputImagePixelType>)); 00083 itkConceptMacro(IntConvertibleToInputCheck, 00084 (Concept::Convertible<int, InputImagePixelType>)); 00085 itkConceptMacro(InputOStreamWritableCheck, 00086 (Concept::OStreamWritable<InputImagePixelType>));*/ 00087 00089 #endif 00090 00092 void SetFeatureImage(const TFeatureImage *input) 00093 { 00094 // Process object is not const-correct so the const casting is required. 00095 this->SetNthInput( 1, const_cast< TFeatureImage * >( input ) ); 00096 } 00097 00099 FeatureImageType * GetFeatureImage() 00100 { 00101 return static_cast< FeatureImageType * >( const_cast< DataObject * >( this->ProcessObject::GetInput(1) ) ); 00102 } 00103 00105 void SetInput1(TImage *input) 00106 { 00107 this->SetInput(input); 00108 } 00109 00111 void SetInput2(const TFeatureImage *input) 00112 { 00113 this->SetFeatureImage(input); 00114 } 00115 00122 itkSetMacro(ComputeHistogram, bool); 00123 itkGetConstReferenceMacro(ComputeHistogram, bool); 00124 itkBooleanMacro(ComputeHistogram); 00126 00132 itkSetMacro(NumberOfBins, unsigned int); 00133 itkGetConstReferenceMacro(NumberOfBins, unsigned int); 00134 protected: 00135 StatisticsLabelMapFilter(); 00136 ~StatisticsLabelMapFilter() {} 00138 00139 virtual void ThreadedProcessLabelObject(LabelObjectType *labelObject); 00140 00141 virtual void BeforeThreadedGenerateData(); 00142 00143 void PrintSelf(std::ostream & os, Indent indent) const; 00144 00145 private: 00146 StatisticsLabelMapFilter(const Self &); //purposely not implemented 00147 void operator=(const Self &); //purposely not implemented 00148 00149 FeatureImagePixelType m_Minimum; 00150 FeatureImagePixelType m_Maximum; 00151 unsigned int m_NumberOfBins; 00152 bool m_ComputeHistogram; 00153 }; // end of class 00154 } // end namespace itk 00155 00156 #ifndef ITK_MANUAL_INSTANTIATION 00157 #include "itkStatisticsLabelMapFilter.hxx" 00158 #endif 00159 00160 #endif 00161