X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=Testing%2FTestCopyDicom.cxx;h=a1804823678ea92f6b39e5f3146c249262038794;hb=d01d35846e6b6918f2e11b2f15e13555e78a39b6;hp=2a2416ec647ff0dcf76d1c379dafdc4d7e3cb229;hpb=7a59bd7a91b4ffcd4b24a8d18badbfc5adc3631b;p=gdcm.git diff --git a/Testing/TestCopyDicom.cxx b/Testing/TestCopyDicom.cxx index 2a2416ec..a1804823 100644 --- a/Testing/TestCopyDicom.cxx +++ b/Testing/TestCopyDicom.cxx @@ -1,3 +1,20 @@ +/*========================================================================= + + Program: gdcm + Module: $RCSfile: TestCopyDicom.cxx,v $ + Language: C++ + Date: $Date: 2004/11/18 17:06:54 $ + 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 + 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" @@ -9,6 +26,8 @@ #ifndef _WIN32 #include //for access, unlink +#else +#include //for _access on Win32 #endif // return true if the file exists @@ -64,13 +83,15 @@ int TestCopyDicom(int , char* []) } } - 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(); - void *imageData = original->GetImageData(); + uint8_t* imageData = original->GetImageData(); + (void)dataSize; // To use the variable and not have warnings at compil. + (void)imageData; // To use the variable and not have warnings at compil. //First of all copy the header field by field @@ -79,21 +100,21 @@ int TestCopyDicom(int , char* []) // (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) ) + else if ( gdcm::ValEntry* v = dynamic_cast(d) ) { copy->GetHeader()->ReplaceOrCreateByNumber( v->GetValue(), @@ -111,7 +132,9 @@ int TestCopyDicom(int , char* []) } } - copy->SetImageData(imageData, dataSize); + // Useless to set the image datas, because it's already made when + // copying the corresponding BinEntry that contains the pixel datas + //copy->SetImageData(imageData, dataSize); original->GetHeader()->SetImageDataSize(dataSize); copy->WriteDcmExplVR( output ); @@ -119,7 +142,7 @@ int TestCopyDicom(int , char* []) delete original; delete copy; - copy = new gdcmFile( output ); + copy = new gdcm::File( output ); //Is the file written still gdcm parsable ? if ( !copy->GetHeader()->IsReadable() )