X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Example%2FFindTags.cxx;h=566c86343870ea7f2964591c7e1c1cedacecf87e;hb=9689c0978578896cab99394a3cbe4fdcb3583ff5;hp=59b0048138621e8ee2914bc9873ffd6364d18bf7;hpb=c094e185dd6404df031524ccae8e1b51e3b84871;p=gdcm.git diff --git a/Example/FindTags.cxx b/Example/FindTags.cxx index 59b00481..566c8634 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/01/21 11:40:52 $ - Version: $Revision: 1.10 $ + Date: $Date: 2005/02/02 10:06:31 $ + Version: $Revision: 1.13 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -22,24 +22,24 @@ #include #include // for sscanf -int main(int argc, char* argv[]) +int main(int argc, char *argv[]) { - std::string toto, titi; + std::string fileName; gdcm::FileHelper *f1; if(argc > 1 ) f1 = new gdcm::FileHelper(argv[1]); else { - toto = GDCM_DATA_ROOT; - toto += "/test.acr"; - f1 = new gdcm::FileHelper(toto); + fileName = GDCM_DATA_ROOT; + fileName += "/test.acr"; + f1 = new gdcm::FileHelper(fileName); } std::string ManufacturerName="SIEMENS "; std::string RecCode="ACR-NEMA 2.0"; std::string ImagePositionPatient, Location, ImageLocation; - std::string zozo; + std::string fileNameToWrite; char c; float x, y, z, l; @@ -47,37 +47,37 @@ int main(int argc, char* argv[]) int dataSize = f1->GetImageDataSize(); std::cout << "---> pourFindTaggs : dataSize " << dataSize << std::endl; - f1->SetEntry(RecCode ,0x0008,0x0010); - f1->SetEntry(ManufacturerName ,0x0008,0x0070); + f1->SetValEntry(RecCode ,0x0008,0x0010); + f1->SetValEntry(ManufacturerName ,0x0008,0x0070); // ImagePositionPatient - ImagePositionPatient = f1->GetFile()->GetEntry(0x0020,0x0032); + ImagePositionPatient = f1->GetFile()->GetEntryValue(0x0020,0x0032); // Image Position (RET) - f1->SetEntry(ImagePositionPatient, 0x0020,0x0030); + f1->SetValEntry(ImagePositionPatient, 0x0020,0x0030); sscanf(ImagePositionPatient.c_str(), "%f%c%f%c%f", &x,&c,&y,&c,&z); -// ceci est probablement une mauvaise idée ! +// probablely a bad idea ! // (peut casser l'ordre des images si la pile d'images // traverse l'axe des X, ou des Y, ou des Z) //l=sqrt(x*x + y*y + z*z); -// ceci ne marchera pas si on se déplace à Z constant :-( +// Will not work if we move on a Z constant :-( l=z; // existerait-il qq chose qui marche à tout coup? // Location std::string zizi = gdcm::Util::Format("%f",l); Location = gdcm::Util::DicomString(zizi.c_str()); - f1->SetEntry(Location, 0x0020,0x0050); + f1->SetValEntry(Location, 0x0020,0x0050); // sinon, la longueur du champ est erronée (?!?) // Probable sac de noeud entre strlen(xxx.c_str()) et xxx.length() // a eclaircir ! // SetEntryLength is private now. -//TO DO : see is the pb goes on... +//TO DO : see if the pb goes on... //f1->GetFile()->SetEntryLength(strlen(Location.c_str())-1, 0x0020,0x0050); @@ -85,23 +85,23 @@ int main(int argc, char* argv[]) zizi = gdcm::Util::Format("%d",0x7FE0); ImageLocation = gdcm::Util::DicomString(zizi.c_str()); -//f1->SetEntry(Location, 0x0028,0x0200); +//f1->SetValEntry(Location, 0x0028,0x0200); //f1->GetFile()->SetEntryLength(strlen(ImageLocation.c_str())-1, 0x0020,0x0050); // prudence ! -// void* imageData= f1->GetImageData(); +// void *imageData= f1->GetImageData(); // ecriture d'un fichier ACR à partir d'un dcmFile correct. - std::cout << "----------------avant PrintEntry---------------------" << std::endl; + std::cout << "----------------before PrintEntry---------------------" << std::endl; f1->GetFile()->Print(); - std::cout << "----------------avant WriteDcm---------------------" << std::endl; + std::cout << "----------------before WriteDcm---------------------" << std::endl; // ecriture d'un fichier ACR à partir d'un dcmFile correct. - zozo = toto + ".acr"; + fileNameToWrite = fileName + ".acr"; std::cout << "WriteACR" << std::endl; - f1->WriteAcr(zozo); + f1->WriteAcr(fileNameToWrite); std::cout << "----------------apres Write---------------------" << std::endl;