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 __itkTernaryMagnitudeSquaredImageFilter_h 00019 #define __itkTernaryMagnitudeSquaredImageFilter_h 00020 00021 #include "itkTernaryFunctorImageFilter.h" 00022 00023 namespace itk 00024 { 00025 namespace Functor 00026 { 00032 template< class TInput1, class TInput2, class TInput3, class TOutput > 00033 class ModulusSquare3 00034 { 00035 public: 00036 ModulusSquare3() {} 00037 ~ModulusSquare3() {} 00038 bool operator!=(const ModulusSquare3 &) const 00039 { 00040 return false; 00041 } 00043 00044 bool operator==(const ModulusSquare3 & other) const 00045 { 00046 return !( *this != other ); 00047 } 00048 00049 inline TOutput operator()(const TInput1 & A, 00050 const TInput2 & B, 00051 const TInput3 & C) const 00052 { return (TOutput)( A * A + B * B + C * C ); } 00053 }; 00054 } 00065 template< class TInputImage1, class TInputImage2, 00066 class TInputImage3, class TOutputImage > 00067 class ITK_EXPORT TernaryMagnitudeSquaredImageFilter: 00068 public 00069 TernaryFunctorImageFilter< TInputImage1, TInputImage2, 00070 TInputImage3, TOutputImage, 00071 Functor::ModulusSquare3< 00072 typename TInputImage1::PixelType, 00073 typename TInputImage2::PixelType, 00074 typename TInputImage3::PixelType, 00075 typename TOutputImage::PixelType > > 00076 { 00077 public: 00079 typedef TernaryMagnitudeSquaredImageFilter Self; 00080 typedef TernaryFunctorImageFilter< 00081 TInputImage1, TInputImage2, 00082 TInputImage3, TOutputImage, 00083 Functor::ModulusSquare3< 00084 typename TInputImage1::PixelType, 00085 typename TInputImage2::PixelType, 00086 typename TInputImage3::PixelType, 00087 typename TOutputImage::PixelType > > Superclass; 00088 00089 typedef SmartPointer< Self > Pointer; 00090 typedef SmartPointer< const Self > ConstPointer; 00091 00093 itkNewMacro(Self); 00094 00096 itkTypeMacro(TernaryMagnitudeSquaredImageFilter, 00097 TernaryFunctorImageFilter); 00098 protected: 00099 TernaryMagnitudeSquaredImageFilter() {} 00100 virtual ~TernaryMagnitudeSquaredImageFilter() {} 00101 private: 00102 TernaryMagnitudeSquaredImageFilter(const Self &); //purposely not implemented 00103 void operator=(const Self &); //purposely not implemented 00104 }; 00105 } // end namespace itk 00107 00108 #endif 00109