1 #ifndef DIG_FILE_SNARK_REC_H
2 #define DIG_FILE_SNARK_REC_H
5 #include <DIGFile/DIGFile.h>
7 ///////////////////////////////////////////////
8 // DIGFileSnarkRec main header
9 ///////////////////////////////////////////////
15 unsigned int Dimensions;
20 ///////////////////////////////////////////////
21 // DIGFileSnarkRec phantom header
22 ///////////////////////////////////////////////
31 ///////////////////////////////////////////////
32 // DIGFileSnarkRec Reconstruction Set header
33 ///////////////////////////////////////////////
43 ///////////////////////////////////////////////
44 // DIGFileSnarkRec Reconstruction header
45 ///////////////////////////////////////////////
54 ///////////////////////////////////////////////
56 ///////////////////////////////////////////////
58 class DIGFileSnarkRec: protected DIGFile {
61 static const char* TypeStr;
62 static const char* SchemaStr;
77 int Open(const char* pFileName, RecFileMH* pMainHeader);
79 const char* pFileName, // File Name
80 const char* pProjName, // Projection Name
81 unsigned int pNoOfElements, // NELEM
82 double pSampling, // PIXSIZ
83 const char* pComments // Comments
86 // Updating main header after opening file to write
88 int SetProjName(const char* pProjName) {
89 return DIGFile::SetTitle(pProjName);
92 int SetComment(const char* pComment) {
93 return DIGFile::SetComment(pComment);
98 int AppendPhanom(RecFilePhanomH* pPhanomHeader, double* pData);
99 int AppendPhantom(const char* pPhanomName, const char* pComment, double* pData);
101 // Appending reconstruction set
103 int AppendRecSet(RecFileRecSetH* pRecHeader);
104 int AppendRecSet(const char* pAlgName, const char* pName, const char* pComment);
106 // Appending reconstruction
108 int AppendRec(RecFileRecH* pRecHeader, double* pData);
109 int AppendRec(unsigned int pCount, const char* pComment, double* pData);
117 int Open(const char* pFileName);
119 // Reading file parameters
121 int GetPhantomPresent(bool* pPhantomPresent) {
122 *pPhantomPresent = PhantomPresent;
126 int GetNoOfPixels(unsigned int* pNoOfPixels) {
127 return DIGFile::GetArrayNoOfItems(pNoOfPixels);
130 int GetNoOfRecSets(unsigned int* pNoOfRecSets) {
132 unsigned int NoOfRecSets;
134 if((ret = DIGFile::GetNoOfArraySets(&NoOfRecSets)) != 0) {
139 *pNoOfRecSets = NoOfRecSets - 1;
142 *pNoOfRecSets = NoOfRecSets;
148 int GetNoOfRecs(unsigned int* pNoOfRec) {
149 return GetNoOfArrays(pNoOfRec);
154 int SelectRecSet(unsigned int pRecSetNo) {
156 return SelectArraySet(pRecSetNo + 1);
159 return SelectArraySet(pRecSetNo);
163 int SelectRec(unsigned int pRecNo) {
164 return SelectArray(pRecNo);
167 // Reading main header
169 int GetMainHeader(RecFileMH* pMainHeader);
171 int GetProjName(const char** pProjName) {
172 return DIGFile::GetTitle(pProjName);
175 int GetEndian(DIGEndian* pEndian) {
176 return DIGFile::GetEndian(pEndian);
179 int GetDimensions(unsigned int* pDimensions) {
180 const DIGDimensions* Dimensions;
183 if((ret = DIGFile::GetDimensions(&Dimensions)) != 0) {
187 *pDimensions = Dimensions->x;
192 int GetSampling(double* pSampling) {
193 const DIGSampling* Sampling;
196 if((ret = DIGFile::GetSamplingX(&Sampling)) != 0) {
200 *pSampling = Sampling->x;
205 int GetComment(const char** pComment) {
206 return DIGFile::GetComment(pComment);
209 // Reading phantom header
211 int GetPhantomHeader(RecFilePhanomH* pPhantomHeader);
213 int GetPhantomName(const char** pPhantomName);
214 int GetPhantomComment(const char** pPhantomComment);
216 // Reading phantom data
218 int GetPhantomData(void* pPhantomData);
220 // Reading reconstruction set header
222 int GetRecSetHeader(RecFileRecSetH* pRecSetHeader);
224 int GetRecSetName(const char** pRecName); // title
225 int GetRecSetAlgName(const char** pAlgName); // type
226 int GetRecSetComment(const char** pComment);
228 // Reading reconstruction header
230 int GetRecHeader(RecFileRecH* pRecHeader);
232 int GetRecCount(unsigned int* pCount);
233 int GetRecComment(const char** pComment);
235 // Reading reconstruction data
237 int GetRecData(void* pRecData) {
238 return DIGFile::GetArrayData(pRecData);
241 ///////////////////////////////////////////////////
244 return DIGFile::Close();
249 #endif // DIG_FILE_SNARK_REC_H