X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Testing%2FTestCopyDicom.cxx;h=3689353aa348185eae3cc2f8269ff993caec710e;hb=1db4734a7dfefbf5b9e8e3e7b102b36ab68d8243;hp=5b35c48bd57c22bf2cc8dc365f98fa28d81a4b01;hpb=f7f4b2e2843f917ac08f9fdc58fc23ca44d8a14d;p=gdcm.git diff --git a/Testing/TestCopyDicom.cxx b/Testing/TestCopyDicom.cxx index 5b35c48b..3689353a 100644 --- a/Testing/TestCopyDicom.cxx +++ b/Testing/TestCopyDicom.cxx @@ -9,6 +9,8 @@ #ifndef _WIN32 #include //for access, unlink +#else +#include //for _access on Win32 #endif // return true if the file exists @@ -41,7 +43,7 @@ bool RemoveFile(const char* source) // Here we load a gdcmFile and then try to create from scratch a copy of it, // copying field by field the dicom image -int TestCopyDicom(int argc, char* argv[]) +int TestCopyDicom(int , char* []) { int i =0; int retVal = 0; //by default this is an error @@ -64,10 +66,13 @@ int TestCopyDicom(int argc, char* argv[]) } } - gdcmFile *original = new gdcmFile( filename ); - gdcmFile *copy = new gdcmFile( output ); + gdcm::File *original = new gdcm::File( filename ); + gdcm::File *copy = new gdcm::File( output ); - TagDocEntryHT & Ht = original->GetHeader()->GetEntry(); + const gdcm::TagDocEntryHT & Ht = original->GetHeader()->GetTagHT(); + + size_t dataSize = original->GetImageDataSize(); + uint8_t* imageData = original->GetImageData(); //First of all copy the header field by field @@ -76,41 +81,38 @@ int TestCopyDicom(int argc, char* argv[]) // (the user does NOT have to know the way we implemented the Header !) // Waiting for a 'clean' solution, I keep the method ...JPRx - gdcmDocEntry* d; + gdcm::DocEntry* d; - for (TagDocEntryHT::iterator tag = Ht.begin(); tag != Ht.end(); ++tag) + for (gdcm::TagDocEntryHT::const_iterator tag = Ht.begin(); tag != Ht.end(); ++tag) { d = tag->second; - if ( gdcmBinEntry* b = dynamic_cast(d) ) + if ( gdcm::BinEntry* b = dynamic_cast(d) ) { copy->GetHeader()->ReplaceOrCreateByNumber( - b->GetVoidArea(), + b->GetBinArea(), b->GetLength(), b->GetGroup(), b->GetElement(), b->GetVR() ); - } - else if ( gdcmValEntry* v = dynamic_cast(d) ) - { - copy->GetHeader()->ReplaceOrCreateByNumber( + } + else if ( gdcm::ValEntry* v = dynamic_cast(d) ) + { + copy->GetHeader()->ReplaceOrCreateByNumber( v->GetValue(), v->GetGroup(), v->GetElement(), v->GetVR() ); - } - else - { + } + else + { // We skip pb of SQ recursive exploration //std::cout << "Skipped Sequence " // << "------------- " << d->GetVR() << " "<< std::hex // << d->GetGroup() << " " << d->GetElement() // << std::endl; - } + } } - size_t dataSize = original->GetImageDataSize(); - void *imageData = original->GetImageData(); - copy->SetImageData(imageData, dataSize); original->GetHeader()->SetImageDataSize(dataSize); @@ -119,7 +121,7 @@ int TestCopyDicom(int argc, char* argv[]) delete original; delete copy; - copy = new gdcmFile( output ); + copy = new gdcm::File( output ); //Is the file written still gdcm parsable ? if ( !copy->GetHeader()->IsReadable() )