From: regrain Date: Wed, 19 Jan 2005 15:58:00 +0000 (+0000) Subject: * src/gdcmDocEntry.h : DocEntry is now secure. User can't change the X-Git-Tag: Version1.0.bp~243 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=9bc299b2b2e1b334a3bbfaf20aba3afa64d0f05b;p=gdcm.git * src/gdcmDocEntry.h : DocEntry is now secure. User can't change the DictEntry or the VR. -- BeNours --- diff --git a/ChangeLog b/ChangeLog index 449a85a2..738e5e68 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-01-19 Benoit Regrain + * src/gdcmDocEntry.h : DocEntry is now secure. User can't change the + DictEntry or the VR. + 2005-01-19 Benoit Regrain * gdcmPython/ : change GDCM_DATA_PATH to GDCM_DATA_ROOT to be complient with all in gdcm diff --git a/src/gdcmBinEntry.cxx b/src/gdcmBinEntry.cxx index 19ac4d65..62dfc3da 100644 --- a/src/gdcmBinEntry.cxx +++ b/src/gdcmBinEntry.cxx @@ -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(); diff --git a/src/gdcmDocEntry.cxx b/src/gdcmDocEntry.cxx index 75b83279..3701d3a6 100644 --- a/src/gdcmDocEntry.cxx +++ b/src/gdcmDocEntry.cxx @@ -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; diff --git a/src/gdcmDocEntry.h b/src/gdcmDocEntry.h index 269c50de..5dd19d65 100644 --- a/src/gdcmDocEntry.h +++ b/src/gdcmDocEntry.h @@ -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; diff --git a/src/gdcmDocument.cxx b/src/gdcmDocument.cxx index a454f9b1..6715afc1 100644 --- a/src/gdcmDocument.cxx +++ b/src/gdcmDocument.cxx @@ -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 diff --git a/src/gdcmHeader.cxx b/src/gdcmHeader.cxx index c26b4bc6..fa95e414 100644 --- a/src/gdcmHeader.cxx +++ b/src/gdcmHeader.cxx @@ -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 ); - } + } } /** diff --git a/src/gdcmValEntry.cxx b/src/gdcmValEntry.cxx index 9ef3d2dd..22029469 100644 --- a/src/gdcmValEntry.cxx +++ b/src/gdcmValEntry.cxx @@ -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();*/ }