5 int main(int argc, char* argv[]) {
7 std::string toto, titi;
12 f1 = new gdcmFile(argv[1]);
14 toto = GDCM_DATA_ROOT;
16 f1 = new gdcmFile(toto);
19 std::string ManufacturerName="SIEMENS ";
20 std::string RecCode="ACR-NEMA 2.0";
21 std::string ImagePositionPatient, Location, ImageLocation;
22 char zozo[100], zizi[50];
27 int dataSize = f1->GetImageDataSize();
28 printf ("---> pourFindTaggs : dataSize %d\n",dataSize);
30 f1->SetEntryByNumber(RecCode ,0x0008,0x0010);
31 f1->SetEntryByNumber(ManufacturerName ,0x0008,0x0070);
33 // ImagePositionPatient
34 ImagePositionPatient = f1->GetHeader()->GetEntryByNumber(0x0020,0x0032);
36 // Image Position (RET)
37 f1->SetEntryByNumber(ImagePositionPatient, 0x0020,0x0030);
39 sscanf(ImagePositionPatient.c_str(), "%f%c%f%c%f", &x,&c,&y,&c,&z);
41 // ceci est probablement une mauvaise idée !
42 // (peut casser l'ordre des images si la pile d'images
43 // traverse l'axe des X, ou des Y, ou des Z)
44 //l=sqrt(x*x + y*y + z*z);
46 // ceci ne marchera pas si on se déplace à Z constant :-(
48 // existerait-il qq chose qui marche à tout coup?
51 sprintf(zizi,"%f\n",l);
53 f1->SetEntryByNumber(Location, 0x0020,0x0050);
55 // sinon, la longueur du champ est erronée (?!?)
56 // Probable sac de noeud entre strlen(xxx.c_str()) et xxx.length()
59 // SetEntryLengthByNumber is private now.
60 //TO DO : see is the pb goes on...
62 //f1->GetHeader()->SetEntryLengthByNumber(strlen(Location.c_str())-1, 0x0020,0x0050);
66 sprintf(zizi,"%d\n",0x7FE0);
68 //f1->SetEntryByNumber(Location, 0x0028,0x0200);
69 //f1->GetHeader()->SetEntryLengthByNumber(strlen(ImageLocation.c_str())-1, 0x0020,0x0050); // prudence !
71 // void* imageData= f1->GetImageData();
73 // ecriture d'un fichier ACR à partir d'un dcmHeader correct.
75 printf ("----------------avant PrintEntry---------------------\n");
76 f1->GetHeader()->Print();
77 printf ("----------------avant WriteDcm---------------------\n");
80 // ecriture d'un fichier ACR à partir d'un dcmHeader correct.
82 sprintf(zozo, "%s.acr", toto.c_str());
83 printf ("WriteACR\n");
86 printf ("----------------apres Write---------------------\n");