5 int main(int argc, char* argv[])
13 void* imageData, *imageData2;
14 int dataSize, dataSize2;
18 std::cerr << "Usage " << argv[0] << " image.dcm" << std::endl;
24 // --------------------- we read the input image
27 e1 = new gdcmHeader(toto, false, true);
28 if (!e1->IsReadable()) {
29 std::cerr << "Sorry, " << toto <<" not a Readable DICOM / ACR File"
34 f1 = new gdcmFile(e1);
35 imageData= f1->GetImageData();
36 dataSize = f1->GetImageDataSize();
38 // --------------------- we write it as an Explicit VR DICOM file
40 sprintf(zozo, "temp.XDCM" );
41 std::cout << "WriteDCM Explicit VR" << std::endl;
42 f1->WriteDcmExplVR(zozo);
44 // --------------------- we read the written image
46 e2 = new gdcmHeader(zozo, false, true);
47 if (!e2->IsReadable()) {
48 std::cerr << "Sorry, " << zozo << " not a Readable DICOM / ACR File"
52 f2 = new gdcmFile(e2);
53 imageData2= f2->GetImageData();
54 dataSize2 = f2->GetImageDataSize();
56 // --------------------- we compare the pixel areas
58 if (dataSize != dataSize2) {
59 std::cout << " ----------------------------------------- "
60 << "Bad shot! Lengthes are different : "
61 << dataSize << " # " << dataSize2
62 << " for file : " << toto << std::endl;
66 if (int res=memcmp(imageData,imageData2,dataSize) !=0) {
67 std::cout << " ----------------------------------------- "
68 << "Bad shot! Pixels are different : "
69 << " for file : " << toto << std::endl;
70 std::cout << "memcmp(imageData,imageData2,dataSize) = " << res << std::endl;
74 //If we reach here everythin is fine, return 0 then: