Seg3D  2.4
Seg3D is a free volume segmentation and processing tool developed by the NIH Center for Integrative Biomedical Computing at the University of Utah Scientific Computing and Imaging (SCI) Institute.
itkInverseTransform.h
1 /*
2  For more information, please see: http://software.sci.utah.edu
3 
4  The MIT License
5 
6  Copyright (c) 2016 Scientific Computing and Imaging Institute,
7  University of Utah.
8 
9 
10  Permission is hereby granted, free of charge, to any person obtaining a
11  copy of this software and associated documentation files (the "Software"),
12  to deal in the Software without restriction, including without limitation
13  the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  and/or sell copies of the Software, and to permit persons to whom the
15  Software is furnished to do so, subject to the following conditions:
16 
17  The above copyright notice and this permission notice shall be included
18  in all copies or substantial portions of the Software.
19 
20  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26  DEALINGS IN THE SOFTWARE.
27 */
28 
29 
30 // File : itkInverseTransform.h
31 // Author : Pavel A. Koshevoy
32 // Created : 2005/06/03 10:16
33 // Copyright : (C) 2004-2008 University of Utah
34 // Description : A inverse transform class.
35 
36 #ifndef __itkInverseTransform_h
37 #define __itkInverseTransform_h
38 
39 // ITK includes:
40 #include <itkTransform.h>
41 #include <itkMacro.h>
42 
43 
44 //----------------------------------------------------------------
45 // itk::InverseTransform
46 //
47 namespace itk
48 {
49 
50 //----------------------------------------------------------------
51 // InverseTransform
52 //
53 template <class ForwardTransform>
55 public Transform< typename ForwardTransform::ScalarType,
56 ForwardTransform::OutputSpaceDimension,
57 ForwardTransform::InputSpaceDimension >
58 {
59 public:
62 
63  typedef Transform< typename ForwardTransform::ScalarType,
64  ForwardTransform::OutputSpaceDimension,
65  ForwardTransform::InputSpaceDimension > Superclass;
66 
67  typedef SmartPointer< Self > Pointer;
68  typedef SmartPointer< const Self > ConstPointer;
69 
72  typedef typename Superclass::InverseTransformBaseType InverseTransformBaseType;
73  typedef typename InverseTransformBaseType::Pointer InverseTransformBasePointer;
74 
76  itkNewMacro(Self);
77 
79  itkTypeMacro( InverseTransform, Transform );
80 
82  typedef typename Superclass::ScalarType ScalarType;
83 
85  typedef typename Superclass::ParametersType ParametersType;
86 
88  typedef typename Superclass::JacobianType JacobianType;
89 
91  typedef typename Superclass::InputPointType InputPointType;
92  typedef typename Superclass::OutputPointType OutputPointType;
93 
95  typedef typename Superclass::NumberOfParametersType NumberOfParametersType;
96 
97 
99  itkStaticConstMacro(InputSpaceDimension,
100  unsigned int,
101  ForwardTransform::OutputSpaceDimension);
102  itkStaticConstMacro(OutputSpaceDimension,
103  unsigned int,
104  ForwardTransform::InputSpaceDimension);
105 
107  void SetForwardTransform(const ForwardTransform * forward)
108  { forward_ = forward; }
109 
111  virtual OutputPointType TransformPoint(const InputPointType & y) const
112  {
113  // TODO: replace with exception
114 // assert(forward_ != NULL);
115  if (forward_ == NULL)
116  {
117  itkExceptionMacro(<< "Forward transform is null");
118  }
119  return forward_->BackTransformPoint(y);
120  }
121 
122  virtual void ComputeJacobianWithRespectToParameters( const InputPointType &, JacobianType & ) const
123  {
124  itkExceptionMacro(<< "ComputeJacobianWithRespectToParameters is not implemented for InverseTransform");
125  }
126 
127  virtual void SetFixedParameters(const ParametersType &)
128  {
129  itkExceptionMacro(<< "SetFixedParameters is not implemented for InverseTransform");
130  }
131 
132  virtual void SetParameters(const ParametersType &)
133  {
134  itkExceptionMacro(<< "SetParameters is not implemented for InverseTransform");
135  }
136 
137  virtual NumberOfParametersType GetNumberOfParameters() const
138  { return 0; }
139 
140  virtual InverseTransformBasePointer GetInverseTransform() const
141  { return const_cast<ForwardTransform *>(forward_); }
142 
143 protected:
144  InverseTransform(): Superclass(0) {}
145 
146 private:
147  // disable default copy constructor and assignment operator:
148  InverseTransform(const Self & other);
149  const Self & operator = (const Self & t);
150 
151  // the transform whose inverse we are trying to evaluate:
152  const ForwardTransform * forward_;
153 };
154 
155 } // namespace itk
156 
157 #endif // __itkInverseTransform_h
Superclass::InverseTransformBaseType InverseTransformBaseType
Definition: itkInverseTransform.h:72
void SetForwardTransform(const ForwardTransform *forward)
Definition: itkInverseTransform.h:107
Superclass::InputPointType InputPointType
Definition: itkInverseTransform.h:91
Definition: itkNormalizeImageFilterWithMask.h:48
Superclass::ParametersType ParametersType
Definition: itkInverseTransform.h:85
itkTypeMacro(InverseTransform, Transform)
itkStaticConstMacro(InputSpaceDimension, unsigned int, ForwardTransform::OutputSpaceDimension)
InverseTransform Self
Definition: itkInverseTransform.h:61
Superclass::ScalarType ScalarType
Definition: itkInverseTransform.h:82
virtual OutputPointType TransformPoint(const InputPointType &y) const
Definition: itkInverseTransform.h:111
Definition: itkInverseTransform.h:54
Superclass::NumberOfParametersType NumberOfParametersType
Definition: itkInverseTransform.h:95
Superclass::JacobianType JacobianType
Definition: itkInverseTransform.h:88