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 __itkMaskNeighborhoodOperatorImageFilter_h 00019 #define __itkMaskNeighborhoodOperatorImageFilter_h 00020 00021 #include "itkNeighborhoodOperatorImageFilter.h" 00022 00023 namespace itk 00024 { 00050 template< class TInputImage, class TMaskImage, class TOutputImage, class TOperatorValueType = 00051 typename TOutputImage::PixelType > 00052 class ITK_EXPORT MaskNeighborhoodOperatorImageFilter: 00053 public NeighborhoodOperatorImageFilter< TInputImage, TOutputImage, TOperatorValueType > 00054 { 00055 public: 00057 typedef MaskNeighborhoodOperatorImageFilter Self; 00058 typedef NeighborhoodOperatorImageFilter< 00059 TInputImage, TOutputImage, TOperatorValueType > Superclass; 00060 00061 typedef SmartPointer< Self > Pointer; 00062 typedef SmartPointer< const Self > ConstPointer; 00063 00065 itkNewMacro(Self); 00066 00068 itkTypeMacro(MaskNeighborhoodOperatorImageFilter, NeighborhoodOperatorImageFilter); 00069 00072 typedef typename TOutputImage::PixelType OutputPixelType; 00073 typedef typename TOutputImage::InternalPixelType OutputInternalPixelType; 00074 typedef typename TInputImage::PixelType InputPixelType; 00075 typedef typename TInputImage::InternalPixelType InputInternalPixelType; 00076 typedef typename TMaskImage::PixelType MaskPixelType; 00077 typedef typename TMaskImage::InternalPixelType MaskInternalPixelType; 00078 00081 itkStaticConstMacro(ImageDimension, unsigned int, 00082 TOutputImage::ImageDimension); 00083 itkStaticConstMacro(InputImageDimension, unsigned int, 00084 TInputImage::ImageDimension); 00085 itkStaticConstMacro(MaskImageDimension, unsigned int, 00086 TMaskImage::ImageDimension); 00088 00090 typedef TInputImage InputImageType; 00091 typedef TMaskImage MaskImageType; 00092 typedef TOutputImage OutputImageType; 00093 typedef typename InputImageType::Pointer InputImagePointer; 00094 typedef typename MaskImageType::Pointer MaskImagePointer; 00095 00097 typedef ImageBoundaryCondition< OutputImageType > * 00098 ImageBoundaryConditionPointerType; 00099 00101 typedef typename Superclass::OutputImageRegionType OutputImageRegionType; 00102 typedef typename Superclass::OperatorValueType OperatorValueType; 00103 00105 typedef typename Superclass::OutputNeighborhoodType OutputNeighborhoodType; 00106 00110 void SetMaskImage(const TMaskImage *mask); 00111 00115 const TMaskImage * GetMaskImage() const; 00116 00120 itkSetMacro(DefaultValue, OutputPixelType); 00121 00124 itkGetConstMacro(DefaultValue, OutputPixelType); 00125 00129 itkSetMacro(UseDefaultValue, bool); 00130 00132 itkGetConstReferenceMacro(UseDefaultValue, bool); 00133 00135 itkBooleanMacro(UseDefaultValue); 00136 00137 #ifdef ITK_USE_CONCEPT_CHECKING 00138 00139 itkConceptMacro( OutputEqualityComparableCheck, 00140 ( Concept::EqualityComparable< OutputPixelType > ) ); 00141 itkConceptMacro( SameDimensionCheck1, 00142 ( Concept::SameDimension< InputImageDimension, ImageDimension > ) ); 00143 itkConceptMacro( SameDimensionCheck2, 00144 ( Concept::SameDimension< InputImageDimension, MaskImageDimension > ) ); 00145 itkConceptMacro( InputConvertibleToOutputCheck, 00146 ( Concept::Convertible< InputPixelType, OutputPixelType > ) ); 00147 itkConceptMacro( OperatorConvertibleToOutputCheck, 00148 ( Concept::Convertible< OperatorValueType, OutputPixelType > ) ); 00149 itkConceptMacro( OutputOStreamWritable, 00150 ( Concept::OStreamWritable< OutputPixelType > ) ); 00151 00153 #endif 00154 protected: 00155 MaskNeighborhoodOperatorImageFilter():m_DefaultValue(NumericTraits< OutputPixelType >::Zero), 00156 m_UseDefaultValue(true) {} 00157 virtual ~MaskNeighborhoodOperatorImageFilter() {} 00158 void PrintSelf(std::ostream & os, Indent indent) const; 00160 00166 void GenerateInputRequestedRegion() 00167 throw ( InvalidRequestedRegionError ); 00168 00180 void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, 00181 ThreadIdType threadId); 00182 00183 private: 00184 MaskNeighborhoodOperatorImageFilter(const Self &); //purposely not implemented 00185 void operator=(const Self &); //purposely not implemented 00186 00187 OutputPixelType m_DefaultValue; 00188 bool m_UseDefaultValue; 00189 }; 00190 } // end namespace itk 00191 00192 #ifndef ITK_MANUAL_INSTANTIATION 00193 #include "itkMaskNeighborhoodOperatorImageFilter.hxx" 00194 #endif 00195 00196 #endif 00197