-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmainloop.cpp
48 lines (34 loc) · 822 Bytes
/
mainloop.cpp
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
#include <stdio.h>
#include <stdlib.h>
#include "DICOMParser.h"
//#include "DICOMAppHelper.h"
#include "DICOMAppHelper.h"
int read_dicom();
int main(int argc, char ** argv)
{
read_dicom();
return 1;
}
int read_dicom()
{
DICOMAppHelper AppHelper;
DICOMParser Parser;
const std::string FileName = "0006.dcm";
Parser.ClearAllDICOMTagCallbacks();
Parser.OpenFile(FileName);
AppHelper.Clear();
AppHelper.RegisterCallbacks(&Parser);
AppHelper.RegisterPixelDataCallback(&Parser);
Parser.ReadHeader();
void* imgData = nullptr;
DICOMParser::VRTypes dataType;
unsigned long imageDataLength;
AppHelper.GetImageData(imgData, dataType, imageDataLength);
if (!imageDataLength)
{
printf("XXXXXXXXXXXXXX\n");
return -1;
}
short aa = *((short *)imgData); // the image data from dcm file
return 1;
}