X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Example%2FFindTags.cxx;h=e808d85b7d5d983eeaf979e78329638f5d230080;hb=7a111e0401fb1a09aa0d2dd4ab8d5bc6e4890f82;hp=3805438d79a746fea4e07943389255f3f92c140c;hpb=b8e0590883fbaf04288c45cf1149ce1989e6e01f;p=gdcm.git diff --git a/Example/FindTags.cxx b/Example/FindTags.cxx index 3805438d..e808d85b 100644 --- a/Example/FindTags.cxx +++ b/Example/FindTags.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: FindTags.cxx,v $ Language: C++ - Date: $Date: 2005/07/08 12:02:02 $ - Version: $Revision: 1.14 $ + Date: $Date: 2007/05/23 14:18:04 $ + Version: $Revision: 1.17 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -26,8 +26,8 @@ int main(int argc, char *argv[]) { std::string fileName; - gdcm::FileHelper *h; - gdcm::File *f = new gdcm::File(); + GDCM_NAME_SPACE::FileHelper *h; + GDCM_NAME_SPACE::File *f = GDCM_NAME_SPACE::File::New(); if(argc > 1 ) @@ -42,7 +42,7 @@ int main(int argc, char *argv[]) f->Load(); // Should test if it worked ! - h = new gdcm::FileHelper(f); + h = GDCM_NAME_SPACE::FileHelper::New(f); std::string ManufacturerName="SIEMENS "; std::string RecCode="ACR-NEMA 2.0"; @@ -55,14 +55,14 @@ int main(int argc, char *argv[]) int dataSize = h->GetImageDataSize(); std::cout << "---> pourFindTaggs : dataSize " << dataSize << std::endl; - h->SetValEntry(RecCode ,0x0008,0x0010); - h->SetValEntry(ManufacturerName ,0x0008,0x0070); + h->SetEntryString(RecCode ,0x0008,0x0010); + h->SetEntryString(ManufacturerName ,0x0008,0x0070); // ImagePositionPatient - ImagePositionPatient = h->GetFile()->GetEntryValue(0x0020,0x0032); + ImagePositionPatient = h->GetFile()->GetEntryString(0x0020,0x0032); // Image Position (RET) - h->SetValEntry(ImagePositionPatient, 0x0020,0x0030); + h->SetEntryString(ImagePositionPatient, 0x0020,0x0030); sscanf(ImagePositionPatient.c_str(), "%f%c%f%c%f", &x,&c,&y,&c,&z); @@ -76,9 +76,9 @@ int main(int argc, char *argv[]) // existerait-il qq chose qui marche à tout coup? // Location - std::string zizi = gdcm::Util::Format("%f",l); - Location = gdcm::Util::DicomString(zizi.c_str()); - h->SetValEntry(Location, 0x0020,0x0050); + std::string zizi = GDCM_NAME_SPACE::Util::Format("%f",l); + Location = GDCM_NAME_SPACE::Util::DicomString(zizi.c_str()); + h->SetEntryString(Location, 0x0020,0x0050); // sinon, la longueur du champ est erronée (?!?) // Probable sac de noeud entre strlen(xxx.c_str()) et xxx.length() @@ -91,9 +91,9 @@ int main(int argc, char *argv[]) // Image Location - zizi = gdcm::Util::Format("%d",0x7FE0); - ImageLocation = gdcm::Util::DicomString(zizi.c_str()); -//h->SetValEntry(Location, 0x0028,0x0200); + zizi = GDCM_NAME_SPACE::Util::Format("%d",0x7FE0); + ImageLocation = GDCM_NAME_SPACE::Util::DicomString(zizi.c_str()); +//h->SetEntryString(Location, 0x0028,0x0200); //h->GetFile()->SetEntryLength(strlen(ImageLocation.c_str())-1, 0x0020,0x0050); // prudence ! // void *imageData= h->GetImageData(); @@ -113,6 +113,9 @@ int main(int argc, char *argv[]) std::cout << "----------------apres Write---------------------" << std::endl; + h->Delete(); + f->Delete(); + return 0; }