]> Creatis software - gdcm.git/commitdiff
Now Examples/PrintFile displays properly Transfert Syntax Name, whatever the
authorjpr <jpr>
Mon, 19 Jul 2004 15:16:18 +0000 (15:16 +0000)
committerjpr <jpr>
Mon, 19 Jul 2004 15:16:18 +0000 (15:16 +0000)
padding is made of...

src/gdcmDocument.cxx
src/gdcmHeader.cxx
src/gdcmTS.cxx
src/gdcmValEntry.cxx

index e91b158c544c4d31ba3ed1b7bd589a0bccaa4c9c..2ad09079b7ee68a6d3f4c48bbe2afae5e9f0ab2b 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocument.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/07/19 05:59:12 $
-  Version:   $Revision: 1.54 $
+  Date:      $Date: 2004/07/19 15:16:18 $
+  Version:   $Revision: 1.55 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -301,7 +301,7 @@ bool gdcmDocument::IsReadable()
  * @param   SyntaxToCheck The transfert syntax we need to check against.
  * @return  True when SyntaxToCheck corresponds to the Transfer Syntax of
  *          the current document. False either when the document contains
- *          no Transfer Syntax, or when the Tranfer Syntaxes don't match.
+ *          no Transfer Syntax, or when the Tranfer Syntaxes doesn't match.
  */
 bool gdcmDocument::IsGivenTransferSyntax(std::string const & syntaxToCheck)
 {
@@ -312,7 +312,7 @@ bool gdcmDocument::IsGivenTransferSyntax(std::string const & syntaxToCheck)
    }
 
    // The entry might be present but not loaded (parsing and loading
-   // happen at differente stages): try loading and proceed with check...
+   // happen at different stages): try loading and proceed with check...
    LoadDocEntrySafe(entry);
    if (gdcmValEntry* valEntry = dynamic_cast< gdcmValEntry* >(entry) )
    {
@@ -326,10 +326,7 @@ bool gdcmDocument::IsGivenTransferSyntax(std::string const & syntaxToCheck)
          transfer.erase(transfer.length()-1, 1);
       }
       if ( transfer == syntaxToCheck )
-      //if( transfer.find( syntaxToCheck ) )   //should be faster
       {
-         int k = 
-         abort()
          return true;
       }
    }
@@ -880,10 +877,10 @@ bool gdcmDocument::SetEntryByNumber(std::string content,
                      " ValEntry (try promotion first).");
       return false;
    }
-   // Non even content must be padded with a space (020H).
+   // Non even content must be padded with a space (020H)...
    if( content.length() % 2 )
    {
-      content += '\0';
+      content += '\0';  // ... therefore we padd with (000H) .!?!
    }      
    valEntry->SetValue(content);
    
@@ -926,7 +923,7 @@ bool gdcmDocument::SetEntryByNumber(void *content,
       return false;
    }
 
-/* Hope Binaray field length is *never* wrong    
+/* Hope Binary field length is *never* wrong    
    if(lgth%2) // Non even length are padded with a space (020H).
    {  
       lgth++;
index 799627476e3ce92a790bd8469e01cc3bed649fdc..1cffe3ac20a5614ba2795b3e28a4ebf46d0f7b60 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmHeader.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/07/17 22:45:40 $
-  Version:   $Revision: 1.177 $
+  Date:      $Date: 2004/07/19 15:16:18 $
+  Version:   $Revision: 1.178 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -1213,6 +1213,7 @@ std::string gdcmHeader::GetTransfertSyntaxName()
 {
    // use the gdcmTS (TS : Transfert Syntax)
    std::string transfertSyntax = GetEntryByNumber(0x0002,0x0010);
+
    if ( transfertSyntax == GDCM_UNFOUND )
    {
       dbg.Verbose(0, "gdcmHeader::GetTransfertSyntaxName:"
@@ -1220,6 +1221,10 @@ std::string gdcmHeader::GetTransfertSyntaxName()
       return "Uncompressed ACR-NEMA";
    }
 
+   while ( ! isdigit(transfertSyntax[transfertSyntax.length()-1]) )
+   {
+      transfertSyntax.erase(transfertSyntax.length()-1, 1);
+   }
    // we do it only when we need it
    gdcmTS* ts         = gdcmGlobal::GetTS();
    std::string tsName = ts->GetValue( transfertSyntax );
index a1c83a8bb2c3a61cb3cef5ca7ace5eb773d52e2c..0f41bb5c34c044727d834649e42cc579bbd7bf19 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmTS.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/07/19 11:51:26 $
-  Version:   $Revision: 1.22 $
+  Date:      $Date: 2004/07/19 15:16:19 $
+  Version:   $Revision: 1.23 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -35,7 +35,6 @@ gdcmTS::gdcmTS(void)
    std::ifstream from(filename.c_str());
    dbg.Error(!from, "gdcmTS::gdcmTS: can't open dictionary",filename.c_str());
 
-   //char buff[1024];  //not used
    std::string key;
    std::string name;
 
index d10cacae8823af65fa20e75d8c294877b9a07e61..f8732073cca8c9328b998b0f09cb1beb6f2332ba 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmValEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/07/02 13:55:28 $
-  Version:   $Revision: 1.16 $
+  Date:      $Date: 2004/07/19 15:16:19 $
+  Version:   $Revision: 1.17 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -99,18 +99,28 @@ void gdcmValEntry::Print(std::ostream & os)
       s << " [gdcm::too long for print (" << GetLength() << ") ]";
    }
    
-   // Display the UID value (instead of displaying only the rough code)  
+   // Display the UID value (instead of displaying only the rough code)
+   // First 'clean' trailing character (space or zero) 
    if (g == 0x0002) {  // Any more to be displayed ?
-      if ( (e == 0x0010) || (e == 0x0002) )
+      if ( (e == 0x0010) || (e == 0x0002) ) {
+         if ( ! isdigit(v[v.length()-1]) )
+            v.erase(v.length()-1, 1);
          s << "  ==>\t[" << ts->GetValue(v) << "]";
+      }
    } else {
       if (g == 0x0008) {
-         if ( (e == 0x0016) || (e == 0x1150)  )
+         if ( (e == 0x0016) || (e == 0x1150)  ) {
+            if ( ! isdigit(v[v.length()-1]) )
+               v.erase(v.length()-1, 1);
             s << "  ==>\t[" << ts->GetValue(v) << "]";
+         }
       } else {
          if (g == 0x0004) {
-           if ( (e == 0x1510) || (e == 0x1512)  )
+           if ( (e == 0x1510) || (e == 0x1512)  ) {
+              if ( ! isdigit(v[v.length()-1]) )
+                 v.erase(v.length()-1, 1);  
               s << "  ==>\t[" << ts->GetValue(v) << "]";
+            }
          }     
       }
    }