X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Example%2FexImageLighten.cxx;h=7ee9e264875e33a5b232724ea78b46c1047ece93;hb=b1bfae0be442abdd23a54950926176451a0fa9cf;hp=0b94d6101ee3e001a1dfadd7f8a9ab37fe098b39;hpb=f3cc252fad08c3e8dbc395f2ca7cabf47bf95302;p=gdcm.git diff --git a/Example/exImageLighten.cxx b/Example/exImageLighten.cxx index 0b94d610..7ee9e264 100644 --- a/Example/exImageLighten.cxx +++ b/Example/exImageLighten.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: exImageLighten.cxx,v $ Language: C++ - Date: $Date: 2005/08/30 15:13:06 $ - Version: $Revision: 1.6 $ + Date: $Date: 2005/10/25 14:52:28 $ + Version: $Revision: 1.9 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -19,8 +19,7 @@ #include "gdcmFile.h" #include "gdcmFileHelper.h" #include "gdcmDocument.h" -#include "gdcmValEntry.h" -#include "gdcmBinEntry.h" +#include "gdcmDataEntry.h" #include "gdcmSeqEntry.h" #include // for exit @@ -56,7 +55,7 @@ int main(int argc, char *argv[]) std::cout << argv[1] << std::endl; - gdcm::File *f = new gdcm::File(); + gdcm::File *f = gdcm::File::New(); f->SetLoadMode( gdcm::LD_ALL); f->SetFileName( fileName ); bool res = f->Load(); @@ -65,6 +64,7 @@ int main(int argc, char *argv[]) std::cerr << "Sorry, " << fileName <<" not a gdcm-readable " << "DICOM / ACR File" <Delete(); return 0; } std::cout << " ... is readable " << std::endl; @@ -78,7 +78,7 @@ int main(int argc, char *argv[]) // to load the Palettes Color (if any) // First, create a gdcm::FileHelper - gdcm::FileHelper *fh = new gdcm::FileHelper(f); + gdcm::FileHelper *fh = gdcm::FileHelper::New(f); // Load the pixels, DO NOT transform LUT (if any) into RGB Pixels uint8_t *imageDataRaw = fh->GetImageDataRaw(); @@ -89,7 +89,7 @@ int main(int argc, char *argv[]) // Create a new gdcm::Filehelper, to hold new image. // ============================================================ - gdcm::FileHelper *copy = new gdcm::FileHelper( ); + gdcm::FileHelper *copy = gdcm::FileHelper::New( ); copy->SetFileName( output ); copy->Load(); @@ -98,8 +98,6 @@ int main(int argc, char *argv[]) // ============================================================ gdcm::DocEntry *d = f->GetFirstEntry(); - - d = f->GetFirstEntry(); while(d) { // We skip SeqEntries, since user cannot do much with them @@ -108,17 +106,11 @@ int main(int argc, char *argv[]) && !( d->GetGroup()%2 ) ) { - if ( gdcm::BinEntry *b = dynamic_cast(d) ) + if ( gdcm::DataEntry *de = dynamic_cast(d) ) { - copy->GetFile()->InsertBinEntry( b->GetBinArea(),b->GetLength(), - b->GetGroup(),b->GetElement(), - b->GetVR() ); - } - else if ( gdcm::ValEntry *v = dynamic_cast(d) ) - { - copy->GetFile()->InsertValEntry( v->GetValue(), - v->GetGroup(),v->GetElement(), - v->GetVR() ); + copy->GetFile()->InsertEntryBinArea( de->GetBinArea(),de->GetLength(), + de->GetGroup(),de->GetElement(), + de->GetVR() ); } else { @@ -137,9 +129,10 @@ int main(int argc, char *argv[]) std::cout << std::endl << "------------------------------------------------------------" << std::endl; - delete f; - delete fh; - delete copy; + + f->Delete(); + fh->Delete(); + copy->Delete(); exit (0); }