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 /*========================================================================= 00019 * 00020 * Portions of this file are subject to the VTK Toolkit Version 3 copyright. 00021 * 00022 * Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00023 * 00024 * For complete copyright, license and disclaimer of warranty information 00025 * please refer to the NOTICE file at the top of the ITK source tree. 00026 * 00027 *=========================================================================*/ 00028 #ifndef __itkBoundedReciprocalImageFilter_h 00029 #define __itkBoundedReciprocalImageFilter_h 00030 00031 #include "itkUnaryFunctorImageFilter.h" 00032 00033 namespace itk 00034 { 00044 namespace Functor 00045 { 00046 template< class TInput, class TOutput > 00047 class BoundedReciprocal 00048 { 00049 public: 00050 BoundedReciprocal() {} 00051 ~BoundedReciprocal() {} 00052 bool operator!=(const BoundedReciprocal &) const 00053 { 00054 return false; 00055 } 00056 00057 bool operator==(const BoundedReciprocal & other) const 00058 { 00059 return !( *this != other ); 00060 } 00061 00062 inline TOutput operator()(const TInput & A) const 00063 { 00064 return static_cast< TOutput >( 1.0 / ( 1.0 + static_cast< double >( A ) ) ); 00065 } 00066 }; 00067 } 00068 00069 template< class TInputImage, class TOutputImage > 00070 class ITK_EXPORT BoundedReciprocalImageFilter: 00071 public 00072 UnaryFunctorImageFilter< TInputImage, TOutputImage, 00073 Functor::BoundedReciprocal< 00074 typename TInputImage::PixelType, 00075 typename TOutputImage::PixelType > > 00076 { 00077 public: 00079 typedef BoundedReciprocalImageFilter Self; 00080 typedef UnaryFunctorImageFilter< TInputImage, TOutputImage, 00081 Functor::BoundedReciprocal< 00082 typename TInputImage::PixelType, 00083 typename TOutputImage::PixelType > 00084 > Superclass; 00085 00086 typedef SmartPointer< Self > Pointer; 00087 typedef SmartPointer< const Self > ConstPointer; 00088 00090 itkNewMacro(Self); 00091 00093 itkTypeMacro(BoundedReciprocalImageFilter, 00094 UnaryFunctorImageFilter); 00095 00096 #ifdef ITK_USE_CONCEPT_CHECKING 00097 00098 itkConceptMacro( InputConvertibleToDoubleCheck, 00099 ( Concept::Convertible< typename TInputImage::PixelType, double > ) ); 00100 itkConceptMacro( DoubleConvertibleToOutputCheck, 00101 ( Concept::Convertible< double, typename TOutputImage::PixelType > ) ); 00102 00104 #endif 00105 protected: 00106 BoundedReciprocalImageFilter() {} 00107 virtual ~BoundedReciprocalImageFilter() {} 00108 private: 00109 BoundedReciprocalImageFilter(const Self &); //purposely not implemented 00110 void operator=(const Self &); //purposely not implemented 00111 }; 00112 } // end namespace itk 00114 00115 #endif 00116