00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkFEMLoadLandmark.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/12/15 14:13:21 $ 00007 Version: $Revision: 1.11 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #ifndef __itkFEMLoadLandmark_h 00019 #define __itkFEMLoadLandmark_h 00020 00021 #include "itkFEMLoadElementBase.h" 00022 #include "vnl/vnl_vector.h" 00023 00024 namespace itk { 00025 namespace fem { 00026 00034 class LoadLandmark : public LoadElement { 00035 FEM_CLASS(LoadLandmark,LoadElement) 00036 public: 00037 00041 double eta; 00042 00046 vnl_vector<Float> m_pt; 00047 00051 vnl_vector<Float> m_target; 00052 00053 vnl_vector<Float> m_source; 00054 00055 vnl_vector<Float> m_force; 00056 00057 00062 //Element::ConstPointer m_element; 00063 00067 Solution::ConstPointer m_Solution; 00068 00072 void SetSolution(Solution::ConstPointer ptr) { m_Solution = ptr; } 00073 Solution::ConstPointer GetSolution() { return m_Solution; } 00074 Float GetSolution(unsigned int i, unsigned int v=0) { return m_Solution->GetSolutionValue(i,v); } 00075 00079 const Element::VectorType& GetPoint() const { return m_pt; } 00080 00084 void SetPoint( const vnl_vector<Float>& pt) { m_pt=pt; } 00085 00089 Element::VectorType& GetSource() 00090 { 00091 return m_source; 00092 } 00093 00094 Element::VectorType& GetForce() 00095 { 00096 return m_force; 00097 } 00098 00102 void SetForce( const vnl_vector<Float>& force) 00103 { 00104 if (m_force.size() != force.size()) 00105 { 00106 m_force.set_size(force.size()); 00107 } 00108 for (unsigned int i=0; i<force.size(); i++) 00109 m_force[i]=force[i]; 00110 } 00111 00112 00116 void SetSource( const vnl_vector<Float>& source) 00117 { 00118 if (m_source.size() != source.size()) 00119 { 00120 m_source.set_size(source.size()); 00121 } 00122 for (unsigned int i=0; i<source.size(); i++) 00123 m_source[i]=source[i]; 00124 } 00125 00129 const Element::VectorType& GetTarget() const 00130 { 00131 return m_target; 00132 } 00133 00137 void SetTarget( const vnl_vector<Float>& target) 00138 { 00139 if (m_target.size() != target.size()) 00140 { 00141 m_target.set_size(target.size()); 00142 } 00143 for (unsigned int i=0; i<target.size(); i++) 00144 m_target[i]=target[i]; 00145 } 00146 00147 00148 void ScalePointAndForce( double* spacing, double fwt) 00149 { 00150 for (unsigned int i=0; i<m_target.size(); i++) 00151 { 00152 m_target[i]/=spacing[i]; 00153 m_source[i]/=spacing[i]; 00154 this->eta*=fwt; 00155 } 00156 } 00157 00161 virtual void Read( std::istream& f, void* info ); 00162 00166 virtual void AssignToElement( Element::ArrayType::Pointer elements ); 00167 00171 virtual void Write( std::ostream& f ) const; 00172 00176 LoadLandmark() {} 00177 //LoadLandmark( Element::ConstPointer el_, vnl_vector<Float> pu_ ) : m_pt(pu_), m_element(el_) {} 00178 00179 }; 00180 00181 FEM_CLASS_INIT(LoadLandmark) 00182 00183 00184 00185 00186 }} // end namespace itk::fem 00187 00188 #endif // #ifndef __itkFEMLoadLandmark_h