]> Creatis software - gdcm.git/commitdiff
Add some verbosity
authorjpr <jpr>
Mon, 10 Jan 2005 17:09:49 +0000 (17:09 +0000)
committerjpr <jpr>
Mon, 10 Jan 2005 17:09:49 +0000 (17:09 +0000)
src/gdcmDocument.cxx
src/gdcmHeader.cxx
src/gdcmUtil.cxx

index a202aca00541268f770c3c858b0ffe2693be4f99..ad2d33a9c0a900f31425064fd773d92078d1dfd0 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocument.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/10 03:09:07 $
-  Version:   $Revision: 1.169 $
+  Date:      $Date: 2005/01/10 17:09:49 $
+  Version:   $Revision: 1.170 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -47,7 +47,7 @@ namespace gdcm
 static const char *TransferSyntaxStrings[] =  {
   // Implicit VR Little Endian
   "1.2.840.10008.1.2",
-  // Implicit VR Big Endian DLX G.E?
+  // Implicit VR Big Endian DLX (G.E Private)
   "1.2.840.113619.5.2",
   // Explicit VR Little Endian
   "1.2.840.10008.1.2.1",
@@ -1997,7 +1997,7 @@ void Document::FixDocEntryFoundLength(DocEntry *entry,
  */
 bool Document::IsDocEntryAnInteger(DocEntry *entry)
 {
-   uint16_t element = entry->GetElement();
+   uint16_t elem    = entry->GetElement();
    uint16_t group   = entry->GetGroup();
    const std::string &vr  = entry->GetVR();
    uint32_t length  = entry->GetLength();
@@ -2005,7 +2005,7 @@ bool Document::IsDocEntryAnInteger(DocEntry *entry)
    // When we have some semantics on the element we just read, and if we
    // a priori know we are dealing with an integer, then we shall be
    // able to swap it's element value properly.
-   if ( element == 0 )  // This is the group length of the group
+   if ( elem == 0 )  // This is the group length of the group
    {  
       if ( length == 4 )
       {
@@ -2022,7 +2022,7 @@ bool Document::IsDocEntryAnInteger(DocEntry *entry)
          // message and proceed on parsing (while crossing fingers).
          long filePosition = Fp->tellg();
          gdcmVerboseMacro( "Erroneous Group Length element length  on : (" 
-           << std::hex << group << " , " << element 
+           << std::hex << group << " , " << elem
            << ") -before- position x(" << filePosition << ")"
            << "lgt : " << length );
       }
@@ -2060,8 +2060,8 @@ uint32_t Document::FindDocEntryLengthOBOrOW()
       }
       catch ( FormatError )
       {
-         throw FormatError("Document::FindDocEntryLengthOBOrOW()",
-                           " group or element not present.");
+         throw FormatError("Unexpected end of file encountered during ",
+                           "Document::FindDocEntryLengthOBOrOW()");
       }
 
       // We have to decount the group and element we just read
@@ -2069,7 +2069,11 @@ uint32_t Document::FindDocEntryLengthOBOrOW()
      
       if ( group != 0xfffe || ( ( elem != 0xe0dd ) && ( elem != 0xe000 ) ) )
       {
-         gdcmVerboseMacro( "Neither an Item tag nor a Sequence delimiter tag."); 
+         long filePosition = Fp->tellg();
+         gdcmVerboseMacro( "Neither an Item tag nor a Sequence delimiter tag on :" 
+           << std::hex << group << " , " << elem 
+           << ") -before- position x(" << filePosition << ")" );
+  
          Fp->seekg(positionOnEntry, std::ios::beg);
          throw FormatUnexpected( "Neither an Item tag nor a Sequence delimiter tag.");
       }
index e5e2511fda699873ddade4585532566ac71d7be2..9eadf2c706b8eb4e8710de6255e92516a1f0a4c8 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmHeader.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/08 15:03:59 $
-  Version:   $Revision: 1.227 $
+  Date:      $Date: 2005/01/10 17:09:49 $
+  Version:   $Revision: 1.228 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -44,7 +44,7 @@ Header::Header( std::string const &filename ):
    // is found by indirection through the "Image Location").
    // Inside the group pointed by "Image Location" the searched element
    // is conventionally the element 0x0010 (when the norm is respected).
-   // When the "Image Location" is absent we default to group 0x7fe0.
+   // When the "Image Location" is Missing we default to group 0x7fe0.
    // Note: this IS the right place for the code
  
    // Image Location
@@ -292,7 +292,7 @@ int Header::GetYSize()
  * \brief   Retrieve the number of planes of volume or the number
  *          of frames of a multiframe.
  * \warning When present we consider the "Number of Frames" as the third
- *          dimension. When absent we consider the third dimension as
+ *          dimension. When Missing we consider the third dimension as
  *          being the ACR-NEMA "Planes" tag content.
  * @return  The encountered size when found, 1 by default (single image).
  */
@@ -404,17 +404,18 @@ float Header::GetZSpacing()
    //   disjointes    (Spacing between Slices > Slice Thickness)
    // Slice Thickness : epaisseur de tissus sur laquelle est acquis le signal
    //   ca interesse le physicien de l'IRM, pas le visualisateur de volumes ...
-   //   Si le Spacing Between Slices est absent
+   //   Si le Spacing Between Slices est Missing
    //   on suppose que les coupes sont jointives
    
    const std::string &strSpacingBSlices = GetEntry(0x0018,0x0088);
 
    if ( strSpacingBSlices == GDCM_UNFOUND )
    {
-      gdcmVerboseMacro("Unfound StrSpacingBSlices");
+      gdcmVerboseMacro("Unfound Spacing Between Slices (0018,0088)");
       const std::string &strSliceThickness = GetEntry(0x0018,0x0050);       
       if ( strSliceThickness == GDCM_UNFOUND )
       {
+         gdcmVerboseMacro("Unfound Slice Thickness (0018,0050)");
          return 1.;
       }
       else
@@ -444,7 +445,7 @@ float Header::GetRescaleIntercept()
       if( sscanf( strRescInter.c_str(), "%f", &resInter) != 1 )
       {
          // bug in the element 0x0028,0x1052
-         gdcmVerboseMacro( "Rescale Intercept is empty." );
+         gdcmVerboseMacro( "Rescale Intercept (0028,1052) is empty." );
       }
    }
 
@@ -465,7 +466,7 @@ float Header::GetRescaleSlope()
       if( sscanf( strRescSlope.c_str(), "%f", &resSlope) != 1)
       {
          // bug in the element 0x0028,0x1053
-         gdcmVerboseMacro( "Rescale Slope is empty.");
+         gdcmVerboseMacro( "Rescale Slope (0028,1053) is empty.");
       }
    }
 
@@ -788,7 +789,7 @@ int Header::GetBitsStored()
    std::string strSize = GetEntry( 0x0028, 0x0101 );
    if ( strSize == GDCM_UNFOUND )
    {
-      gdcmVerboseMacro("This is supposed to be mandatory");
+      gdcmVerboseMacro("(0028,0101) is supposed to be mandatory");
       return 0;  // It's supposed to be mandatory
                  // the caller will have to check
    }
@@ -797,16 +798,16 @@ int Header::GetBitsStored()
 
 /**
  * \brief   Retrieve the high bit position.
- * \warning The method defaults to 0 when information is absent.
+ * \warning The method defaults to 0 when information is Missing.
  *          The responsability of checking this value is left to the caller.
- * @return  The high bit positin when present. 0 when absent.
+ * @return  The high bit positin when present. 0 when Missing.
  */
 int Header::GetHighBitPosition()
 {
    std::string strSize = GetEntry( 0x0028, 0x0102 );
    if ( strSize == GDCM_UNFOUND )
    {
-      gdcmVerboseMacro( "This is supposed to be mandatory");
+      gdcmVerboseMacro( "(0028,0102) is supposed to be mandatory");
       return 0;
    }
    return atoi( strSize.c_str() );
@@ -814,7 +815,7 @@ int Header::GetHighBitPosition()
 
 /**
  * \brief   Check wether the pixels are signed or UNsigned data.
- * \warning The method defaults to false (UNsigned) when information is absent.
+ * \warning The method defaults to false (UNsigned) when information is Missing.
  *          The responsability of checking this value is left to the caller.
  * @return  True when signed, false when UNsigned
  */
@@ -823,7 +824,7 @@ bool Header::IsSignedPixelData()
    std::string strSize = GetEntry( 0x0028, 0x0103 );
    if ( strSize == GDCM_UNFOUND )
    {
-      gdcmVerboseMacro( "This is supposed to be mandatory");
+      gdcmVerboseMacro( "(0028,0103) is supposed to be mandatory");
       return false;
    }
    int sign = atoi( strSize.c_str() );
@@ -845,7 +846,7 @@ int Header::GetBitsAllocated()
    std::string strSize = GetEntry(0x0028,0x0100);
    if ( strSize == GDCM_UNFOUND )
    {
-      gdcmVerboseMacro( "This is supposed to be mandatory");
+      gdcmVerboseMacro( "(0028,0100) is supposed to be mandatory");
       return 0; // It's supposed to be mandatory
                 // the caller will have to check
    }
@@ -863,7 +864,7 @@ int Header::GetSamplesPerPixel()
    const std::string& strSize = GetEntry(0x0028,0x0002);
    if ( strSize == GDCM_UNFOUND )
    {
-      gdcmVerboseMacro( "This is supposed to be mandatory");
+      gdcmVerboseMacro( "(0028,0002) is supposed to be mandatory");
       return 1; // Well, it's supposed to be mandatory ...
                 // but sometimes it's missing : *we* assume Gray pixels
    }
@@ -885,7 +886,7 @@ bool Header::IsMonochrome()
    }
    if ( PhotometricInterp == GDCM_UNFOUND )
    {
-      gdcmVerboseMacro( "Absent Photometric Interpretation");
+      gdcmVerboseMacro( "Not found : Photometric Interpretation (0028,0004)");
    }
    return false;
 }
@@ -904,7 +905,7 @@ bool Header::IsPaletteColor()
    }
    if ( PhotometricInterp == GDCM_UNFOUND )
    {
-      gdcmVerboseMacro( "Absent Palette color");
+      gdcmVerboseMacro( "Not found : Palette color (0028,0004)");
    }
    return false;
 }
@@ -923,7 +924,7 @@ bool Header::IsYBRFull()
    }
    if ( PhotometricInterp == GDCM_UNFOUND )
    {
-      gdcmVerboseMacro( "Absent YBR Full");
+      gdcmVerboseMacro( "Not found : YBR Full (0028,0004)");
    }
    return false;
 }
@@ -938,7 +939,7 @@ int Header::GetPlanarConfiguration()
    std::string strSize = GetEntry(0x0028,0x0006);
    if ( strSize == GDCM_UNFOUND )
    {
-      gdcmVerboseMacro( "Absent Planar Configuration");
+      gdcmVerboseMacro( "Not found : Planar Configuration (0028,0006)");
       return 0;
    }
    return atoi( strSize.c_str() );
@@ -996,7 +997,7 @@ std::string Header::GetPixelType()
    std::string bitsAlloc = GetEntry(0x0028, 0x0100); // Bits Allocated
    if ( bitsAlloc == GDCM_UNFOUND )
    {
-      gdcmVerboseMacro( "Unfound Bits Allocated");
+      gdcmVerboseMacro( "Missing  Bits Allocated (0028,0100)");
       bitsAlloc = "16";
    }
 
@@ -1019,7 +1020,7 @@ std::string Header::GetPixelType()
 
    if (sign == GDCM_UNFOUND )
    {
-      gdcmVerboseMacro( "Unfound Pixel Representation");
+      gdcmVerboseMacro( "Missing Pixel Representation (0028,0103)");
       bitsAlloc = "0";
    }
    else if ( sign == "0" )
index ccdb3cb4e1232ea21a1c5294341b5a7586919d08..fb7d6538a2d9d6ffd61fd14012f0fc6a8a537789 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmUtil.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/09 00:13:26 $
-  Version:   $Revision: 1.86 $
+  Date:      $Date: 2005/01/10 17:09:49 $
+  Version:   $Revision: 1.87 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -44,14 +44,17 @@ namespace gdcm
  * \ingroup Globals
  * \brief Provide a better 'c++' approach for sprintf
  * For example c code is:
- * sprintf(trash, "%04x|%04x", group , element);
+ * sprintf(trash, "%04x|%04x", group , elem);
  *
- * c++ is 
+ * c++ code is 
  * std::ostringstream buf;
  * buf << std::right << std::setw(4) << std::setfill('0') << std::hex
  *     << group << "|" << std::right << std::setw(4) << std::setfill('0') 
- *     << std::hex <<  element;
+ *     << std::hex <<  elem;
  * buf.str();
+ *
+ * gdcm style code is
+ * Format("%04x|%04x", group , elem);
  */
 
 std::string Util::Format(const char *format, ...)