]> Creatis software - gdcm.git/blobdiff - src/gdcmDocument.cxx
* Remove some useless methods in gdcm::Document, gdcm::Header and gdcm::File
[gdcm.git] / src / gdcmDocument.cxx
index 48a0a32deb01f685b41c8a09efb30eed5aa0e06b..a26f291edc4ebf3b1392c682f2330db799bb2809 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocument.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/11/25 13:12:02 $
-  Version:   $Revision: 1.139 $
+  Date:      $Date: 2004/11/26 10:55:04 $
+  Version:   $Revision: 1.142 $
                                                                                 
   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;
@@ -446,7 +482,7 @@ bool Document::CloseFile()
  *          (ACR-NEMA, ExplicitVR, ImplicitVR)
  * \return Always true.
  */
-void Document::Write(std::ofstream* fp, FileType filetype)
+void Document::WriteContent(std::ofstream* fp, FileType filetype)
 {
    /// \todo move the following lines (and a lot of others, to be written)
    /// to a future function CheckAndCorrectHeader  
@@ -474,7 +510,7 @@ void Document::Write(std::ofstream* fp, FileType filetype)
  *    UpdateGroupLength(true,ACR);
  */
  
-   ElementSet::Write(fp, filetype); // This one is recursive
+   ElementSet::WriteContent(fp, filetype); // This one is recursive
 }
 
 /**
@@ -702,6 +738,11 @@ bool Document::ReplaceIfExistByNumber(std::string const & value,
    return true;
 } 
 
+std::string Document::GetTransferSyntaxValue(TransferSyntaxType type)
+{
+   return TransferSyntaxStrings[type];
+}
+
 //-----------------------------------------------------------------------------
 // Protected
 
@@ -938,7 +979,7 @@ bool Document::SetEntryByNumber(uint8_t*content, int lgth,
  * @param element element number of the Entry to modify
  * @return  true on success, false otherwise.
  */
-bool Document::SetEntryLengthByNumber(uint32_t l, 
+/*bool Document::SetEntryLengthByNumber(uint32_t l, 
                                       uint16_t group, uint16_t element) 
 {
    /// \todo use map methods, instead of multimap JPR
@@ -954,7 +995,7 @@ bool Document::SetEntryLengthByNumber(uint32_t l,
    ( ((TagHT.equal_range(key)).first)->second )->SetLength(l); 
 
    return true ;
-}
+}*/
 
 /**
  * \brief   Gets (from Header) the offset  of a 'non string' element value 
@@ -963,7 +1004,7 @@ bool Document::SetEntryLengthByNumber(uint32_t l,
  * @param elem  element number of the Entry
  * @return File Offset of the Element Value 
  */
-size_t Document::GetEntryOffsetByNumber(uint16_t group, uint16_t elem) 
+/*size_t Document::GetEntryOffsetByNumber(uint16_t group, uint16_t elem) 
 {
    DocEntry* entry = GetDocEntryByNumber(group, elem);
    if (!entry) 
@@ -972,7 +1013,7 @@ size_t Document::GetEntryOffsetByNumber(uint16_t group, uint16_t elem)
       return 0;
    }
    return entry->GetOffset();
-}
+}*/
 
 /**
  * \brief   Gets (from Header) a 'non string' element value 
@@ -1015,30 +1056,6 @@ void Document::LoadEntryBinArea(uint16_t group, uint16_t elem)
       return;
 
    LoadEntryBinArea(binElement);
-/*   size_t o =(size_t)docElement->GetOffset();
-   Fp->seekg( o, std::ios_base::beg);
-   size_t l = docElement->GetLength();
-   uint8_t* a = new uint8_t[l];
-   if(!a)
-   {
-      dbg.Verbose(0, "Document::LoadEntryBinArea cannot allocate a");
-      return;
-   }
-
-   // Read the value
-   Fp->read((char*)a, l);
-   if( Fp->fail() || Fp->eof() )//Fp->gcount() == 1
-   {
-      delete[] a;
-      return;
-   }
-
-   // Set the value to the DocEntry
-   if( !SetEntryBinAreaByNumber( a, group, elem ) )
-   {
-      delete[] a;
-      dbg.Verbose(0, "Document::LoadEntryBinArea setting failed.");
-   }*/
 }
 
 /**
@@ -1087,7 +1104,7 @@ void Document::LoadEntryBinArea(BinEntry* element)
  * @param   element Element number of the searched Dicom Element 
  * @return  
  */
-bool Document::SetEntryBinAreaByNumber(uint8_t* area,
+/*bool Document::SetEntryBinAreaByNumber(uint8_t* area,
                                        uint16_t group, uint16_t element) 
 {
    DocEntry* currentEntry = GetDocEntryByNumber(group, element);
@@ -1103,7 +1120,7 @@ bool Document::SetEntryBinAreaByNumber(uint8_t* area,
    }
 
    return false;
-}
+}*/
 
 /**
  * \brief   Update the entries with the shadow dictionary.