X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmHeader.cxx;h=6eeebe416a421f5327dd32076ca87adf9581ada7;hb=ec2e18e4b67fae08879a7428560e1c021ed11d6d;hp=00468e79ea0fbef3f83220f5ab86692ebfa3e3d7;hpb=0571787bc30c2152d5f5e1a1cce820c69223d1c6;p=gdcm.git diff --git a/src/gdcmHeader.cxx b/src/gdcmHeader.cxx index 00468e79..6eeebe41 100644 --- a/src/gdcmHeader.cxx +++ b/src/gdcmHeader.cxx @@ -13,9 +13,8 @@ #include #include "gdcmUtil.h" -#define HEADER_LENGTH_TO_READ 256 // on ne lit plus que le debut - -#define DEBUG 1 +#define HEADER_LENGTH_TO_READ 256 // on ne lit plus que le debut +#define _MaxSizeLoadElementValue_ 1024 // longueur au dela de laquelle on ne charge plus les valeurs namespace Error { struct FileReadError { @@ -29,7 +28,9 @@ namespace Error { } //FIXME: this looks dirty to me... + #define str2num(str, typeNum) *((typeNum *)(str)) + // str est un pointeur dans un tableau de caractères, qui doit contenir, // à cet endroit la, la représentation binaire d'un entier (16 ou 32 bits) // je veux récupérer ça ... dans un entier. @@ -47,7 +48,7 @@ void gdcmHeader::Initialise(void) { } gdcmHeader::gdcmHeader (const char* InFilename) { - SetMaxSizeLoadElementValue(1024); + SetMaxSizeLoadElementValue(_MaxSizeLoadElementValue_); filename = InFilename; Initialise(); fp=fopen(InFilename,"rw"); @@ -123,7 +124,7 @@ void gdcmHeader::CheckSwap() net2host = false; // The easiest case is the one of a DICOM header, since it possesses a - // file preamble where it suffice to look for the sting "DICM". + // file preamble where it suffice to look for the string "DICM". lgrLue = fread(deb, 1, HEADER_LENGTH_TO_READ, fp); entCur = deb + 128; @@ -246,7 +247,6 @@ void gdcmHeader::SwitchSwapToBigEndian(void) { void gdcmHeader::GetPixels(size_t lgrTotale, void* _Pixels) { size_t pixelsOffset; pixelsOffset = GetPixelOffset(); - printf("pixelsOffset %d\n",pixelsOffset); fseek(fp, pixelsOffset, SEEK_SET); fread(_Pixels, 1, lgrTotale, fp); } @@ -498,6 +498,8 @@ bool gdcmHeader::IsJPEGSpectralSelectionProcess6_8TransferSyntax(void) { // Il y en a encore DIX-SEPT, comme ça. // Il faudrait trouver qq chose + rusé ... // +// --> probablement TOUS les supprimer (Eric dixit) +// void gdcmHeader::FixFoundLength(ElValue * ElVal, guint32 FoundLength) { @@ -578,7 +580,7 @@ void gdcmHeader::FindLength(ElValue * ElVal) { // in little endian, and big endian coding only starts at the next // group. The corresponding code can be hard to analyse and adds // many additional unnecessary tests for regular tags. - // * the second strategy consist in waiting for trouble, that shall appear + // * the second strategy consists in waiting for trouble, that shall appear // when we find the first group with big endian encoding. This is // easy to detect since the length of a "Group Length" tag (the // ones with zero as element number) has to be of 4 (0x0004). When we @@ -729,7 +731,9 @@ void gdcmHeader::LoadElementValue(ElValue * ElVal) { // The group length doesn't represent data to be loaded in memory, since // each element of the group shall be loaded individualy. if( elem == 0 ) - SkipLoad = true; + //SkipLoad = true; // modif sauvage JPR + // On charge la longueur du groupe + // quand l'element 0x0000 est présent ! if ( SkipLoad ) { // FIXME the following skip is not necessary @@ -1156,15 +1160,10 @@ void gdcmHeader::ParseHeader(void) { */ void gdcmHeader::LoadElements(void) { - if (DEBUG) printf("LoadElements : Entree\n"); - rewind(fp); - if (DEBUG) printf("LoadElements : rewind\n"); TagElValueHT ht = PubElVals.GetTagHt(); - if (DEBUG) printf("LoadElements : GetTagHt\n"); - for (TagElValueHT::iterator tag = ht.begin(); tag != ht.end(); ++tag) { LoadElementValue(tag->second); }