X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Example%2FWriteRead.cxx;h=2f247d923074903fca4ace5e748f82a564d187d2;hb=9ca888585c371145bae465d9f5d0cc6c7a95b3b5;hp=7e75baaeee21c00110375660d4e32b81a310145d;hpb=ba78e6c6d47d6db1528e8e88e5ebde7296a26692;p=gdcm.git diff --git a/Example/WriteRead.cxx b/Example/WriteRead.cxx index 7e75baae..2f247d92 100644 --- a/Example/WriteRead.cxx +++ b/Example/WriteRead.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: WriteRead.cxx,v $ Language: C++ - Date: $Date: 2004/12/03 20:16:56 $ - Version: $Revision: 1.9 $ + Date: $Date: 2005/07/08 12:02:02 $ + Version: $Revision: 1.14 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -15,18 +15,19 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#include "gdcmHeader.h" #include "gdcmFile.h" +#include "gdcmFileHelper.h" #include -int main(int argc, char* argv[]) +int main(int argc, char *argv[]) { - std::string zozo; - - gdcm::Header* e1, *e2; - gdcm::File * f1, *f2; + std::string fileNameToWrite; + gdcm::File *e1; + gdcm::File *e2; + gdcm::FileHelper *f1; + gdcm::FileHelper *f2; uint8_t* imageData, *imageData2; int dataSize, dataSize2; @@ -36,38 +37,40 @@ int main(int argc, char* argv[]) return 1; } - std::string toto = argv[1]; + std::string fileName = argv[1]; // --------------------- we read the input image std::cout << argv[1] << std::endl; - - e1 = new gdcm::Header( toto ); + e1 = new gdcm::File( ); + e1->SetFileName( fileName ); + e1->Load(); if (!e1->IsReadable()) { - std::cerr << "Sorry, " << toto <<" not a Readable DICOM / ACR File" + std::cerr << "Sorry, " << fileName <<" not a Readable DICOM / ACR File" <GetImageData(); dataSize = f1->GetImageDataSize(); // --------------------- we write it as an Explicit VR DICOM file - zozo = "temp.XDCM"; + fileNameToWrite = "temp.XDCM"; std::cout << "WriteDCM Explicit VR" << std::endl; - f1->WriteDcmExplVR(zozo); + f1->WriteDcmExplVR(fileNameToWrite); // --------------------- we read the written image - - e2 = new gdcm::Header( zozo ); + e2 = new gdcm::File( ); + e2->SetFileName( fileNameToWrite ); + e2->Load(); if (!e2->IsReadable()) { - std::cerr << "Sorry, " << zozo << " not a Readable DICOM / ACR File" + std::cerr << "Sorry, " << fileNameToWrite << " not a Readable DICOM / ACR File" <GetImageData(); dataSize2 = f2->GetImageDataSize(); @@ -77,14 +80,14 @@ int main(int argc, char* argv[]) std::cout << " ----------------------------------------- " << "Bad shot! Lengthes are different : " << dataSize << " # " << dataSize2 - << " for file : " << toto << std::endl; + << " for file : " << fileName << std::endl; return 0; } if (int res=memcmp(imageData,imageData2,dataSize) !=0) { std::cout << " ----------------------------------------- " << "Bad shot! Pixels are different : " - << " for file : " << toto << std::endl; + << " for file : " << fileName << std::endl; std::cout << "memcmp(imageData,imageData2,dataSize) = " << res << std::endl; return 1; }