]> Creatis software - gdcm.git/commitdiff
* src/gdcmDocEntry.h : DocEntry is now secure. User can't change the
authorregrain <regrain>
Wed, 19 Jan 2005 15:58:00 +0000 (15:58 +0000)
committerregrain <regrain>
Wed, 19 Jan 2005 15:58:00 +0000 (15:58 +0000)
     DictEntry or the VR.
   -- BeNours

ChangeLog
src/gdcmBinEntry.cxx
src/gdcmDocEntry.cxx
src/gdcmDocEntry.h
src/gdcmDocument.cxx
src/gdcmHeader.cxx
src/gdcmValEntry.cxx

index 449a85a2729bc4c28448e353e3d168dd59215b4d..738e5e68aab339f9e29e2c3be8a47c3f5481b42d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-01-19 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
+   * src/gdcmDocEntry.h : DocEntry is now secure. User can't change the 
+     DictEntry or the VR.
+
 2005-01-19 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
    * gdcmPython/ : change GDCM_DATA_PATH to GDCM_DATA_ROOT to be complient with
      all in gdcm
index 19ac4d6553a8bfec46cb12edc0e5d934d1096a11..62dfc3da21187abba740a477138e853116e160bf 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmBinEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/16 04:50:41 $
-  Version:   $Revision: 1.53 $
+  Date:      $Date: 2005/01/19 15:58:00 $
+  Version:   $Revision: 1.54 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -45,10 +45,6 @@ BinEntry::BinEntry(DictEntry *e) : ValEntry(e)
 BinEntry::BinEntry(DocEntry *e) : ValEntry(e->GetDictEntry())
 {
    Copy(e);
-/*   Length     = e->GetLength();
-   ReadLength = e->GetReadLength();
-   ImplicitVR = e->IsImplicitVR();
-   Offset     = e->GetOffset();*/
 
    //FIXME
    //SQDepthLevel = e->GetDepthLevel();
index 75b832796edd6507b153bee3c9c85af8bf9f7e2f..3701d3a6266587a0f945cd57052f5190d5ecfc18 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/18 14:28:32 $
-  Version:   $Revision: 1.43 $
+  Date:      $Date: 2005/01/19 15:58:00 $
+  Version:   $Revision: 1.44 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -242,7 +242,7 @@ uint32_t DocEntry::GetFullLength()
  * \brief   Copies all the attributes from an other DocEntry 
  * @param e entry to copy from
  */
-void DocEntry::Copy (DocEntry *e)
+void DocEntry::Copy(DocEntry *e)
 {
    Length     = e->Length;
    ReadLength = e->ReadLength;
index 269c50de5fb2dffc716db2713dfb4aeff9a38374..5dd19d657bef8ae1e5d8f1c410c8afef3bb8ecf1 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntry.h,v $
   Language:  C++
-  Date:      $Date: 2005/01/16 04:50:41 $
-  Version:   $Revision: 1.38 $
+  Date:      $Date: 2005/01/19 15:58:00 $
+  Version:   $Revision: 1.39 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -69,9 +69,6 @@ public:
    /// of the current Dicom Header Entry
    std::string const &GetVM() const { return DicomDict->GetVM(); };
 
-   /// Sets the 'Value Representation' of the current Dicom Header Entry
-   void SetVR( TagName const &v) { DicomDict->SetVR(v); };
-
    /// Sets the 'Value Multiplicity' of the current Dicom Header Entry
    void SetVM( TagName const &v) { DicomDict->SetVM(v); }; 
 
@@ -123,10 +120,6 @@ public:
    /// @return true if the VM is unknown
    bool IsVMUnknown() { return DicomDict->IsVMUnknown(); };
 
-   /// \brief   Sets the DicEntry of the current Dicom Element
-   /// @param   newEntry pointer to the DictEntry
-   void SetDictEntry(DictEntry *newEntry) { DicomDict = newEntry; };
-
    /// \brief  Gets the DicEntry of the current Dicom Element
    /// @return The DicEntry of the current Dicom Element
    DictEntry * GetDictEntry() { return DicomDict; }; 
@@ -143,8 +136,13 @@ public:
    virtual void Print (std::ostream &os = std::cout, std::string const & indent = ""); 
 
 protected:
-// Variables
+   /// \brief   Sets the DicEntry of the current Dicom Element
+   /// \remarks Used only by the Header !!! (possible because of a friend 
+   ///          link between them)
+   /// @param   newEntry pointer to the DictEntry
+   void SetDictEntry(DictEntry *newEntry) { DicomDict = newEntry; };
 
+// Variables
    /// \brief pointer to the underlying Dicom dictionary element
    DictEntry *DicomDict;
    
index a454f9b1d985c11bd883f02068ca020834ff1ea0..6715afc1c8ccce8c45c0053e6cc8a5170b7334df 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocument.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/19 10:30:51 $
-  Version:   $Revision: 1.199 $
+  Date:      $Date: 2005/01/19 15:58:00 $
+  Version:   $Revision: 1.200 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -1623,34 +1623,33 @@ void Document::FindDocEntryLength( DocEntry *entry )
       // hands on a big endian encoded file: we switch the swap code to
       // big endian and proceed...
 
- //
- //     if ( element  == 0x0000 && length16 == 0x0400 ) 
- //     {
- //        std::string ts = GetTransferSyntax();
- //        if ( Global::GetTS()->GetSpecialTransferSyntax(ts) 
- //               != TS::ExplicitVRBigEndian ) 
- //        {
- //           throw FormatError( "Document::FindDocEntryLength()",
- //                              " not explicit VR." );
- //          return;
- //       }
- //       length16 = 4;
- //       SwitchByteSwapCode();
-
-         // Restore the unproperly loaded values i.e. the group, the element
-         // and the dictionary entry depending on them.
-//        uint16_t correctGroup = SwapShort( entry->GetGroup() );
+//      if ( element  == 0x0000 && length16 == 0x0400 ) 
+//      {
+//         std::string ts = GetTransferSyntax();
+//         if ( Global::GetTS()->GetSpecialTransferSyntax(ts) 
+//                != TS::ExplicitVRBigEndian ) 
+//         {
+//            throw FormatError( "Document::FindDocEntryLength()",
+//                               " not explicit VR." );
+//           return;
+//        }
+//        length16 = 4;
+//        SwitchByteSwapCode();
+//
+//         // Restore the unproperly loaded values i.e. the group, the element
+//         // and the dictionary entry depending on them.
+//         uint16_t correctGroup = SwapShort( entry->GetGroup() );
 //         uint16_t correctElem  = SwapShort( entry->GetElement() );
-//         DictEntry *newTag = GetDictEntry( correctGroup, correctElem );         if ( !newTag )
+//         DictEntry *newTag = GetDictEntry( correctGroup, correctElem );
+//         if ( !newTag )
 //         {
-            // This correct tag is not in the dictionary. Create a new one.
+//            // This correct tag is not in the dictionary. Create a new one.
 //            newTag = NewVirtualDictEntry(correctGroup, correctElem);
 //         }
-         // FIXME this can create a memory leaks on the old entry that be
-         // left unreferenced.
+//         // FIXME this can create a memory leaks on the old entry that be
+//         // left unreferenced.
 //         entry->SetDictEntry( newTag );
 //      }
-
   
       // 0xffff means that we deal with 'No Length' Sequence 
       //        or 'No Length' SQItem
index c26b4bc6a5bf1ae93e62a7f878891e4ce5faa655..fa95e414048b5f8ce9b6e9d314d0b8e6d70ed8d1 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmHeader.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/18 16:23:52 $
-  Version:   $Revision: 1.234 $
+  Date:      $Date: 2005/01/19 15:58:00 $
+  Version:   $Revision: 1.235 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -81,7 +81,6 @@ Header::Header( std::string const &filename ):
    // Now, we know GrPixel and NumPixel.
    // Let's create a VirtualDictEntry to allow a further VR modification
    // and force VR to match with BitsAllocated.
-
    DocEntry *entry = GetDocEntry(GrPixel, NumPixel); 
    if ( entry != 0 )
    {
@@ -99,7 +98,7 @@ Header::Header( std::string const &filename ):
                              PixelVR, "PXL", "Pixel Data");
  
       entry->SetDictEntry( newEntry );
-   } 
+   }
 }
 
 /**
index 9ef3d2ddeee5f81ba9be59674243d7473e8ee6b0..22029469235ee51bf004e43e92d8b82c50e742d6 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmValEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/17 01:14:33 $
-  Version:   $Revision: 1.47 $
+  Date:      $Date: 2005/01/19 15:58:01 $
+  Version:   $Revision: 1.48 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -49,10 +49,6 @@ ValEntry::ValEntry(DocEntry *e)
              : DocEntry(e->GetDictEntry())
 {
    Copy(e);
-/*   Length     = e->GetLength();
-   ReadLength = e->GetReadLength();
-   ImplicitVR = e->IsImplicitVR();
-   Offset     = e->GetOffset();*/
 }