X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Example%2FTestFromScratch.cxx;h=20f52c074b6670823857915ef4b314fd3b45209f;hb=425e3a7d460b4cb325508fd3cc01ca173fdc33e5;hp=e9760b86cc997558a3f98b031c05b72e0af57d64;hpb=5a0d183707a94e875a595036f64d0bd506faf618;p=gdcm.git diff --git a/Example/TestFromScratch.cxx b/Example/TestFromScratch.cxx index e9760b86..20f52c07 100644 --- a/Example/TestFromScratch.cxx +++ b/Example/TestFromScratch.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestFromScratch.cxx,v $ Language: C++ - Date: $Date: 2005/01/14 11:28:28 $ - Version: $Revision: 1.8 $ + Date: $Date: 2005/07/08 12:02:02 $ + 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 @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#include "gdcmHeader.h" #include "gdcmFile.h" +#include "gdcmFileHelper.h" #include "gdcmDictEntry.h" #include "gdcmDocEntry.h" #include "gdcmBinEntry.h" @@ -35,40 +35,40 @@ int main(int argc, char *argv[]) return 1; } - // Doesn't seems to do anything: - gdcm::Debug::SetDebugOn(); + + // Doesn't seem to do anything: + gdcm::Debug::DebugOn(); // Doesn't link properly: //gdcm::Debug::GetReference().SetDebug(1); std::string filename = argv[1]; - //gdcm::File *f1 = new gdcm::File( "/home/malaterre/Creatis/gdcmData/012345.002.050.dcm" ); - gdcm::File *f1 = new gdcm::File( filename ); - gdcm::Header *h1 = f1->GetHeader(); + gdcm::File *h1 = new gdcm::File(); + h1->SetFileName( filename ); + h1->Load( ); + gdcm::FileHelper *f1 = new gdcm::FileHelper( h1 ); + int dataSize = f1->GetImageDataSize(); std::cout << "DataSize: " << dataSize << std::endl; // Since we know the image is 16bits: - uint8_t* imageData = f1->GetImageData(); + uint8_t *imageData = f1->GetImageData(); // Hopefully default to something - gdcm::Header *h2 = new gdcm::Header(); + gdcm::File *h2 = new gdcm::File(); // Copy of the header content - h1->InitTraversal(); - gdcm::DocEntry* d = h1->GetNextEntry(); + gdcm::DocEntry *d = h1->GetFirstEntry(); while(d) { - if ( gdcm::ValEntry* v = dynamic_cast(d) ) + if ( gdcm::ValEntry *v = dynamic_cast(d) ) { // Do not bother with field from private dict if( v->GetName() != "gdcm::Unknown" ) { - h2->ReplaceOrCreate( - v->GetValue(), - v->GetGroup(), - v->GetElement(), - v->GetVR() ); + h2->InsertValEntry( v->GetValue(), + v->GetGroup(),v->GetElement(), + v->GetVR() ); } } //else @@ -79,7 +79,7 @@ int main(int argc, char *argv[]) } h2->Print( std::cout ); - gdcm::File *f2 = new gdcm::File( h2 ); + gdcm::FileHelper *f2 = new gdcm::FileHelper( h2 ); f2->SetImageData(imageData, dataSize); f2->SetWriteTypeToDcmExplVR(); @@ -87,6 +87,7 @@ int main(int argc, char *argv[]) delete f1; delete f2; + delete h1; delete h2; return 0;