RTK
2.6.0
Reconstruction Toolkit
RTK
include
rtkXimImageIO.h
Go to the documentation of this file.
1
/*=========================================================================
2
*
3
* Copyright RTK Consortium
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* https://www.apache.org/licenses/LICENSE-2.0.txt
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
16
*
17
*=========================================================================*/
18
19
#ifndef rtkXimImageIO_h
20
#define rtkXimImageIO_h
21
22
#include "RTKExport.h"
23
#include "
rtkMacro.h
"
24
25
// itk include
26
#include <
itkImageIOBase.h
>
27
28
#if defined(_MSC_VER) && (_MSC_VER < 1600)
29
// SR: taken from
30
//#include "msinttypes/stdint.h"
31
#else
32
# include <cstdint>
33
#endif
34
35
namespace
rtk
36
{
37
47
class
RTK_EXPORT
XimImageIO
:
public
itk::ImageIOBase
48
{
49
public
:
51
using
Self
=
XimImageIO
;
52
using
Superclass
=
itk::ImageIOBase
;
53
using
Pointer
=
itk::SmartPointer<Self>
;
54
using
PixelType
=
signed
short
int;
55
using
Int4
= itk::int32_t;
// int of 4 bytes as in xim docs
56
57
typedef
struct
xim_header
58
{
59
// Actual Header:
60
char
sFileType[32];
61
Int4
FileVersion
;
62
Int4
SizeX
;
63
Int4
SizeY
;
64
Int4
dBitsPerPixel
;
65
Int4
dBytesPerPixel
;
66
Int4
dCompressionIndicator
;
67
Int4
lookUpTableSize
;
68
Int4
compressedPixelBufferSize
;
69
Int4
unCompressedPixelBufferSize
;
70
// Header after pixel-data:
71
Int4
binsInHistogram
;
72
Int4
*
histogramData
;
73
Int4
numberOfProperties
;
74
unsigned
int
nPixelOffset
;
75
double
dCollX1
;
76
double
dCollX2
;
77
double
dCollY1
;
78
double
dCollY2
;
79
double
dCollRtn
;
80
double
dCouchVrt
;
81
double
dCouchLng
;
82
double
dCouchLat
;
83
double
dIDUResolutionX
;
// MUST BE CALCULATED
84
double
dIDUResolutionY
;
//
85
double
dImageResolutionX
;
//
86
double
dImageResolutionY
;
//
87
double
dEnergy
;
88
double
dDoseRate
;
89
double
dXRayKV
;
90
double
dXRayMA
;
91
double
dCTProjectionAngle
;
// KVSourceRtn in file
92
double
dDetectorOffsetX
;
// KVDetectorLat
93
double
dDetectorOffsetY
;
// KVDetectorLng
94
double
dCTNormChamber
;
95
double
dGatingTimeTag
;
96
double
dGating4DInfoX
;
97
double
dGating4DInfoY
;
98
double
dGating4DInfoZ
;
99
// double dGating4DInfoTime;
100
}
Xim_header
;
101
102
XimImageIO
()
103
:
Superclass
()
104
{}
105
107
itkNewMacro(
Self
);
108
110
#ifdef itkOverrideGetNameOfClassMacro
111
itkOverrideGetNameOfClassMacro(
XimImageIO
);
112
#else
113
itkTypeMacro(
XimImageIO
,
itk::ImageIOBase
);
114
#endif
115
116
117
/*-------- This part of the interface deals with reading data. ------ */
118
void
119
ReadImageInformation()
override
;
120
121
bool
122
CanReadFile(
const
char
* FileNameToRead)
override
;
123
124
void
125
Read(
void
* buffer)
override
;
126
127
/*-------- This part of the interfaces deals with writing data. ----- */
128
virtual
void
129
WriteImageInformation
(
bool
/*keepOfStream*/
)
130
{}
131
132
void
133
WriteImageInformation
()
override
134
{
135
WriteImageInformation(
false
);
136
}
137
138
bool
139
CanWriteFile(
const
char
* filename)
override
;
140
141
void
142
Write(
const
void
* buffer)
override
;
143
144
private
:
145
template
<
typename
T>
146
size_t
147
SetPropertyValue(
char
* property_name, Int4 value_length, FILE * fp, Xim_header * xim);
148
149
int
m_ImageDataStart
;
150
Int4
m_BytesPerPixel
;
151
152
};
// end class XimImageIO
153
154
}
// namespace rtk
155
156
#endif
/* end #define __rtkXimImageIO_h */
rtk::XimImageIO::xim_header::FileVersion
Int4 FileVersion
Definition:
rtkXimImageIO.h:61
rtk::XimImageIO::xim_header::dBytesPerPixel
Int4 dBytesPerPixel
Definition:
rtkXimImageIO.h:65
rtk::XimImageIO::xim_header::SizeX
Int4 SizeX
Definition:
rtkXimImageIO.h:62
rtk::XimImageIO::Int4
itk::int32_t Int4
Definition:
rtkXimImageIO.h:55
rtk::XimImageIO::xim_header::compressedPixelBufferSize
Int4 compressedPixelBufferSize
Definition:
rtkXimImageIO.h:68
itk::ImageIOBase
rtk::XimImageIO::xim_header::dCollX1
double dCollX1
Definition:
rtkXimImageIO.h:75
rtk::XimImageIO::xim_header::dCouchLat
double dCouchLat
Definition:
rtkXimImageIO.h:82
rtk::XimImageIO::PixelType
signed short int PixelType
Definition:
rtkXimImageIO.h:54
rtk::XimImageIO::xim_header::nPixelOffset
unsigned int nPixelOffset
Definition:
rtkXimImageIO.h:74
rtk::XimImageIO::xim_header::dGating4DInfoY
double dGating4DInfoY
Definition:
rtkXimImageIO.h:97
rtk
Definition:
rtkMatlabSparseMatrix.h:24
AddImageFilter
rtkMacro.h
itkImageIOBase.h
rtk::XimImageIO::XimImageIO
XimImageIO()
Definition:
rtkXimImageIO.h:102
rtk::XimImageIO::xim_header::dDetectorOffsetY
double dDetectorOffsetY
Definition:
rtkXimImageIO.h:93
rtk::XimImageIO::xim_header::dCollRtn
double dCollRtn
Definition:
rtkXimImageIO.h:79
rtk::XimImageIO::xim_header::dGating4DInfoZ
double dGating4DInfoZ
Definition:
rtkXimImageIO.h:98
rtk::XimImageIO
Class for reading Xim Image file format.
Definition:
rtkXimImageIO.h:47
rtk::XimImageIO::WriteImageInformation
void WriteImageInformation() override
Definition:
rtkXimImageIO.h:133
rtk::XimImageIO::xim_header::dGatingTimeTag
double dGatingTimeTag
Definition:
rtkXimImageIO.h:95
rtk::XimImageIO::xim_header::dEnergy
double dEnergy
Definition:
rtkXimImageIO.h:87
rtk::XimImageIO::xim_header::dImageResolutionY
double dImageResolutionY
Definition:
rtkXimImageIO.h:86
rtk::XimImageIO::xim_header::dCollY1
double dCollY1
Definition:
rtkXimImageIO.h:77
rtk::XimImageIO::xim_header::dDoseRate
double dDoseRate
Definition:
rtkXimImageIO.h:88
rtk::XimImageIO::xim_header::binsInHistogram
Int4 binsInHistogram
Definition:
rtkXimImageIO.h:71
rtk::XimImageIO::xim_header::dCTNormChamber
double dCTNormChamber
Definition:
rtkXimImageIO.h:94
rtk::XimImageIO::xim_header::dCTProjectionAngle
double dCTProjectionAngle
Definition:
rtkXimImageIO.h:91
rtk::XimImageIO::xim_header::dBitsPerPixel
Int4 dBitsPerPixel
Definition:
rtkXimImageIO.h:64
rtk::XimImageIO::xim_header::dCouchVrt
double dCouchVrt
Definition:
rtkXimImageIO.h:80
rtk::XimImageIO::xim_header::dImageResolutionX
double dImageResolutionX
Definition:
rtkXimImageIO.h:85
rtk::XimImageIO::xim_header::dXRayMA
double dXRayMA
Definition:
rtkXimImageIO.h:90
rtk::XimImageIO::xim_header::lookUpTableSize
Int4 lookUpTableSize
Definition:
rtkXimImageIO.h:67
rtk::XimImageIO::xim_header::dCollX2
double dCollX2
Definition:
rtkXimImageIO.h:76
rtk::XimImageIO::m_BytesPerPixel
Int4 m_BytesPerPixel
Definition:
rtkXimImageIO.h:150
rtk::XimImageIO::xim_header::dDetectorOffsetX
double dDetectorOffsetX
Definition:
rtkXimImageIO.h:92
rtk::XimImageIO::xim_header::dCollY2
double dCollY2
Definition:
rtkXimImageIO.h:78
rtk::XimImageIO::xim_header::dCouchLng
double dCouchLng
Definition:
rtkXimImageIO.h:81
rtk::XimImageIO::xim_header::SizeY
Int4 SizeY
Definition:
rtkXimImageIO.h:63
rtk::XimImageIO::m_ImageDataStart
int m_ImageDataStart
Definition:
rtkXimImageIO.h:149
rtk::XimImageIO::WriteImageInformation
virtual void WriteImageInformation(bool)
Definition:
rtkXimImageIO.h:129
rtk::XimImageIO::xim_header::dIDUResolutionX
double dIDUResolutionX
Definition:
rtkXimImageIO.h:83
rtk::XimImageIO::xim_header::dGating4DInfoX
double dGating4DInfoX
Definition:
rtkXimImageIO.h:96
rtk::XimImageIO::xim_header::dIDUResolutionY
double dIDUResolutionY
Definition:
rtkXimImageIO.h:84
rtk::XimImageIO::xim_header::unCompressedPixelBufferSize
Int4 unCompressedPixelBufferSize
Definition:
rtkXimImageIO.h:69
itk::LightProcessObject
itk::SmartPointer< Self >
rtk::XimImageIO::xim_header::dCompressionIndicator
Int4 dCompressionIndicator
Definition:
rtkXimImageIO.h:66
rtk::XimImageIO::xim_header::histogramData
Int4 * histogramData
Definition:
rtkXimImageIO.h:72
rtk::XimImageIO::xim_header::dXRayKV
double dXRayKV
Definition:
rtkXimImageIO.h:89
rtk::XimImageIO::xim_header
Definition:
rtkXimImageIO.h:57
rtk::XimImageIO::xim_header::numberOfProperties
Int4 numberOfProperties
Definition:
rtkXimImageIO.h:73
Generated on Sun Dec 22 2024 07:41:41 for RTK by
1.8.14