Toast++  1.0.2 (r.539)
Forward and inverse modelling in optical tomography
projector.h
1 #ifndef PROJECTOR_H
2 #define PROJECTOR_H
3 
4 
5 #include "stoastlib.h"
6 #include "slu_zdefs.h"
7 //#include "supermatrix.h"
8 #include "camera.h"
9 
10 #if (defined(WIN32)||defined(WIN64))
11 //#include <windows.h>
12 #endif
13 #include "GL/gl.h"
14 #include "GL/osmesa.h"
15 
16 class STOASTLIB Projector
17 {
18  public:
19  Projector() {}
20  Projector(Camera * cam, QMMesh * mesh);
21  void init(Camera * cam, QMMesh * mesh);
22 
23  // Masked
24  void projectFieldToImage(const RVector & field, RVector & image, RCompRowMatrix & mask)
25  {
26  //RVector fld(field.Dim(), 1.0);
27  image = mask * toImage * field;
28  }
29  void projectImageToField(const RVector & image, RVector & field, RCompRowMatrix & maskT)
30  {
31  //RVector img(image.Dim(), 1.0);
32  field = toField * (maskT * image);
33  }
34 
35  // Unmasked
36  void projectFieldToImage(const RVector & field, RVector & image)
37  {
38  //RVector fld(field.Dim(), 1.0);
39  image = toImage * field;
40  }
41  void projectImageToField(const RVector & image, RVector & field)
42  {
43  //RVector img(image.Dim(), 1.0);
44  field = toField * image;
45  }
46  void mapToData(const RVector & field, RVector & data)
47  {
48  //data = toData * field;
49  }
50  void getBoundaryNodes();
51  int getImageWidth() { return w; }
52  int getImageHeight() { return h; }
53  IVector getImageDim() { IVector i(2); i[0]=w; i[1]=h; return i; }
54  int getImageSize() {return nImagePts;}
55 
56  protected:
57  QMMesh * FEMMesh;
58  Camera * camera;
59  int * bndNodes;
60  int w, h, nImagePts, nBndNodes, nNodes;
61  RCompRowMatrix toImage, toField; //, toData;
62  virtual void constructMatrix()=0;
63 };
64 
65 class RayProjector : public Projector
66 {
67  public:
68  RayProjector() {}
69  RayProjector(Camera * cam, QMMesh * mesh);
70  void init(Camera * cam, QMMesh * mesh);
71  void constructMatrix();
72  protected:
73  int intersectBoundary(const RVector & ray);
74 };
75 
76 
77 #endif
Definition: projector.h:16
Definition: projector.h:65
Definition: qmmesh.h:22
Definition: camera.h:6