ITK  4.2.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 {
00052 template< class TInput, class TOutput, unsigned int VDimension >
00053 class ITK_EXPORT Path: public DataObject
00054 {
00055 public:
00057   typedef Path                       Self;
00058   typedef DataObject                 Superclass;
00059   typedef SmartPointer< Self >       Pointer;
00060   typedef SmartPointer< const Self > ConstPointer;
00061 
00063   itkStaticConstMacro(PathDimension, unsigned int, VDimension);
00064 
00066   itkTypeMacro(Path, FunctionBase);
00067 
00069   typedef TInput InputType;
00070 
00072   typedef TOutput OutputType;
00073 
00075   typedef Index<  VDimension > IndexType;
00076   typedef Offset< VDimension > OffsetType;
00077 
00081   virtual inline InputType StartOfInput() const
00082   {
00083     return NumericTraits< InputType >::Zero;
00084   }
00085 
00088   virtual inline InputType EndOfInput() const
00089   {
00090     return NumericTraits< InputType >::One;
00091   }
00092 
00095   virtual OutputType Evaluate(const InputType & input) const = 0;
00096 
00098   virtual IndexType EvaluateToIndex(const InputType & input) const = 0;
00099 
00108   virtual OffsetType IncrementInput(InputType & input) const = 0;
00109 
00110 protected:
00111   Path();
00112   ~Path(){}
00113 
00114   void PrintSelf(std::ostream & os, Indent indent) const;
00115 
00116   itkGetConstMacro(ZeroOffset, OffsetType);
00117   itkGetConstMacro(ZeroIndex, IndexType);
00118 private:
00119   Path(const Self &);           //purposely not implemented
00120   void operator=(const Self &); //purposely not implemented
00121 
00122   // These "constants" are initialized in the constructor
00123   OffsetType m_ZeroOffset;  // = 0 for all dimensions
00124   IndexType  m_ZeroIndex;   // = 0 for all dimensions
00125 };
00126 } // namespace itk
00127 
00128 // Define instantiation macro for this template.
00129 #define ITK_TEMPLATE_Path(_, EXPORT, TypeX, TypeY)     \
00130   namespace itk                                        \
00131   {                                                    \
00132   _( 3 ( class EXPORT Path< ITK_TEMPLATE_3 TypeX > ) ) \
00133   namespace Templates                                  \
00134   {                                                    \
00135   typedef Path< ITK_TEMPLATE_3 TypeX > Path##TypeY;  \
00136   }                                                    \
00137   }
00138 
00139 #if ITK_TEMPLATE_EXPLICIT
00140 #include "Templates/itkPath+-.h"
00141 #endif
00142 
00143 #if ITK_TEMPLATE_TXX
00144 #include "itkPath.hxx"
00145 #endif
00146 
00147 #endif
00148