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 __itkAbsImageAdaptor_h 00019 #define __itkAbsImageAdaptor_h 00020 00021 #include "itkImageAdaptor.h" 00022 00023 namespace itk 00024 { 00025 namespace Accessor 00026 { 00038 template< class TInternalType, class TExternalType > 00039 class ITK_EXPORT AbsPixelAccessor 00040 { 00041 public: 00044 typedef TExternalType ExternalType; 00045 00048 typedef TInternalType InternalType; 00049 00050 static inline void Set(TInternalType & output, const TExternalType & input) 00051 { 00052 output = (TInternalType)( 00053 ( input > NumericTraits< TExternalType >::Zero ) ? input : -input ); 00054 } 00055 00056 static inline TExternalType Get(const TInternalType & input) 00057 { 00058 return (TExternalType)( 00059 ( input > NumericTraits< TInternalType >::Zero ) ? input : -input ); 00060 } 00061 }; 00062 } // end namespace Accessor 00063 00073 template< class TImage, class TOutputPixelType > 00074 class ITK_EXPORT AbsImageAdaptor:public 00075 ImageAdaptor< TImage, 00076 Accessor::AbsPixelAccessor< 00077 typename TImage::PixelType, 00078 TOutputPixelType > > 00079 { 00080 public: 00082 typedef AbsImageAdaptor Self; 00083 typedef ImageAdaptor< TImage, Accessor::AbsPixelAccessor< 00084 typename TImage::PixelType, 00085 TOutputPixelType > > Superclass; 00086 00087 typedef SmartPointer< Self > Pointer; 00088 typedef SmartPointer< const Self > ConstPointer; 00089 00091 itkNewMacro(Self); 00092 00094 itkTypeMacro(AbsImageAdaptor, ImageAdaptor); 00095 protected: 00096 AbsImageAdaptor() {} 00097 virtual ~AbsImageAdaptor() {} 00098 private: 00099 AbsImageAdaptor(const Self &); //purposely not implemented 00100 void operator=(const Self &); //purposely not implemented 00101 }; 00102 } // end namespace itk 00104 00105 #endif 00106