-
Notifications
You must be signed in to change notification settings - Fork 145
/
rtkElektaXVI5GeometryXMLFileReader.h
120 lines (98 loc) · 3.76 KB
/
rtkElektaXVI5GeometryXMLFileReader.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*=========================================================================
*
* Copyright RTK Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef rtkElektaXVI5GeometryXMLFileReader_h
#define rtkElektaXVI5GeometryXMLFileReader_h
#ifdef _MSC_VER
# pragma warning(disable : 4786)
#endif
#include "RTKExport.h"
#include <itkXMLFile.h>
#include "rtkThreeDCircularProjectionGeometry.h"
namespace rtk
{
/** \class ElektaXVI5GeometryXMLFileReader
*
* Reads an XML-format file of XVI version = 5.0.2 (_Frame.xml in each projection directory). From XVI_v5 on, thre is
* no need of accessing .DBF files (FRAME.DBF / IMAGE.DBF). This class is basically inspired by
* ThreeDCircularProjectionGeometryXMLFileReader. Writer is not implemented. SAD = 1000 mm, SID = 1536 mm are hard-coded
* since _Frame.xml doesn't include these values. Regarding PanelOffset, XVI5 specifies position of the center (UCentre,
* VCentre) instead of offset. Therefore, negation is required to get classical m_ProjectionOffsetX and
* m_ProjectionOffsetY values.
*
* \author Yang K Park ([email protected])
*
* \ingroup RTK IOFilters
*/
class RTK_EXPORT ElektaXVI5GeometryXMLFileReader : public itk::XMLReader<ThreeDCircularProjectionGeometry>
{
public:
ITK_DISALLOW_COPY_AND_MOVE(ElektaXVI5GeometryXMLFileReader);
/** Standard type alias */
using Self = ElektaXVI5GeometryXMLFileReader;
using Superclass = itk::XMLReader<ThreeDCircularProjectionGeometry>;
using Pointer = itk::SmartPointer<Self>;
/** Convenient type alias */
using GeometryType = ThreeDCircularProjectionGeometry;
using GeometryPointer = GeometryType::Pointer;
/** Latest version */
static const unsigned int CurrentVersion = 2;
/** Run-time type information (and related methods). */
#ifdef itkOverrideGetNameOfClassMacro
itkOverrideGetNameOfClassMacro(ElektaXVI5GeometryXMLFileReader);
#else
itkTypeMacro(ElektaXVI5GeometryXMLFileReader, itk::XMLFileReader);
#endif
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Determine if a file can be read */
int
CanReadFile(const char * name) override;
/** Get smart pointer to projection geometry. */
itkGetMacro(Geometry, GeometryPointer);
protected:
ElektaXVI5GeometryXMLFileReader();
~ElektaXVI5GeometryXMLFileReader() override = default;
/** Callback function -- called from XML parser with start-of-element
* information.
*/
void
StartElement(const char * name, const char ** atts) override;
void
StartElement(const char * name);
void
EndElement(const char * name) override;
void
CharacterDataHandler(const char * inData, int inLength) override;
private:
GeometryPointer m_Geometry{ GeometryType::New() };
std::string m_CurCharacterData;
/** Projection parameters */
double m_InPlaneAngle{ 0. };
double m_OutOfPlaneAngle{ 0. };
double m_GantryAngle{ 0. };
double m_SourceToIsocenterDistance{ 1000. };
double m_SourceOffsetX{ 0. };
double m_SourceOffsetY{ 0. };
double m_SourceToDetectorDistance{ 1536. };
double m_ProjectionOffsetX{ 0. };
double m_ProjectionOffsetY{ 0. };
/** Projection matrix */
ThreeDCircularProjectionGeometry::MatrixType m_Matrix;
};
} // namespace rtk
#endif