X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Testing%2FTestCopyDicom.cxx;h=77178d2da0abb503ff92f1fffd4969315bad8475;hb=6a5e202852e6e151cc918cce3ed017e4fb1a7ef5;hp=c7e74012b8445b8e7efa9ce1c22f625ed6b673c7;hpb=e5e7b1bd7ee84e8f9dc7da5d1d42b598fac68399;p=gdcm.git diff --git a/Testing/TestCopyDicom.cxx b/Testing/TestCopyDicom.cxx index c7e74012..77178d2d 100644 --- a/Testing/TestCopyDicom.cxx +++ b/Testing/TestCopyDicom.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestCopyDicom.cxx,v $ Language: C++ - Date: $Date: 2004/11/25 10:24:33 $ - Version: $Revision: 1.22 $ + Date: $Date: 2005/01/18 07:56:21 $ + Version: $Revision: 1.30 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -17,7 +17,6 @@ =========================================================================*/ #include "gdcmHeader.h" #include "gdcmFile.h" -#include "gdcmDocument.h" #include "gdcmValEntry.h" #include "gdcmBinEntry.h" @@ -74,7 +73,7 @@ int CopyDicom(std::string const & filename, //////////////// Step 1: std::cout << " 1..."; gdcm::Header *originalH = new gdcm::Header( filename ); - gdcm::Header *copyH = new gdcm::Header( output ); + gdcm::Header *copyH = new gdcm::Header( ); //First of all copy the header field by field @@ -86,14 +85,12 @@ int CopyDicom(std::string const & filename, //////////////// Step 2: std::cout << "2..."; - originalH->Initialize(); - gdcm::DocEntry* d=originalH->GetNextEntry(); - + gdcm::DocEntry* d=originalH->GetFirstEntry(); while(d) { if ( gdcm::BinEntry* b = dynamic_cast(d) ) { - copyH->ReplaceOrCreateByNumber( + copyH->ReplaceOrCreate( b->GetBinArea(), b->GetLength(), b->GetGroup(), @@ -102,7 +99,7 @@ int CopyDicom(std::string const & filename, } else if ( gdcm::ValEntry* v = dynamic_cast(d) ) { - copyH->ReplaceOrCreateByNumber( + copyH->ReplaceOrCreate( v->GetValue(), v->GetGroup(), v->GetElement(), @@ -111,10 +108,6 @@ int CopyDicom(std::string const & filename, else { // We skip pb of SQ recursive exploration - //std::cout << "Skipped Sequence " - // << "------------- " << d->GetVR() << " "<< std::hex - // << d->GetGroup() << " " << d->GetElement() - // << std::endl; } d=originalH->GetNextEntry(); @@ -129,8 +122,6 @@ int CopyDicom(std::string const & filename, // 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); -// copy->GetImageData(); -// original->GetHeader()->SetImageDataSize(dataSize); //////////////// Step 3: std::cout << "3..."; @@ -138,7 +129,7 @@ int CopyDicom(std::string const & filename, if( !copy->WriteDcmExplVR(output) ) { std::cout << " Failed" << std::endl - << " " << output << " not written" << std::endl; + << " " << output << " not written" << std::endl; delete original; delete copy;