ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkPath.h
Go to the documentation of this file.
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 __itkPath_h
00019 #define __itkPath_h
00020 
00021 #include "itkDataObject.h"
00022 #include "itkIndex.h"
00023 #include "itkNumericTraits.h"
00024 
00025 namespace itk
00026 {
00047 template< class TInput, class TOutput, unsigned int VDimension >
00048 class ITK_EXPORT Path:public DataObject
00049 {
00050 public:
00052   typedef Path                       Self;
00053   typedef DataObject                 Superclass;
00054   typedef SmartPointer< Self >       Pointer;
00055   typedef SmartPointer< const Self > ConstPointer;
00056 
00058   itkStaticConstMacro(PathDimension, unsigned int, VDimension);
00059 
00061   itkTypeMacro(Path, FunctionBase);
00062 
00064   typedef TInput InputType;
00065 
00067   typedef TOutput OutputType;
00068 
00070   typedef Index<  VDimension > IndexType;
00071   typedef Offset< VDimension > OffsetType;
00072 
00076   virtual inline InputType StartOfInput() const
00077   {
00078     return NumericTraits< InputType >::Zero;
00079   }
00080 
00083   virtual inline InputType EndOfInput() const
00084   {
00085     return NumericTraits< InputType >::One;
00086   }
00087 
00090   virtual OutputType Evaluate(const InputType & input) const = 0;
00091 
00093   virtual IndexType EvaluateToIndex(const InputType & input) const = 0;
00094 
00103   virtual OffsetType IncrementInput(InputType & input) const = 0;
00104 
00105 protected:
00106   Path();
00107   ~Path(){}
00108 
00109   void PrintSelf(std::ostream & os, Indent indent) const;
00110 
00111   itkGetConstMacro(ZeroOffset, OffsetType);
00112   itkGetConstMacro(ZeroIndex, IndexType);
00113 private:
00114   Path(const Self &);           //purposely not implemented
00115   void operator=(const Self &); //purposely not implemented
00116 
00117   // These "constants" are initialized in the constructor
00118   OffsetType m_ZeroOffset;  // = 0 for all dimensions
00119   IndexType  m_ZeroIndex;   // = 0 for all dimensions
00120 };
00121 } // namespace itk
00122 
00123 // Define instantiation macro for this template.
00124 #define ITK_TEMPLATE_Path(_, EXPORT, TypeX, TypeY)     \
00125   namespace itk                                        \
00126   {                                                    \
00127   _( 3 ( class EXPORT Path< ITK_TEMPLATE_3 TypeX > ) ) \
00128   namespace Templates                                  \
00129   {                                                    \
00130   typedef Path< ITK_TEMPLATE_3 TypeX > Path##TypeY;  \
00131   }                                                    \
00132   }
00133 
00134 #if ITK_TEMPLATE_EXPLICIT
00135 #include "Templates/itkPath+-.h"
00136 #endif
00137 
00138 #if ITK_TEMPLATE_TXX
00139 #include "itkPath.hxx"
00140 #endif
00141 
00142 #endif
00143