X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Example%2FTestCopyDicom.cxx;h=b13d002e31c7e4ee7879e9ecccd314b187fb6909;hb=7f5f66f57c85e30920d807612d32a65800cb1df0;hp=f0f7c23388d3618ccecbdc3f9ba77658297a5df5;hpb=fc239ceba8ddb5fa780db670635559cab5d0d7bb;p=gdcm.git diff --git a/Example/TestCopyDicom.cxx b/Example/TestCopyDicom.cxx index f0f7c233..b13d002e 100644 --- a/Example/TestCopyDicom.cxx +++ b/Example/TestCopyDicom.cxx @@ -1,3 +1,20 @@ +/*========================================================================= + + Program: gdcm + Module: $RCSfile: TestCopyDicom.cxx,v $ + Language: C++ + Date: $Date: 2004/11/19 08:37:55 $ + 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 + http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ #include "gdcmHeader.h" #include "gdcmFile.h" #include "gdcmDocument.h" @@ -6,6 +23,8 @@ #ifndef _WIN32 #include //for access, unlink +#else +#include //for _access #endif // return true if the file exists @@ -47,6 +66,8 @@ int main(int argc, char* argv[]) return 1; } +// don't modify identation in order to let this source xdiffable with ../Test + std::string filename = argv[1]; std::string output = argv[2]; @@ -59,17 +80,19 @@ int main(int argc, char* argv[]) return 1; } } - gdcmFile *original = new gdcmFile( filename ); + gdcm::File *original = new gdcm::File( filename ); std::cout << "--- Original ----------------------" << std::endl; //original->GetHeader()->Print(); - gdcmFile *copy = new gdcmFile( output ); + gdcm::File *copy = new gdcm::File( output ); - TagDocEntryHT & Ht = original->GetHeader()->GetEntry(); + const gdcm::TagDocEntryHT & Ht = original->GetHeader()->GetTagHT(); size_t dataSize = original->GetImageDataSize(); - void *imageData = original->GetImageData(); + uint8_t* imageData = original->GetImageData(); + (void)imageData; + (void)dataSize; //First of all copy the header field by field @@ -78,22 +101,22 @@ 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 - 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; d->Print(); std::cout << std::endl; - 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) ) + else if ( gdcm::ValEntry* v = dynamic_cast(d) ) { copy->GetHeader()->ReplaceOrCreateByNumber( v->GetValue(), @@ -116,7 +139,7 @@ int main(int argc, char* argv[]) //copy->GetImageData(); - copy->SetImageData(imageData, dataSize); + //copy->SetImageData(imageData, dataSize); std::cout << "--- Copy ----------------------" << std::endl; std::cout <