- // Make sure that at the end of the item we encounter a 'Sequence
- // Delimiter Item':
- if ( !ReadTag(0xfffe, 0xe0dd) )
- {
- dbg.Verbose(0, "gdcmDocument::Parse7FE0: no sequence delimiter item");
- dbg.Verbose(0, " at end of RLE item sequence");
- }
+ // Store the collected info
+ RLEFrame* newFrameInfo = new RLEFrame;
+ newFrameInfo->NumberFragments = nbRleSegments;
+ for( unsigned int uk = 1; uk <= nbRleSegments; uk++ )
+ {
+ newFrameInfo->Offset[uk] = frameOffset + rleSegmentOffsetTable[uk];
+ newFrameInfo->Length[uk] = rleSegmentLength[uk];
+ }
+ RLEInfo->Frames.push_back( newFrameInfo );
+ }
+
+ // 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 ( ! IsJPEGTransferSyntax() )
+ {
+ return;
+ }
+
+ ReadAndSkipEncapsulatedBasicOffsetTable();
+
+ // Loop on the fragments[s] and store the parsed information in a
+ // JPEGInfo.
+ long fragmentLength;
+ while ( (fragmentLength = ReadTagLength(0xfffe, 0xe000)) )
+ {
+ long fragmentOffset = ftell(Fp);
+
+ // 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");