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 __itkTernaryFunctorImageFilter_h 00019 #define __itkTernaryFunctorImageFilter_h 00020 00021 #include "itkInPlaceImageFilter.h" 00022 #include "itkImageRegionIteratorWithIndex.h" 00023 00024 namespace itk 00025 { 00038 template< class TInputImage1, class TInputImage2, 00039 class TInputImage3, class TOutputImage, class TFunction > 00040 class ITK_EXPORT TernaryFunctorImageFilter: 00041 public InPlaceImageFilter< TInputImage1, TOutputImage > 00042 { 00043 public: 00045 typedef TernaryFunctorImageFilter Self; 00046 typedef InPlaceImageFilter< TInputImage1, TOutputImage > Superclass; 00047 typedef SmartPointer< Self > Pointer; 00048 typedef SmartPointer< const Self > ConstPointer; 00049 00051 itkNewMacro(Self); 00052 00054 itkTypeMacro(TernaryFunctorImageFilter, InPlaceImageFilter); 00055 00057 typedef TFunction FunctorType; 00058 typedef TInputImage1 Input1ImageType; 00059 typedef typename Input1ImageType::ConstPointer Input1ImagePointer; 00060 typedef typename Input1ImageType::RegionType Input1ImageRegionType; 00061 typedef typename Input1ImageType::PixelType Input1ImagePixelType; 00062 typedef TInputImage2 Input2ImageType; 00063 typedef typename Input2ImageType::ConstPointer Input2ImagePointer; 00064 typedef typename Input2ImageType::RegionType Input2ImageRegionType; 00065 typedef typename Input2ImageType::PixelType Input2ImagePixelType; 00066 typedef TInputImage3 Input3ImageType; 00067 typedef typename Input3ImageType::ConstPointer Input3ImagePointer; 00068 typedef typename Input3ImageType::RegionType Input3ImageRegionType; 00069 typedef typename Input3ImageType::PixelType Input3ImagePixelType; 00070 typedef TOutputImage OutputImageType; 00071 typedef typename OutputImageType::Pointer OutputImagePointer; 00072 typedef typename OutputImageType::RegionType OutputImageRegionType; 00073 typedef typename OutputImageType::PixelType OutputImagePixelType; 00074 00076 void SetInput1(const TInputImage1 *image1); 00077 00079 void SetInput2(const TInputImage2 *image2); 00080 00082 void SetInput3(const TInputImage3 *image3); 00083 00088 FunctorType & GetFunctor(void) { return m_Functor; } 00089 00094 const FunctorType & GetFunctor() const 00095 { 00096 return m_Functor; 00097 } 00098 00105 void SetFunctor(const FunctorType & functor) 00106 { 00107 if ( !( functor == m_Functor ) ) 00108 { 00109 m_Functor = functor; 00110 this->Modified(); 00111 } 00112 } 00114 00116 itkStaticConstMacro(Input1ImageDimension, unsigned int, 00117 TInputImage1::ImageDimension); 00118 itkStaticConstMacro(Input2ImageDimension, unsigned int, 00119 TInputImage2::ImageDimension); 00120 itkStaticConstMacro(Input3ImageDimension, unsigned int, 00121 TInputImage3::ImageDimension); 00122 itkStaticConstMacro(OutputImageDimension, unsigned int, 00123 TOutputImage::ImageDimension); 00125 00126 #ifdef ITK_USE_CONCEPT_CHECKING 00127 00128 itkConceptMacro( SameDimensionCheck1, 00129 ( Concept::SameDimension< Input1ImageDimension, Input2ImageDimension > ) ); 00130 itkConceptMacro( SameDimensionCheck2, 00131 ( Concept::SameDimension< Input1ImageDimension, Input3ImageDimension > ) ); 00132 itkConceptMacro( SameDimensionCheck3, 00133 ( Concept::SameDimension< Input1ImageDimension, OutputImageDimension > ) ); 00134 00136 #endif 00137 protected: 00138 TernaryFunctorImageFilter(); 00139 virtual ~TernaryFunctorImageFilter() {} 00140 00143 void BeforeThreadedGenerateData(); 00144 00155 void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, 00156 ThreadIdType threadId); 00157 00158 private: 00159 TernaryFunctorImageFilter(const Self &); //purposely not implemented 00160 void operator=(const Self &); //purposely not implemented 00161 00162 FunctorType m_Functor; 00163 }; 00164 } // end namespace itk 00165 00166 #ifndef ITK_MANUAL_INSTANTIATION 00167 #include "itkTernaryFunctorImageFilter.hxx" 00168 #endif 00169 00170 #endif 00171