X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Example%2FTestCopyDicom.cxx;h=8d386103252e2a5c10f1a966909b1eaf18f0bdde;hb=d00078b5e19310b379c8339fa8fe38362e8ca392;hp=24400816bab017ec246e08936efd8cd927a762b4;hpb=b8ca604b2c1c17790f19ac61b63dfb5b550ac6c0;p=gdcm.git diff --git a/Example/TestCopyDicom.cxx b/Example/TestCopyDicom.cxx index 24400816..8d386103 100644 --- a/Example/TestCopyDicom.cxx +++ b/Example/TestCopyDicom.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestCopyDicom.cxx,v $ Language: C++ - Date: $Date: 2004/11/17 10:20:06 $ - Version: $Revision: 1.13 $ + Date: $Date: 2005/01/20 16:16:58 $ + Version: $Revision: 1.18 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -80,17 +80,17 @@ int main(int argc, char* argv[]) return 1; } } - gdcm::File *original = new gdcm::File( filename ); + gdcm::FileHelper *original = new gdcm::FileHelper( filename ); std::cout << "--- Original ----------------------" << std::endl; //original->GetHeader()->Print(); - gdcm::File *copy = new gdcm::File( output ); - - const gdcm::TagDocEntryHT & Ht = original->GetHeader()->GetTagHT(); + gdcm::FileHelper *copy = new gdcm::FileHelper( output ); size_t dataSize = original->GetImageDataSize(); uint8_t* imageData = original->GetImageData(); + (void)imageData; + (void)dataSize; //First of all copy the header field by field @@ -99,15 +99,12 @@ int main(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 - gdcm::DocEntry* d; - - for (gdcm::TagDocEntryHT::const_iterator tag = Ht.begin(); tag != Ht.end(); ++tag) + gdcm::DocEntry* d=original->GetHeader()->GetFirstEntry(); + while(d) { - d = tag->second; - d->Print(); std::cout << std::endl; if ( gdcm::BinEntry* b = dynamic_cast(d) ) { - copy->GetHeader()->ReplaceOrCreateByNumber( + copy->GetHeader()->ReplaceOrCreate( b->GetBinArea(), b->GetLength(), b->GetGroup(), @@ -116,7 +113,7 @@ int main(int argc, char* argv[]) } else if ( gdcm::ValEntry* v = dynamic_cast(d) ) { - copy->GetHeader()->ReplaceOrCreateByNumber( + copy->GetHeader()->ReplaceOrCreate( v->GetValue(), v->GetGroup(), v->GetElement(), @@ -130,11 +127,9 @@ int main(int argc, char* argv[]) // << d->GetGroup() << " " << d->GetElement() // << std::endl; } - } - - - + d=original->GetHeader()->GetNextEntry(); + } //copy->GetImageData(); //copy->SetImageData(imageData, dataSize);