From 96a07d9f59947ba8315fec0b4f240c8d7bf986bf Mon Sep 17 00:00:00 2001 From: regrain Date: Thu, 25 Nov 2004 16:35:16 +0000 Subject: [PATCH] fix compilation warnings for the gdcm::Document::TransferSyntaxStrings variable... create a static method in gdcm::Document to access to this variable content. -- BeNours --- ChangeLog | 3 +++ src/gdcmDocument.cxx | 45 ++++++++++++++++++++++++++++++++++++++++++-- src/gdcmDocument.h | 41 ++++------------------------------------ src/gdcmFile.cxx | 18 ++++++++++-------- 4 files changed, 60 insertions(+), 47 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8cb9721c..3c1e7dcc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ 2004-11-25 Benoit Regrain * 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 * src/gdcmDocument.[h|cxx] : set the Transfert Syntax values to the header diff --git a/src/gdcmDocument.cxx b/src/gdcmDocument.cxx index ba76c1e9..0d32d8fc 100644 --- a/src/gdcmDocument.cxx +++ b/src/gdcmDocument.cxx @@ -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 @@ -36,6 +36,42 @@ 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 diff --git a/src/gdcmDocument.h b/src/gdcmDocument.h index b3129904..9682e57b 100644 --- a/src/gdcmDocument.h +++ b/src/gdcmDocument.h @@ -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 diff --git a/src/gdcmFile.cxx b/src/gdcmFile.cxx index 4921affd..f362a3d9 100644 --- a/src/gdcmFile.cxx +++ b/src/gdcmFile.cxx @@ -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); -- 2.45.1