-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathitkMABMISAtlasXMLFile.h
209 lines (165 loc) · 4.67 KB
/
itkMABMISAtlasXMLFile.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#ifndef __itkMABMISAtlasXMLFile_h
#define __itkMABMISAtlasXMLFile_h
#include "itkXMLFile.h"
#include <string>
#include <vector>
#ifdef _WIN32
static const char FILESEP = '\\';
#else
static const char FILESEP = '/';
#endif
namespace itk
{
class MABMISImageData
{
public:
std::string m_DataDirectory;
std::string m_OutputDirectory;
int m_NumberImageData;
std::vector<std::string> m_ImageFileNames;
std::vector<std::string> m_SegmentationFileNames;
MABMISImageData():
m_DataDirectory(""),
m_OutputDirectory(""),
m_NumberImageData(0),
m_ImageFileNames(0),
m_SegmentationFileNames(0)
{
}
~MABMISImageData()
{
};
};
class MABMISAtlas
{
public:
std::string m_AtlasDirectory;
int m_NumberAllAtlases;
int m_NumberSimulatedAtlases;
std::vector<std::string> m_AtlasFilenames;
std::vector<std::string> m_AtlasSegmentationFilenames;
std::vector<bool> m_IsSimulatedImage;
std::vector<int> m_RealImageIDs;
std::vector<int> m_SimulatedImageIDs;
std::vector<int> m_Tree;
int m_TreeSize;
int m_TreeRoot;
int m_TreeHeight;
MABMISAtlas()
{
m_NumberAllAtlases = 0;
m_NumberSimulatedAtlases = 0;
m_AtlasFilenames.resize(0);
m_Tree.resize(0);
m_TreeSize = 0;
m_TreeRoot = -1;
m_TreeHeight = 0;
};
~MABMISAtlas()
{
};
};
class MABMISImageDataXMLFileReader :
public XMLReader<MABMISImageData>
{
public:
/** Standard typedefs */
typedef MABMISImageDataXMLFileReader Self;
typedef XMLReader<MABMISImageData> Superclass;
typedef SmartPointer<Self> Pointer;
/** Run-time type information (and related methods). */
itkTypeMacro(MABMISImageDataXMLFileReader, XMLReader);
/** Method for creation through the object factory. */
itkNewMacro(Self);
public:
/** Determine if a file can be read */
virtual int CanReadFile(const char *name);
protected:
MABMISImageDataXMLFileReader()
{
m_OutputObject = new itk::MABMISImageData;
m_ImageCount = 0;
m_ImageData = 0;
};
virtual ~MABMISImageDataXMLFileReader()
{
};
virtual void StartElement(const char *name, const char * *atts);
virtual void EndElement(const char *name);
virtual void CharacterDataHandler(const char *inData, int inLength);
private:
MABMISImageDataXMLFileReader(const Self &); // purposely not
// implemented
void operator=(const Self &); // purposely not
// implemented
MABMISImageData* m_ImageData;
std::string m_CurCharacterData;
int m_ImageCount;
};
class MABMISAtlasXMLFileReader :
public XMLReader<MABMISAtlas>
{
public:
/** Standard typedefs */
typedef MABMISAtlasXMLFileReader Self;
typedef XMLReader<MABMISImageData> Superclass;
typedef SmartPointer<Self> Pointer;
/** Run-time type information (and related methods). */
itkTypeMacro(MABMISAtlasXMLFileReader, XMLReader);
/** Method for creation through the object factory. */
itkNewMacro(Self);
virtual void GenerateOutputInformation();
public:
/** Determine if a file can be read */
virtual int CanReadFile(const char *name);
protected:
MABMISAtlasXMLFileReader()
{
m_OutputObject = new itk::MABMISAtlas;
m_Atlas = 0;
};
virtual ~MABMISAtlasXMLFileReader()
{
};
virtual void StartElement(const char *name, const char * *atts);
virtual void EndElement(const char *name);
virtual void CharacterDataHandler(const char *inData, int inLength);
private:
MABMISAtlasXMLFileReader(const Self &); // purposely not
// implemented
void operator=(const Self &); // purposely not
// implemented
MABMISAtlas* m_Atlas;
std::string m_CurCharacterData;
};
class MABMISAtlasXMLFileWriter :
public XMLWriterBase<MABMISAtlas>
{
public:
/** standard typedefs */
typedef XMLWriterBase<MABMISAtlas> Superclass;
typedef MABMISAtlasXMLFileWriter Self;
typedef SmartPointer<Self> Pointer;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(MABMISAtlasXMLFileWriter, XMLWriterBase<MABMISAtlas> );
/** Test whether a file is writable. */
virtual int CanWriteFile(const char *name);
/** Actually write out the file in question */
virtual int WriteFile();
protected:
MABMISAtlasXMLFileWriter()
{
}
virtual ~MABMISAtlasXMLFileWriter()
{
}
private:
MABMISAtlasXMLFileWriter(const Self &); // purposely not
// implemented
void operator=(const Self &); // purposely not
// implemented
};
}
#endif