PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
LinearObject.h
Go to the documentation of this file.
1 /*=Plus=header=begin======================================================
2 Program: Plus
3 Copyright (c) Laboratory for Percutaneous Surgery. All rights reserved.
4 See License.txt for details.
5 =========================================================Plus=header=end*/
6 
7 #ifndef LINEAROBJECT_H
8 #define LINEAROBJECT_H
9 
10 #include "vtkXMLDataElement.h"
11 #include <cmath>
12 #include <sstream>
13 #include <string>
14 #include <vector>
15 
16 // This class stores a vector of values and a string label
18 {
19 public:
20  std::string Name;
21  std::string Type;
22  std::vector<double> Signature;
23  std::vector<double> BasePoint;
24 
25  static const int DIMENSION = 3;
26 
27 public:
28  LinearObject();
29  virtual ~LinearObject();
30 
31  double DistanceToVector( std::vector<double> vector );
32 
33  // TODO: This should be abstract, but I can't get this to work right now
34  // We can just avoid using this class directly for now
35  virtual std::vector<double> ProjectVector( std::vector<double> vector ) = 0;
36  virtual void Translate( std::vector<double> vector ) = 0;
37 
38  virtual std::string ToXMLString() const = 0;
39  virtual void FromXMLElement( vtkXMLDataElement* element ) = 0;
40 
41 public:
42  static double Distance( std::vector<double> v1, std::vector<double> v2 );
43  static double Norm( std::vector<double> vector );
44  static double Dot( std::vector<double> v1, std::vector<double> v2 );
45  static std::vector<double> Cross( std::vector<double> v1, std::vector<double> v2 );
46 
47  static std::vector<double> Add( std::vector<double> v1, std::vector<double> v2 );
48  static std::vector<double> Subtract( std::vector<double> v1, std::vector<double> v2 );
49  static std::vector<double> Multiply( double c, std::vector<double> vector );
50 
51  static std::string VectorToString( std::vector<double> vector );
52  static std::vector<double> StringToVector( std::string s, int size );
53 
54 };
55 
56 #endif
57 
58 //ETX
static double Distance(std::vector< double > v1, std::vector< double > v2)
static double Norm(std::vector< double > vector)
static std::vector< double > Add(std::vector< double > v1, std::vector< double > v2)
std::vector< double > BasePoint
Definition: LinearObject.h:23
virtual std::vector< double > ProjectVector(std::vector< double > vector)=0
static const int DIMENSION
Definition: LinearObject.h:25
virtual ~LinearObject()
static double Dot(std::vector< double > v1, std::vector< double > v2)
virtual std::string ToXMLString() const =0
std::vector< double > Signature
Definition: LinearObject.h:22
virtual void FromXMLElement(vtkXMLDataElement *element)=0
virtual void Translate(std::vector< double > vector)=0
double DistanceToVector(std::vector< double > vector)
static std::vector< double > StringToVector(std::string s, int size)
static std::string VectorToString(std::vector< double > vector)
std::string Name
Definition: LinearObject.h:20
static std::vector< double > Cross(std::vector< double > v1, std::vector< double > v2)
static std::vector< double > Multiply(double c, std::vector< double > vector)
static std::vector< double > Subtract(std::vector< double > v1, std::vector< double > v2)
std::string Type
Definition: LinearObject.h:21