Medical Imaging Interaction Toolkit  2018.4.99-9a29ffc6
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 
93  itkSetMacro(SpawnType, SpawnType);
94 
95  itkGetMacro(SpawnLocationX, double);
96 
97  itkSetMacro(SpawnLocationX, double);
98  itkGetMacro(SpawnLocationY, double);
99  itkSetMacro(SpawnLocationY, double);
100  itkGetMacro(SpawnLocationZ, double);
101 
102  itkSetMacro(SpawnLocationZ, double);
103 
104  itkGetMacro(SpawnLocationXLength, double);
105 
106  itkSetMacro(SpawnLocationXLength, double);
107  itkGetMacro(SpawnLocationYLength, double);
108  itkSetMacro(SpawnLocationYLength, double);
109  itkGetMacro(SpawnLocationZLength, double);
110 
111  itkSetMacro(SpawnLocationZLength, double);
112 
113  itkGetMacro(SpawnLocationRadius, double);
114 
115  itkSetMacro(SpawnLocationRadius, double);
116  itkGetMacro(Energy, double);
117  itkSetMacro(Energy, double);
118  itkGetMacro(AngleXMinimum, double);
119 
120  itkSetMacro(AngleXMinimum, double);
121 
122  itkGetMacro(AngleXMaximum, double);
123 
124  itkSetMacro(AngleXMaximum, double);
125  itkGetMacro(AngleYMinimum, double);
126  itkSetMacro(AngleYMinimum, double);
127  itkGetMacro(AngleYMaximum, double);
128 
129  itkSetMacro(AngleYMaximum, double);
130 
131  itkGetMacro(AngleXMode, DistributionMode);
132 
133  itkSetMacro(AngleXMode, DistributionMode);
134  itkGetMacro(AngleYMode, DistributionMode);
135  itkSetMacro(AngleYMode, DistributionMode);
136  itkGetMacro(Verbose, bool);
137 
138  itkSetMacro(Verbose, bool);
139 
140  protected:
141 
142  const double TWO_PI = 2.0*3.14159265358979323846;
143 
152 
153  double m_Energy;
154 
161 
162  bool m_IsValid;
163  bool m_Verbose;
164 
166  {
167  double z0;
168  double z1;
169  };
170 
171  void ParsePhotonDirection(TiXmlElement* element);
172  void ParseEnergy(TiXmlElement* element);
173  void ParsePhotonSpawnArea(TiXmlElement* element);
174 
175  TransformResult BoxMuellerTransform(double u1, double u2, double mu, double sigma);
176  };
177  }
178 }
179 #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