]> Creatis software - gdcm.git/commitdiff
fix compilation warnings for the gdcm::Document::TransferSyntaxStrings
authorregrain <regrain>
Thu, 25 Nov 2004 16:35:16 +0000 (16:35 +0000)
committerregrain <regrain>
Thu, 25 Nov 2004 16:35:16 +0000 (16:35 +0000)
     variable... create a static method in gdcm::Document to access to
     this variable content.
   -- BeNours

ChangeLog
src/gdcmDocument.cxx
src/gdcmDocument.h
src/gdcmFile.cxx

index 8cb9721c7e164cc7493818b75458c757918dda5f..3c1e7dccbfc27b38be1813904dcb5e30c6645d8c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,9 @@
 2004-11-25 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
    * src/ : fix compilation warnings for the Write method (2 different 
      proto). So Rename 'Write(ifstream* fp' into 'WriteContent(ifstream* fp'
+     fix compilation warnings for the gdcm::Document::TransferSyntaxStrings
+     variable... create a static method in gdcm::Document to access to
+     this variable content.
 
 2004-11-25 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
    * src/gdcmDocument.[h|cxx] : set the Transfert Syntax values to the header
index ba76c1e9f79fbc89914956dcda9d7170a925f675..0d32d8fc66d0c655e67a4dfbf2a5a0a4e3b87b4e 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocument.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/11/25 15:46:11 $
-  Version:   $Revision: 1.140 $
+  Date:      $Date: 2004/11/25 16:35:16 $
+  Version:   $Revision: 1.141 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
 
 namespace gdcm 
 {
+//-----------------------------------------------------------------------------
+static const char *TransferSyntaxStrings[] =  {
+  // Implicit VR Little Endian
+  "1.2.840.10008.1.2",
+  // Implicit VR Little Endian DLX G.E?
+  "1.2.840.113619.5.2",
+  // Explicit VR Little Endian
+  "1.2.840.10008.1.2.1",
+  // Deflated Explicit VR Little Endian
+  "1.2.840.10008.1.2.1.99",
+  // Explicit VR Big Endian
+  "1.2.840.10008.1.2.2",
+  // JPEG Baseline (Process 1)
+  "1.2.840.10008.1.2.4.50",
+  // JPEG Extended (Process 2 & 4)
+  "1.2.840.10008.1.2.4.51",
+  // JPEG Extended (Process 3 & 5)
+  "1.2.840.10008.1.2.4.52",
+  // JPEG Spectral Selection, Non-Hierarchical (Process 6 & 8)
+  "1.2.840.10008.1.2.4.53",
+  // JPEG Full Progression, Non-Hierarchical (Process 10 & 12)
+  "1.2.840.10008.1.2.4.55",
+  // JPEG Lossless, Non-Hierarchical (Process 14)
+  "1.2.840.10008.1.2.4.57",
+  // JPEG Lossless, Hierarchical, First-Order Prediction (Process 14, [Selection Value 1])
+  "1.2.840.10008.1.2.4.70",
+  // JPEG 2000 Lossless
+  "1.2.840.10008.1.2.4.90",
+  // JPEG 2000
+  "1.2.840.10008.1.2.4.91",
+  // RLE Lossless
+  "1.2.840.10008.1.2.5",
+  // Unknown
+  "Unknown Transfer Syntax"
+};
+                                                                                
 //-----------------------------------------------------------------------------
 // Refer to Document::CheckSwap()
 const unsigned int Document::HEADER_LENGTH_TO_READ = 256;
@@ -702,6 +738,11 @@ bool Document::ReplaceIfExistByNumber(std::string const & value,
    return true;
 } 
 
+std::string Document::GetTransferSyntaxValue(TransferSyntaxType type)
+{
+   return TransferSyntaxStrings[type];
+}
+
 //-----------------------------------------------------------------------------
 // Protected
 
index b3129904415ebf245f9f041b740a2d4d487934f7..9682e57ba0f2bb6f68828e7b2af3be6dbffa1331 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocument.h,v $
   Language:  C++
-  Date:      $Date: 2004/11/25 15:46:11 $
-  Version:   $Revision: 1.64 $
+  Date:      $Date: 2004/11/25 16:35:17 $
+  Version:   $Revision: 1.65 $
  
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -60,41 +60,6 @@ enum TransferSyntaxType {
   UnknownTS
 };
 
-static const char *TransferSyntaxStrings[] =  {
-  // Implicit VR Little Endian
-  "1.2.840.10008.1.2",
-  // Implicit VR Little Endian DLX G.E?
-  "1.2.840.113619.5.2",
-  // Explicit VR Little Endian
-  "1.2.840.10008.1.2.1",
-  // Deflated Explicit VR Little Endian
-  "1.2.840.10008.1.2.1.99",
-  // Explicit VR Big Endian
-  "1.2.840.10008.1.2.2",
-  // JPEG Baseline (Process 1)
-  "1.2.840.10008.1.2.4.50",
-  // JPEG Extended (Process 2 & 4)
-  "1.2.840.10008.1.2.4.51",
-  // JPEG Extended (Process 3 & 5)
-  "1.2.840.10008.1.2.4.52",
-  // JPEG Spectral Selection, Non-Hierarchical (Process 6 & 8)
-  "1.2.840.10008.1.2.4.53",
-  // JPEG Full Progression, Non-Hierarchical (Process 10 & 12)
-  "1.2.840.10008.1.2.4.55",
-  // JPEG Lossless, Non-Hierarchical (Process 14)
-  "1.2.840.10008.1.2.4.57",
-  // JPEG Lossless, Hierarchical, First-Order Prediction (Process 14, [Selection Value 1])
-  "1.2.840.10008.1.2.4.70",
-  // JPEG 2000 Lossless
-  "1.2.840.10008.1.2.4.90",
-  // JPEG 2000
-  "1.2.840.10008.1.2.4.91",
-  // RLE Lossless
-  "1.2.840.10008.1.2.5",
-  // Unknown
-  "Unknown Transfer Syntax"
-};
-
 //-----------------------------------------------------------------------------
 /**
  * \brief Derived by both Header and DicomDir
@@ -209,6 +174,8 @@ public:
    uint16_t UnswapShort(uint16_t); // needed by File
    uint32_t UnswapLong(uint32_t);  // needed by File
 
+   static std::string GetTransferSyntaxValue(TransferSyntaxType type);
+
 protected:
    // Constructor and destructor are protected to forbid end user 
    // to instanciate from this class Document (only Header and
index 4921affdf3820fe2858911157c0295bcd9f98eaa..f362a3d9bc17541bf61f1a0eb5557f85581e30fb 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmFile.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/11/25 13:12:02 $
-  Version:   $Revision: 1.164 $
+  Date:      $Date: 2004/11/25 16:35:17 $
+  Version:   $Revision: 1.165 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -411,6 +411,8 @@ bool File::WriteBase (std::string const & fileName, FileType type)
       case ACR_LIBIDO:
          SetWriteFileTypeToACRLibido();
          break;
+      default:
+         SetWriteFileTypeToExplicitVR();
    }
   
    switch(WriteMode)
@@ -481,12 +483,12 @@ bool File::CheckWriteIntegrity()
          numberBitsAllocated = 16;
       }
 
-      int decSize = HeaderInternal->GetXSize()
+      size_t decSize = HeaderInternal->GetXSize()
                     * HeaderInternal->GetYSize() 
                     * HeaderInternal->GetZSize()
                     * ( numberBitsAllocated / 8 )
                     * HeaderInternal->GetSamplesPerPixel();
-      int rgbSize = decSize;
+      size_t rgbSize = decSize;
       if( HeaderInternal->HasLUT() )
          rgbSize = decSize * 3;
 
@@ -677,8 +679,8 @@ void File::SetWriteFileTypeToACRLibido()
 
 void File::SetWriteFileTypeToExplicitVR()
 {
-   std::string ts = 
-      Util::DicomString( TransferSyntaxStrings[ExplicitVRLittleEndian] );
+   std::string ts = Util::DicomString( 
+      Document::GetTransferSyntaxValue(ExplicitVRLittleEndian).c_str() );
 
    ValEntry* tss = CopyValEntry(0x0002,0x0010);
    tss->SetValue(ts);
@@ -689,8 +691,8 @@ void File::SetWriteFileTypeToExplicitVR()
 
 void File::SetWriteFileTypeToImplicitVR()
 {
-   std::string ts = 
-      Util::DicomString( TransferSyntaxStrings[ImplicitVRLittleEndian] );
+   std::string ts = Util::DicomString(
+      Document::GetTransferSyntaxValue(ImplicitVRLittleEndian).c_str() );
 
    ValEntry* tss = CopyValEntry(0x0002,0x0010);
    tss->SetValue(ts);