00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkFEMLoadLandmark.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-01-30 21:10:18 $ 00007 Version: $Revision: 1.12 $ 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 { 00111 m_force[i]=force[i]; 00112 } 00113 } 00115 00116 00120 void SetSource( const vnl_vector<Float>& source) 00121 { 00122 if (m_source.size() != source.size()) 00123 { 00124 m_source.set_size(source.size()); 00125 } 00126 for (unsigned int i=0; i<source.size(); i++) 00127 { 00128 m_source[i]=source[i]; 00129 } 00130 } 00132 00136 const Element::VectorType& GetTarget() const 00137 { 00138 return m_target; 00139 } 00140 00144 void SetTarget( const vnl_vector<Float>& target) 00145 { 00146 if (m_target.size() != target.size()) 00147 { 00148 m_target.set_size(target.size()); 00149 } 00150 for (unsigned int i=0; i<target.size(); i++) 00151 { 00152 m_target[i]=target[i]; 00153 } 00154 } 00156 00157 void ScalePointAndForce( double* spacing, double fwt) 00158 { 00159 for (unsigned int i=0; i<m_target.size(); i++) 00160 { 00161 m_target[i] /= spacing[i]; 00162 m_source[i] /= spacing[i]; 00163 this->eta *= fwt; 00164 } 00165 } 00166 00170 virtual void Read( std::istream& f, void* info ); 00171 00175 virtual void AssignToElement( Element::ArrayType::Pointer elements ); 00176 00180 virtual void Write( std::ostream& f ) const; 00181 00185 LoadLandmark() {} 00186 }; 00187 00188 FEM_CLASS_INIT(LoadLandmark) 00189 00190 }} // end namespace itk::fem 00191 00192 #endif // #ifndef __itkFEMLoadLandmark_h 00193