Program: gdcm
Module: $RCSfile: gdcmBinEntry.cxx,v $
Language: C++
- Date: $Date: 2005/08/25 14:59:49 $
- Version: $Revision: 1.74 $
+ Date: $Date: 2005/08/29 13:05:01 $
+ Version: $Revision: 1.75 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
s << "]";
}
else
- {
+ {
if ( Util::IsCleanArea( GetBinArea(),GetLength() ) )
{
std::string cleanString =
{
s << " [" << GetValue()
<< "; length = " << GetLength() << "]";
- }
-
+ }
}
}
else
Program: gdcm
Module: $RCSfile: gdcmDocument.cxx,v $
Language: C++
- Date: $Date: 2005/08/29 09:41:22 $
- Version: $Revision: 1.269 $
+ Date: $Date: 2005/08/29 13:05:01 $
+ Version: $Revision: 1.270 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
}
}
+ // Force Loading some more elements if user asked to.
+
+ gdcm::DocEntry *d;
+ for (ListElements::iterator it = UserForceLoadList.begin();
+ it != UserForceLoadList.end();
+ ++it)
+ {
+ d = GetDocEntry( (*it).Group, (*it).Elem);
+
+ if ( d == NULL)
+ continue;
+
+ if ( dynamic_cast<BinEntry *>(d) )
+ {
+ LoadDocEntry(d, true);
+ continue;
+ }
+
+ if ( dynamic_cast<BinEntry *>(d) )
+ {
+ LoadEntryBinArea((*it).Group, (*it).Elem);
+ continue;
+ }
+
+ if ( dynamic_cast<SeqEntry *>(d) )
+ {
+ gdcmWarningMacro( "You cannot 'ForceLoad' a SeqEntry ");
+ continue;
+ }
+ }
+
CloseFile();
// ----------------------------
SetValEntry(rows , 0x0028, 0x0011);
}
// --- End of ACR-LibIDO kludge ---
-
return true;
}
+
+/**
+ * \brief Adds a new element we want to load anyway
+ * @param group Group number of the target tag.
+ * @param elem Element number of the target tag.
+ */
+void Document::AddForceLoadElement (uint16_t group, uint16_t elem)
+{
+ Element el;
+ el.Group = group;
+ el.Elem = elem;
+ UserForceLoadList.push_back(el);
+}
/**
* \brief Get the public dictionary used
*/
}
/**
- * \brief Loads the element content if its length doesn't exceed
- * the value specified with Document::SetMaxSizeLoadEntry()
+ * \brief Loads (or not) the element content depending if its length exceeds
+ * or not the value specified with Document::SetMaxSizeLoadEntry()
* @param entry Header Entry (Dicom Element) to be dealt with
+ * @param forceLoad wheter we want to load its content even if its length
+ * exceeds the value specified with Document::SetMaxSizeLoadEntry()
*/
-void Document::LoadDocEntry(DocEntry *entry)
+void Document::LoadDocEntry(DocEntry *entry, bool forceLoad)
{
uint16_t group = entry->GetGroup();
std::string vr = entry->GetVR();
// the element content and it's length.
std::ostringstream s;
- if (length > MaxSizeLoadEntry)
- {
- if (BinEntry *binEntryPtr = dynamic_cast< BinEntry* >(entry) )
- {
- s << GDCM_NOTLOADED;
- s << " Ad.:" << (long)entry->GetOffset();
- s << " x(" << std::hex << entry->GetOffset() << ")";
- s << std::dec;
- s << " Lgt:" << entry->GetLength();
- s << " x(" << std::hex << entry->GetLength() << ")";
- binEntryPtr->SetValue(s.str());
- }
- else if (ValEntry *valEntryPtr = dynamic_cast< ValEntry* >(entry) )
- {
- s << GDCM_NOTLOADED;
- s << " Address:" << (long)entry->GetOffset();
- s << " Length:" << entry->GetLength();
- s << " x(" << std::hex << entry->GetLength() << ")";
- valEntryPtr->SetValue(s.str());
- }
- else
+
+ if (!forceLoad)
+ {
+ if (length > MaxSizeLoadEntry)
{
- // fusible
- gdcmErrorMacro( "MaxSizeLoadEntry exceeded, neither a BinEntry "
- << "nor a ValEntry ?! Should never print that !" );
- }
+ if (BinEntry *binEntryPtr = dynamic_cast< BinEntry* >(entry) )
+ {
+ s << GDCM_NOTLOADED;
+ s << " Ad.:" << (long)entry->GetOffset();
+ s << " x(" << std::hex << entry->GetOffset() << ")";
+ s << std::dec;
+ s << " Lgt:" << entry->GetLength();
+ s << " x(" << std::hex << entry->GetLength() << ")";
+ binEntryPtr->SetValue(s.str());
+ }
+ else if (ValEntry *valEntryPtr = dynamic_cast< ValEntry* >(entry) )
+ {
+ s << GDCM_NOTLOADED;
+ s << " Address:" << (long)entry->GetOffset();
+ s << " Length:" << entry->GetLength();
+ s << " x(" << std::hex << entry->GetLength() << ")";
+ valEntryPtr->SetValue(s.str());
+ }
+ else
+ {
+ // fusible
+ gdcmErrorMacro( "MaxSizeLoadEntry exceeded, neither a BinEntry "
+ << "nor a ValEntry ?! Should never print that !" );
+ }
- // to be sure we are at the end of the value ...
- Fp->seekg((long)entry->GetOffset()+(long)entry->GetLength(),
- std::ios::beg);
- return;
+ // to be sure we are at the end of the value ...
+ Fp->seekg((long)entry->GetOffset()+(long)entry->GetLength(),
+ std::ios::beg);
+ return;
+ }
}
// When we find a BinEntry not very much can be done :
Program: gdcm
Module: $RCSfile: gdcmDocument.h,v $
Language: C++
- Date: $Date: 2005/08/24 12:09:13 $
- Version: $Revision: 1.119 $
+ Date: $Date: 2005/08/29 13:05:01 $
+ Version: $Revision: 1.120 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
virtual void LoadEntryBinArea(BinEntry *entry);
void LoadDocEntrySafe(DocEntry *entry);
+ void AddForceLoadElement(uint16_t group, uint16_t elem);
// Ordering of Documents
bool operator<(Document &document);
/// are NOT loaded.
static const unsigned int MAX_SIZE_LOAD_ELEMENT_VALUE;
- /// List of elements to Anonymize
- ListElements AnonymizeList;
+ /// User supplied list of elements to Anonymize
+ ListElements UserAnonymizeList;
+
+ /// User supplied list of elements to force Load
+ ListElements UserForceLoadList;
/// \brief Bit string integer (each one considered as a boolean)
/// Bit 0 : Skip Sequences, if possible
void ParseDES(DocEntrySet *set, long offset, long l_max, bool delim_mode);
void ParseSQ (SeqEntry *seq, long offset, long l_max, bool delim_mode);
- void LoadDocEntry (DocEntry *e);
+ void LoadDocEntry (DocEntry *e, bool forceLoad = false);
void FindDocEntryLength (DocEntry *e) throw ( FormatError );
uint32_t FindDocEntryLengthOBOrOW() throw( FormatUnexpected );
std::string FindDocEntryVR();
Program: gdcm
Module: $RCSfile: gdcmFile.cxx,v $
Language: C++
- Date: $Date: 2005/07/30 18:17:08 $
- Version: $Revision: 1.264 $
+ Date: $Date: 2005/08/29 13:05:01 $
+ Version: $Revision: 1.265 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
el.Group = group;
el.Elem = elem;
el.Value = value;
- AnonymizeList.push_back(el);
+ UserAnonymizeList.push_back(el);
}
/**
uint32_t lgth;
uint32_t valLgth = 0;
std::string *spaces;
- for (ListElements::iterator it = AnonymizeList.begin();
- it != AnonymizeList.end();
+ for (ListElements::iterator it = UserAnonymizeList.begin();
+ it != UserAnonymizeList.end();
++it)
{
d = GetDocEntry( (*it).Group, (*it).Elem);
if ( d == NULL)
continue;
- if ( dynamic_cast<SeqEntry *>(d) )
- {
- gdcmWarningMacro( "You cannot 'Anonymize a SeqEntry ");
- continue;
- }
+ if ( dynamic_cast<SeqEntry *>(d) )
+ {
+ gdcmWarningMacro( "You cannot 'Anonymize' a SeqEntry ");
+ continue;
+ }
offset = d->GetOffset();
lgth = d->GetLength();
bool File::AnonymizeFile()
{
// If Anonymisation list is empty, let's perform some basic anonymization
- if ( AnonymizeList.begin() == AnonymizeList.end() )
+ if ( UserAnonymizeList.begin() == UserAnonymizeList.end() )
{
// If exist, replace by spaces
SetValEntry (" ",0x0010, 0x2154); // Telephone
}
else
{
- SetValEntry("anonymised", 0x0010, 0x0010);
+ SetValEntry("anonymized", 0x0010, 0x0010);
}
}
}
else
{
gdcm::DocEntry *d;
- for (ListElements::iterator it = AnonymizeList.begin();
- it != AnonymizeList.end();
+ for (ListElements::iterator it = UserAnonymizeList.begin();
+ it != UserAnonymizeList.end();
++it)
{
d = GetDocEntry( (*it).Group, (*it).Elem);
Program: gdcm
Module: $RCSfile: gdcmFile.h,v $
Language: C++
- Date: $Date: 2005/07/24 02:34:42 $
- Version: $Revision: 1.115 $
+ Date: $Date: 2005/08/29 13:05:02 $
+ Version: $Revision: 1.116 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
void AddAnonymizeElement (uint16_t group, uint16_t elem,
std::string const &value);
/// Clears the list of elements to be anonymized
- void ClearAnonymizeList() { AnonymizeList.clear(); }
+ void ClearAnonymizeList() { UserAnonymizeList.clear(); }
void AnonymizeNoLoad();
/// Replace patient's own information by info from the Anonymization list
bool AnonymizeFile();