ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkPath.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkPath_h
19 #define __itkPath_h
20 
21 #include "itkDataObject.h"
22 #include "itkIndex.h"
23 #include "itkNumericTraits.h"
24 
25 namespace itk
26 {
52 template< class TInput, class TOutput, unsigned int VDimension >
53 class ITK_EXPORT Path: public DataObject
54 {
55 public:
57  typedef Path Self;
61 
63  itkStaticConstMacro(PathDimension, unsigned int, VDimension);
64 
66  itkTypeMacro(Path, FunctionBase);
67 
69  typedef TInput InputType;
70 
72  typedef TOutput OutputType;
73 
77 
81  virtual inline InputType StartOfInput() const
82  {
84  }
85 
88  virtual inline InputType EndOfInput() const
89  {
91  }
92 
95  virtual OutputType Evaluate(const InputType & input) const = 0;
96 
98  virtual IndexType EvaluateToIndex(const InputType & input) const = 0;
99 
108  virtual OffsetType IncrementInput(InputType & input) const = 0;
109 
110 protected:
111  Path();
112  ~Path(){}
113 
114  void PrintSelf(std::ostream & os, Indent indent) const;
115 
116  itkGetConstMacro(ZeroOffset, OffsetType);
117  itkGetConstMacro(ZeroIndex, IndexType);
118 private:
119  Path(const Self &); //purposely not implemented
120  void operator=(const Self &); //purposely not implemented
121 
122  // These "constants" are initialized in the constructor
123  OffsetType m_ZeroOffset; // = 0 for all dimensions
124  IndexType m_ZeroIndex; // = 0 for all dimensions
125 };
126 } // namespace itk
127 
128 // Define instantiation macro for this template.
129 #define ITK_TEMPLATE_Path(_, EXPORT, TypeX, TypeY) \
130  namespace itk \
131  { \
132  _( 3 ( class EXPORT Path< ITK_TEMPLATE_3 TypeX > ) ) \
133  namespace Templates \
134  { \
135  typedef Path< ITK_TEMPLATE_3 TypeX > Path##TypeY; \
136  } \
137  }
138 
139 #if ITK_TEMPLATE_EXPLICIT
140 #include "Templates/itkPath+-.h"
141 #endif
142 
143 #if ITK_TEMPLATE_TXX
144 #include "itkPath.hxx"
145 #endif
146 
147 #endif
148