Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
Medical Imaging Interaction Toolkit
mitkPALightSource.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef MITKPHOTOACOUSTICLIGHTSOURCE_H
14 #define MITKPHOTOACOUSTICLIGHTSOURCE_H
15 
16 #include <mitkCommon.h>
17 
19 
20 //Includes for smart pointer usage
21 #include "mitkCommon.h"
22 #include "itkObject.h"
23 #include "itkMacro.h"
24 
25 #include <tinyxml.h>
26 
27 namespace mitk {
28  namespace pa {
33  class MITKPHOTOACOUSTICSLIB_EXPORT LightSource : public itk::Object
34  {
35  public:
36 
38  itkFactorylessNewMacro(Self)
39  mitkNewMacro2Param(Self, TiXmlElement*, bool)
40 
41  const std::string XML_TAG_X_ANGLE = "xAngle";
42  const std::string XML_TAG_Y_ANGLE = "yAngle";
43  const std::string XML_TAG_PHOTON_DIRECTION = "PhotonDirection";
44  const std::string XML_TAG_MINIMUM = "min";
45  const std::string XML_TAG_MAXIMUM = "max";
46  const std::string XML_TAG_MODE = "mode";
47  const std::string XML_TAG_ENERGY = "energy";
48  const std::string XML_TAG_SPAWN_TYPE = "SpawnType";
49  const std::string XML_TAG_SPAWN_TYPE_POINT = "POINT";
50  const std::string XML_TAG_SPAWN_TYPE_RECTANGLE = "RECTANGLE";
51  const std::string XML_TAG_SPAWN_TYPE_CIRCLE = "CIRCLE";
52  const std::string XML_TAG_X = "x";
53  const std::string XML_TAG_Y = "y";
54  const std::string XML_TAG_Z = "z";
55  const std::string XML_TAG_R = "r";
56  const std::string XML_TAG_X_LENGTH = "xLength";
57  const std::string XML_TAG_Y_LENGTH = "yLength";
58  const std::string XML_TAG_Z_LENGTH = "zLength";
59 
60  enum SpawnType
61  {
62  POINT, RECTANGLE, CIRCLE
63  };
64 
66  {
67  UNIFORM, GAUSSIAN
68  };
69 
71  {
72  double xPosition;
73  double yPosition;
74  double zPosition;
75  double xAngle;
76  double yAngle;
77  double zAngle;
78  };
79 
80  PhotonInformation GetNextPhoton(double rnd1, double rnd2, double rnd3,
81  double rnd4, double rnd5, double gau1, double gau2);
82 
83  bool IsValid();
84 
85  LightSource(TiXmlElement* element, bool verbose);
86  LightSource();
87  ~LightSource() override;
88 
89  void ParseAngle(TiXmlElement* direction, std::string angle);
90 
91  itkGetMacro(SpawnType, SpawnType)
92  itkSetMacro(SpawnType, SpawnType)
93 
94  itkGetMacro(SpawnLocationX, double)
95  itkSetMacro(SpawnLocationX, double)
96 
97  itkGetMacro(SpawnLocationY, double)
98  itkSetMacro(SpawnLocationY, double)
99 
100  itkGetMacro(SpawnLocationZ, double)
101  itkSetMacro(SpawnLocationZ, double)
102 
103  itkGetMacro(SpawnLocationXLength, double)
104  itkSetMacro(SpawnLocationXLength, double)
105 
106  itkGetMacro(SpawnLocationYLength, double)
107  itkSetMacro(SpawnLocationYLength, double)
108 
109  itkGetMacro(SpawnLocationZLength, double)
110  itkSetMacro(SpawnLocationZLength, double)
111 
112  itkGetMacro(SpawnLocationRadius, double)
113  itkSetMacro(SpawnLocationRadius, double)
114 
115  itkGetMacro(Energy, double)
116  itkSetMacro(Energy, double)
117 
118  itkGetMacro(AngleXMinimum, double)
119  itkSetMacro(AngleXMinimum, double)
120 
121  itkGetMacro(AngleXMaximum, double)
122  itkSetMacro(AngleXMaximum, double)
123 
124  itkGetMacro(AngleYMinimum, double)
125  itkSetMacro(AngleYMinimum, double)
126 
127  itkGetMacro(AngleYMaximum, double)
128  itkSetMacro(AngleYMaximum, double)
129 
130  itkGetMacro(AngleXMode, DistributionMode)
131  itkSetMacro(AngleXMode, DistributionMode)
132 
133  itkGetMacro(AngleYMode, DistributionMode)
134  itkSetMacro(AngleYMode, DistributionMode)
135 
136  itkGetMacro(Verbose, bool)
137  itkSetMacro(Verbose, bool)
138 
139  protected:
140 
141  const double TWO_PI = 2.0*3.14159265358979323846;
142 
151 
152  double m_Energy;
153 
160 
161  bool m_IsValid;
162  bool m_Verbose;
163 
165  {
166  double z0;
167  double z1;
168  };
169 
170  void ParsePhotonDirection(TiXmlElement* element);
171  void ParseEnergy(TiXmlElement* element);
172  void ParsePhotonSpawnArea(TiXmlElement* element);
173 
174  TransformResult BoxMuellerTransform(double u1, double u2, double mu, double sigma);
175  };
176  }
177 }
178 #endif // MITKPHOTOACOUSTICLIGHTSOURCE_H
DataCollection - Class to facilitate loading/accessing structured data.
#define mitkNewMacro2Param(classname, typea, typeb)
Definition: mitkCommon.h:85
DistributionMode m_AngleXMode
The LightSource class The representation of a LightSource.
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:49
bool verbose(false)
DistributionMode m_AngleYMode
#define MITKPHOTOACOUSTICSLIB_EXPORT