+ // Make sure that at the end of the item we encounter a 'Sequence
+ // Delimiter Item':
+ if ( !ReadTag(0xfffe, 0xe0dd) )
+ {
+ dbg.Verbose(0, "Document::ComputeRLEInfo: no sequence delimiter ");
+ dbg.Verbose(0, " item at end of RLE item sequence");
+ }
+}
+
+/**
+ * \brief Parse pixel data from disk of [multi-]fragment Jpeg encoding.
+ * Compute the jpeg extra information (fragment[s] offset[s] and
+ * length) and store it[them] in \ref JPEGInfo for later pixel
+ * retrieval usage.
+ */
+void Document::ComputeJPEGFragmentInfo()
+{
+ // If you need to, look for comments of ComputeRLEInfo().
+ if ( ! IsJPEG() )
+ {
+ return;
+ }
+
+ ReadAndSkipEncapsulatedBasicOffsetTable();
+
+ // Loop on the fragments[s] and store the parsed information in a
+ // JPEGInfo.
+ long fragmentLength;
+ while ( (fragmentLength = ReadTagLength(0xfffe, 0xe000)) )
+ {
+ long fragmentOffset = Fp->tellg();
+
+ // Store the collected info
+ JPEGFragment* newFragment = new JPEGFragment;
+ newFragment->Offset = fragmentOffset;
+ newFragment->Length = fragmentLength;
+ JPEGInfo->Fragments.push_back( newFragment );
+
+ SkipBytes( fragmentLength );
+ }
+
+ // Make sure that at the end of the item we encounter a 'Sequence
+ // Delimiter Item':
+ if ( !ReadTag(0xfffe, 0xe0dd) )
+ {
+ dbg.Verbose(0, "Document::ComputeRLEInfo: no sequence delimiter ");
+ dbg.Verbose(0, " item at end of JPEG item sequence");
+ }
+}
+
+/**
+ * \brief Walk recursively the given \ref DocEntrySet, and feed
+ * the given hash table (\ref TagDocEntryHT) with all the
+ * \ref DocEntry (Dicom entries) encountered.
+ * This method does the job for \ref BuildFlatHashTable.
+ * @param builtHT Where to collect all the \ref DocEntry encountered
+ * when recursively walking the given set.
+ * @param set The structure to be traversed (recursively).
+ */
+void Document::BuildFlatHashTableRecurse( TagDocEntryHT& builtHT,
+ DocEntrySet* set )
+{
+ if (ElementSet* elementSet = dynamic_cast< ElementSet* > ( set ) )
+ {
+ TagDocEntryHT const & currentHT = elementSet->GetTagHT();
+ for( TagDocEntryHT::const_iterator i = currentHT.begin();
+ i != currentHT.end();
+ ++i)
+ {
+ DocEntry* entry = i->second;
+ if ( SeqEntry* seqEntry = dynamic_cast<SeqEntry*>(entry) )
+ {
+ const ListSQItem& items = seqEntry->GetSQItems();
+ for( ListSQItem::const_iterator item = items.begin();
+ item != items.end();
+ ++item)
+ {
+ BuildFlatHashTableRecurse( builtHT, *item );
+ }
+ continue;
+ }
+ builtHT[entry->GetKey()] = entry;
+ }
+ return;
+ }