X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Example%2FexGrey2RGB.cxx;h=7fc2846a217653afd2d09c4220ed9a3bebf57f69;hb=9fc41d585113e37d4d1d1d511e61d2e638096fb3;hp=b096ad50efca3544a4d48104579be9ff9a2895be;hpb=031dab1266be5850ffa788ebe4fdc3fe2b6c2511;p=gdcm.git diff --git a/Example/exGrey2RGB.cxx b/Example/exGrey2RGB.cxx index b096ad50..7fc2846a 100644 --- a/Example/exGrey2RGB.cxx +++ b/Example/exGrey2RGB.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: exGrey2RGB.cxx,v $ Language: C++ - Date: $Date: 2005/06/15 10:06:36 $ - Version: $Revision: 1.1 $ + Date: $Date: 2007/05/23 14:18:05 $ + Version: $Revision: 1.6 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -18,8 +18,6 @@ #include "gdcmFile.h" #include "gdcmFileHelper.h" #include "gdcmDocument.h" -#include "gdcmValEntry.h" -#include "gdcmBinEntry.h" #include "gdcmDebug.h" #ifndef _WIN32 @@ -66,7 +64,7 @@ int main(int argc, char *argv[]) return 1; } - //gdcm::Debug::DebugOn(); + //GDCM_NAME_SPACE::Debug::DebugOn(); std::string filename = argv[1]; std::string output = argv[2]; @@ -80,15 +78,17 @@ int main(int argc, char *argv[]) return 1; } } - - gdcm::FileHelper *fh = new gdcm::FileHelper( filename ); + + GDCM_NAME_SPACE::FileHelper *fh = GDCM_NAME_SPACE::FileHelper::New( ); + fh->SetFileName( filename ); + fh->Load(); size_t dataSize = fh->GetImageDataSize(); uint8_t *imageData = fh->GetImageData(); uint8_t *imageDataRGB = new uint8_t[dataSize*3]; - if (fh->GetFile()->GetEntryValue(0x0028,0x0100) == "8" ) + if (fh->GetFile()->GetEntryString(0x0028,0x0100) == "8" ) { for (unsigned int i=0;iGetFile()->InsertValEntry( "3 " ,0x0028,0x0002); + fh->GetFile()->InsertEntryString( "3 " ,0x0028,0x0002); // Photometric Interpretation - fh->GetFile()->InsertValEntry( "RGB ",0x0028,0x0004 ); + fh->GetFile()->InsertEntryString( "RGB ",0x0028,0x0004 ); // Planar Configuration - fh->GetFile()->InsertValEntry( "1 ",0x0028,0x0006 ); + fh->GetFile()->InsertEntryString( "1 ",0x0028,0x0006 ); // TODO : free existing PixelData first ! fh->SetImageData(imageDataRGB, dataSize*3); fh->WriteDcmExplVR( output ); + fh->Delete(); + return 0; }