Statismo  0.10.1
 All Classes Namespaces Functions Typedefs
itkStatisticalShapeModelTransform.h
1 /*
2  * This file is part of the statismo library.
3  *
4  * Author: Marcel Luethi (marcel.luethi@unibas.ch)
5  *
6  * Copyright (c) 2011 University of Basel
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * Redistributions of source code must retain the above copyright notice,
14  * this list of conditions and the following disclaimer.
15  *
16  * Redistributions in binary form must reproduce the above copyright
17  * notice, this list of conditions and the following disclaimer in the
18  * documentation and/or other materials provided with the distribution.
19  *
20  * Neither the name of the project's author nor the names of its
21  * contributors may be used to endorse or promote products derived from
22  * this software without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
30  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
31  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
32  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35  *
36  */
37 
38 #ifndef __ItkStatisticalShapeModelTransform
39 #define __ItkStatisticalShapeModelTransform
40 
41 #include <iostream>
42 
43 #include <itkImage.h>
44 #include <itkVector.h>
45 
46 #include "itkStandardImageRepresenter.h"
47 #include "itkStatisticalModel.h"
48 #include "itkStatisticalModelTransformBase.h"
49 
50 namespace itk {
51 
59 template <class TRepresenter, class TScalarType, unsigned int TDimension >
61  public itk::StatisticalModelTransformBase< TRepresenter, TScalarType , TDimension> {
62  public:
63  /* Standard class typedefs. */
66  typedef SmartPointer<Self> Pointer;
67  typedef SmartPointer<const Self> ConstPointer;
68 
69 
70  itkSimpleNewMacro( Self );
71 
72 
75 
76 
77  typedef typename Superclass::InputPointType InputPointType;
78  typedef typename Superclass::OutputPointType OutputPointType;
79  typedef typename Superclass::RepresenterType RepresenterType;
80 
84  virtual ::itk::LightObject::Pointer CreateAnother() const {
85  ::itk::LightObject::Pointer smartPtr;
86  Pointer another = Self::New().GetPointer();
87  this->CopyBaseMembers(another);
88 
89  smartPtr = static_cast<Pointer>(another);
90  return smartPtr;
91  }
92 
93 
101  virtual OutputPointType TransformPoint(const InputPointType &pt) const {
102  typename RepresenterType::ValueType d;
103  try {
104  d = this->m_StatisticalModel->DrawSampleAtPoint(this->m_coeff_vector, pt);
105  } catch (ExceptionObject &e) {
106  std::cout << "exception occured at point " << pt << std::endl;
107  std::cout << "message " << e.what() << std::endl;
108  }
109  return d;
110  }
111 
113 
114  private:
115 
116  StatisticalShapeModelTransform(const StatisticalShapeModelTransform& orig); // purposely not implemented
117  StatisticalShapeModelTransform& operator=(const StatisticalShapeModelTransform& rhs); //purposely not implemented
118 };
119 
120 
121 } // namespace itk
122 
123 #endif // __ItkStatisticalShapeModelTransform
virtual ::itk::LightObject::Pointer CreateAnother() const
Definition: itkStatisticalShapeModelTransform.h:84
An itk transform that allows for deformations defined by a given Statistical Shape Model...
Definition: itkStatisticalShapeModelTransform.h:60
virtual OutputPointType TransformPoint(const InputPointType &pt) const
Definition: itkStatisticalShapeModelTransform.h:101
Base class that implements an itk transform interface for statistical models.
Definition: itkStatisticalModelTransformBase.h:66