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); } 00076 00080 const Element::VectorType& GetPoint() const { return m_pt; } 00081 00085 void SetPoint( const vnl_vector<Float>& pt) { m_pt=pt; } 00086 00090 Element::VectorType& GetSource() 00091 { 00092 return m_source; 00093 } 00094 00095 Element::VectorType& GetForce() 00096 { 00097 return m_force; 00098 } 00099 00103 void SetForce( const vnl_vector<Float>& force) 00104 { 00105 if (m_force.size() != force.size()) 00106 { 00107 m_force.set_size(force.size()); 00108 } 00109 for (unsigned int i=0; i<force.size(); i++) 00110 m_force[i]=force[i]; 00111 } 00113 00114 00118 void SetSource( const vnl_vector<Float>& source) 00119 { 00120 if (m_source.size() != source.size()) 00121 { 00122 m_source.set_size(source.size()); 00123 } 00124 for (unsigned int i=0; i<source.size(); i++) 00125 m_source[i]=source[i]; 00126 } 00128 00132 const Element::VectorType& GetTarget() const 00133 { 00134 return m_target; 00135 } 00136 00140 void SetTarget( const vnl_vector<Float>& target) 00141 { 00142 if (m_target.size() != target.size()) 00143 { 00144 m_target.set_size(target.size()); 00145 } 00146 for (unsigned int i=0; i<target.size(); i++) 00147 m_target[i]=target[i]; 00148 } 00150 00151 00152 void ScalePointAndForce( double* spacing, double fwt) 00153 { 00154 for (unsigned int i=0; i<m_target.size(); i++) 00155 { 00156 m_target[i]/=spacing[i]; 00157 m_source[i]/=spacing[i]; 00158 this->eta*=fwt; 00159 } 00160 } 00161 00165 virtual void Read( std::istream& f, void* info ); 00166 00170 virtual void AssignToElement( Element::ArrayType::Pointer elements ); 00171 00175 virtual void Write( std::ostream& f ) const; 00176 00180 LoadLandmark() {} 00181 //LoadLandmark( Element::ConstPointer el_, vnl_vector<Float> pu_ ) : m_pt(pu_), m_element(el_) {} 00183 00184 }; 00185 00186 FEM_CLASS_INIT(LoadLandmark) 00187 00188 00189 00190 00191 }} // end namespace itk::fem 00192 00193 #endif // #ifndef __itkFEMLoadLandmark_h 00194