]> Creatis software - gdcm.git/commitdiff
- ANSIfy gdcmDicomDir.cxx
authorjpr <jpr>
Fri, 23 Jan 2004 16:13:49 +0000 (16:13 +0000)
committerjpr <jpr>
Fri, 23 Jan 2004 16:13:49 +0000 (16:13 +0000)
- warning message by gdcmHeader if Pixels not found
- hex display for *all* integers (no longer only Group lengthes) by Print

Warning : Implicit Big Enddian don't work any longer !
          Bug to be found

src/gdcmDicomDir.cxx
src/gdcmFile.cxx
src/gdcmHeader.cxx
src/gdcmHeaderEntry.cxx
src/gdcmParsePixels.cxx
src/gdcmParser.cxx

index edd6e84e527588956432f60843097609f78e89b5..f14f63e2d091b02633b7e01e619f159208e07cc6 100644 (file)
@@ -112,7 +112,7 @@ void gdcmDicomDir::CreateDicomDir(void)
       }
    }
 
-   end=i;
+   end=GetListEntry().end();
    AddObjectToEnd(type,begin,end);
 }
 
index 581c5f4a4c0a1a926b3b55f857ec9cf04e971e16..328845eaebdb129d2aaa08c969ff110f6645fd20 100644 (file)
@@ -799,9 +799,9 @@ bool gdcmFile::ReadPixelData(void* destination) {
          fread(&b2,1,1,fp);      
          //Two steps is necessary to please VC++
          *pdestination++ =  ((b0 >> 4) << 8) + ((b0 & 0x0f) << 4) + (b1 & 0x0f);
-                             /* A */          /* B */            /* D */
+                              /* A */            /* B */             /* D */
          *pdestination++ =  ((b2 & 0x0f) << 8) + ((b1 >> 4) << 4) + (b2 >> 4);
-                             /* F */          /* C */            /* E */
+                             /* F */               /* C */           /* E */
                  
        // Troubles expected on Big-Endian processors ?       
       }
@@ -818,7 +818,6 @@ bool gdcmFile::ReadPixelData(void* destination) {
         Header->IsDeflatedExplicitVRLittleEndianTransferSyntax() ) {
 
       size_t ItemRead = fread(destination, Header->GetPixelAreaLength(), 1, fp);
-      
       if ( ItemRead != 1 ) {
          Header->CloseFile();
          return false;
index 503fea29fb85f2c13e750c3fd95190572233b89d..cdd0ee170f4b49ca3d6186fb285d999b5d7cb69a 100644 (file)
@@ -180,8 +180,9 @@ bool gdcmHeader::IsRLELossLessTransferSyntax(void) {
    LoadHeaderEntrySafe(Element);
 
    std::string Transfer = Element->GetValue();
-   if ( Transfer == "1.2.840.10008.1.2.5" )
+   if ( Transfer == "1.2.840.10008.1.2.5" ) {
       return true;
+    }
    return false;
 }
 
@@ -482,8 +483,12 @@ size_t gdcmHeader::GetPixelAreaLength(void) {
    gdcmHeaderEntry* PixelElement = GetHeaderEntryByNumber(grPixel,numPixel);
    if (PixelElement)
       return PixelElement->GetLength();
-   else
+   else {
+      std::cout << "Big trouble : Pixel Element ("
+                << std::hex << grPixel<<","<< numPixel<< ") NOT found" 
+                << std::endl;
       return 0;
+   }
 }
 
 /**
index c74b8afb8415d246645e534f72dc4806af4d4a9d..d56d92117ab2cd3513a14547fbefde32aa1c30ab 100644 (file)
@@ -32,16 +32,16 @@ void gdcmHeaderEntry::Print(std::ostream & os) {
    unsigned short int g, e;
    char st[20];
    TSKey v;
-   std::string d2;
+   std::string d2, vr;
    gdcmTS * ts = gdcmGlobal::GetTS();
    std::ostringstream s;
    guint32 lgth;
    char greltag[10];  //group element tag
-      
-   g = GetGroup();
-   e = GetElement();
-   v = GetValue();
-   o = GetOffset();
+   g  = GetGroup();
+   e  = GetElement();
+   v  = GetValue();
+   o  = GetOffset();
+   vr = GetVR();
    sprintf(greltag,"%04x|%04x ",g,e);           
    s << greltag ;
        
@@ -71,7 +71,7 @@ void gdcmHeaderEntry::Print(std::ostream & os) {
       s << std::setw(8) << o; 
    }
 
-   s << "[" << GetVR()  << "] ";
+   s << "[" << vr  << "] ";
 
    if (printLevel>=1) {      
       s.setf(std::ios::left);
@@ -91,11 +91,12 @@ void gdcmHeaderEntry::Print(std::ostream & os) {
             s << "  ==>\t[" << ts->GetValue(v) << "]";
       }
    }
-   if (e == 0x0000) {        // elem 0x0000 --> group length 
+   //if (e == 0x0000) {        // elem 0x0000 --> group length 
+   if ( (vr == "UL") || (vr == "US") || (vr == "SL") || (vr == "SS") ) {
       if (v == "4294967295") // to avoid troubles in convertion 
          sprintf (st," x(ffffffff)");
       else     
-         sprintf(st," x(%08x)",atoi(v.c_str()));
+         sprintf(st," x(%x)",atoi(v.c_str()));
       s << st;
    }
    s << std::endl;
index c388cb541d27bae7f53e240809a98b8847112e08..40311776c1ca73d957d0f42cb2a4382c6c81c7e9 100644 (file)
@@ -86,8 +86,8 @@ bool gdcmFile::ParsePixelData(void) {
       ftellRes=ftell(fp);
       fread(&ln,4,1,fp); 
       if(Header->GetSwapCode()) 
-         ln=Header->SwapLong(ln);    // Basic Offset Table Item Lentgh
-      printf("at %x : Basic Offset Table Item Lentgh (??) %d x(%08x)\n",
+         ln=Header->SwapLong(ln);    // Basic Offset Table Item Length
+      printf("at %x : Basic Offset Table Item Length (??) %d x(%08x)\n",
             ftellRes,ln,ln);
       if (ln != 0) {
          // What is it used for ??
@@ -159,8 +159,8 @@ bool gdcmFile::ParsePixelData(void) {
       ftellRes=ftell(fp);
       fread(&ln,4,1,fp); 
       if(Header->GetSwapCode()) 
-         ln=Header->SwapLong(ln);    // Basic Offset Table Item Lentgh
-      printf("at %x : Basic Offset Table Item Lentgh (??) %d x(%08x)\n",
+         ln=Header->SwapLong(ln);    // Basic Offset Table Item Length
+      printf("at %x : Basic Offset Table Item Length (??) %d x(%08x)\n",
             ftellRes,ln,ln);
       if (ln != 0) {
          // What is it used for ??
index ad61419132e4bc03917241f98abd6e0d7defe346..8d5ef30400915a2c3b224598dd35168a1cbe5e77 100644 (file)
@@ -62,7 +62,7 @@ gdcmParser::gdcmParser(const char *InFilename,
    CloseFile();
 
    wasUpdated = 0;  // will be set to 1 if user adds an entry
-   printLevel = 1;  // 'Heavy' header print by default
+   printLevel = 1;  // 'Medium' print level by default
 }
 
 /**
@@ -78,7 +78,7 @@ gdcmParser::gdcmParser(bool exception_on_error)
    Initialise();
 
    wasUpdated = 0;  // will be set to 1 if user adds an entry
-   printLevel = 1;  // 'Heavy' header print by default
+   printLevel = 1;  // 'Medium' print level by default
 }
 
 /**
@@ -103,7 +103,6 @@ void gdcmParser::PrintEntry(std::ostream & os)
 {
    std::ostringstream s;   
           
-   s << "------------ using listEntries ----------------" << std::endl; 
    for (ListTag::iterator i = listEntries.begin();  
           i != listEntries.end();
           ++i)
@@ -119,8 +118,7 @@ void gdcmParser::PrintEntry(std::ostream & os)
   * \brief   Prints The Dict Entries of THE public Dicom Dictionnry
   * @return
   */  
-void gdcmParser::PrintPubDict(std::ostream & os) 
-{
+void gdcmParser::PrintPubDict(std::ostream & os) {
    RefPubDict->Print(os);
 }
 
@@ -129,8 +127,7 @@ void gdcmParser::PrintPubDict(std::ostream & os)
   * \brief   Prints The Dict Entries of THE shadow Dicom Dictionnry
   * @return
   */
-void gdcmParser::PrintShaDict(std::ostream & os) 
-{
+void gdcmParser::PrintShaDict(std::ostream & os) {
    RefShaDict->Print(os);
 }
 
@@ -1778,7 +1775,7 @@ bool gdcmParser::IsHeaderEntryAnInteger(gdcmHeaderEntry *Entry)
          std::ostringstream s;
          s << "Erroneous Group Length element length  on :" \
            << std::hex << group << " , " << element;
-         dbg.Error("gdcmParser::IsAnInteger",
+         dbg.Error("gdcmParser::IsHeaderEntryAnInteger",
             s.str().c_str());     
       }
    }