-bool gdcmDocument::LoadDocEntrySet(bool exception_on_error) throw(gdcmFormatError) {
- (void)exception_on_error;
- rewind(fp);
- if (!CheckSwap())
- return false;
-
- gdcmDocEntry *newDocEntry = (gdcmDocEntry *)0;
- gdcmValEntry *newValEntry = (gdcmValEntry *)0;
- gdcmBinEntry *newBinEntry = (gdcmBinEntry *)0;
- gdcmSeqEntry *newSeqEntry = (gdcmSeqEntry *)0;
- //gdcmDictEntry *NewTag = (gdcmDictEntry *)0;
-
- while (newDocEntry = ReadNextDocEntry())) {
- // TODO (?) : liberation du DocEntry ainsi cree,
- // apres copie dans un ValEntry, SeqEntry, BinEntry
- vr = newDocEntry->getVR();
-
- if (vr == "SQ" ) {
- // --- SeqEntry
-
- newSeqEntry = (gdcmSeqEntry *)0;
- if (!NewSeqEntry) {
- dbg.Verbose(1, "gdcmDocEntrySet::LoadDocEntrySet",
- "failed to allocate gdcmSeqEntry");
- return false;
- }
- newSeqEntry->Copy(newDocEntry);
- // TODO
- // SEQUENCE; appel 'récursif' de ??? pour charger la 'valeur'
- // (ensemble d' ITEMs, en fait,
- // chaque ITEM etant chargé avec LoadDocEntrySet)
-
- SkipDocEntry(newSeqEntry); // voir ce qu'on fait pour une SeQuence
- AddDocEntry(newSeqEntry);
-
- } else if (vr == "AE" || vr == "AS" || vr == "DA" || vr == "PN" ||
- vr == "UI" || vr == "TM" ) {
- // --- ValEntry
-
- newValEntry = (gdcmValEntry *)0;
- if (!NewValEntry) {
- dbg.Verbose(1, "gdcmDocEntrySet::LoadDocEntrySet",
- "failed to allocate gdcmValEntry");
- return false;
- }
- newValEntry->Copy(newDocEntry);
- SkipDocEntry(newValEntry);
- AddDocEntry(newValEntry);
-
- } else {
- // --- BinEntry
-
- NewBinEntry = new gdcmBinEntry(DictEntry);
- if (!NewValEntry) {
- dbg.Verbose(1, "gdcmDocEntrySet::LoadDocEntrySet",
- "failed to allocate gdcmBinEntry");
- return false;
- }
- newBinEntry->Copy(newDocEntry);
- SkipDocEntry(newBinEntry);
- AddDocEntry(newBinEntry);
- }
- }
- rewind(fp);
-
-
- // TODO : il n'y a plus de Chained List qui contient toutes les Entries
- // Le chargement des valeurs devra se faire à la volée
- // Be carefull : merging this two loops may cause troubles ...
- for (ListTag::iterator i = GetListEntry().begin();
- i != GetListEntry().end();
- ++i)
- {
- LoadDocEntry(*i);
- }
- rewind(fp);
-
- // --------------------------------------------------------------
- // Special Patch to allow gdcm to read ACR-LibIDO formated images
- //
- // if recognition code tells us we deal with a LibIDO image
- // we switch lineNumber and columnNumber
- //
- std::string RecCode;
- RecCode = GetEntryByNumber(0x0008, 0x0010); // recognition code
- if (RecCode == "ACRNEMA_LIBIDO_1.1" ||
- RecCode == "CANRME_AILIBOD1_1." ) // for brain-damaged softwares
- // with "little-endian strings"
+gdcmDictEntry* gdcmDocEntrySet::NewVirtualDictEntry(uint16_t group,
+ uint16_t element,
+ std::string const & vr,
+ std::string const & fourth,
+ std::string const & name)
+{
+ return gdcmGlobal::GetDicts()->NewVirtualDictEntry(group,element,vr,fourth,name);
+}
+
+/** \brief
+ * Creates a new DocEntry (without any 'value' ...)
+ * @param group group number of the underlying DictEntry
+ * @param elem elem number of the underlying DictEntry
+ */
+gdcmDocEntry* gdcmDocEntrySet::NewDocEntryByNumber(uint16_t group,
+ uint16_t elem)
+{
+ // Find out if the tag we encountered is in the dictionaries:
+ gdcmDict *pubDict = gdcmGlobal::GetDicts()->GetDefaultPubDict();
+ gdcmDictEntry *dictEntry = pubDict->GetDictEntryByNumber(group, elem);
+ if (!dictEntry)