-/**
- * \brief Find the Length till the next sequence delimiter
- * \warning NOT end user intended method !
- * @return
- */
-
-uint32_t gdcmDocument::FindDocEntryLengthOB() {
- // See PS 3.5-2001, section A.4 p. 49 on encapsulation of encoded pixel data.
- uint16_t g;
- uint16_t n;
- long PositionOnEntry = ftell(fp);
- bool FoundSequenceDelimiter = false;
- uint32_t TotalLength = 0;
- uint32_t ItemLength;
-
- while ( ! FoundSequenceDelimiter)
- {
- g = ReadInt16();
- n = ReadInt16();
- if (errno == 1)
- return 0;
-
- // We have to decount the group and element we just read
- TotalLength += 4;
-
- if ( ( g != 0xfffe )
- || ( ( n != 0xe0dd ) && ( n != 0xe000 ) ) )
- {
- dbg.Verbose(1, "gdcmDocument::FindLengthOB: neither an Item tag "
- "nor a Sequence delimiter tag.");
- fseek(fp, PositionOnEntry, SEEK_SET);
- errno = 1;
- return 0;
- }
-
- if ( n == 0xe0dd )
- FoundSequenceDelimiter = true;
-
- ItemLength = ReadInt32();
- // We add 4 bytes since we just read the ItemLength with ReadInt32
- TotalLength += ItemLength + 4;
- SkipBytes(ItemLength);
-
- if ( FoundSequenceDelimiter )
- break;
- }
- fseek(fp, PositionOnEntry, SEEK_SET);
- return TotalLength;
-}
-
-/**
- * \brief Reads a supposed to be 16 Bits integer
- * (swaps it depending on processor endianity)
- * @return read value
- */
-uint16_t gdcmDocument::ReadInt16() {
- uint16_t g;
- size_t item_read;
- item_read = fread (&g, (size_t)2,(size_t)1, fp);
- if ( item_read != 1 ) {
- if(ferror(fp))
- dbg.Verbose(0, "gdcmDocument::ReadInt16", " File Error");
- errno = 1;
- return 0;
- }
- errno = 0;
- g = SwapShort(g);
- return g;
-}
-
-/**
- * \brief Reads a supposed to be 32 Bits integer
- * (swaps it depending on processor endianity)
- * @return read value
- */
-uint32_t gdcmDocument::ReadInt32() {
- uint32_t g;
- size_t item_read;
- item_read = fread (&g, (size_t)4,(size_t)1, fp);
- if ( item_read != 1 ) {
- if(ferror(fp))
- dbg.Verbose(0, "gdcmDocument::ReadInt32", " File Error");
- errno = 1;
- return 0;
- }
- errno = 0;
- g = SwapLong(g);
- return g;
-}
-
-/**
- * \brief skips bytes inside the source file
- * \warning NOT end user intended method !
- * @return
- */
-void gdcmDocument::SkipBytes(uint32_t NBytes) {
- //FIXME don't dump the returned value
- (void)fseek(fp, (long)NBytes, SEEK_CUR);
-}
-
-/**
- * \brief Loads all the needed Dictionaries
- * \warning NOT end user intended method !
- */
-void gdcmDocument::Initialise()
-{
- RefPubDict = gdcmGlobal::GetDicts()->GetDefaultPubDict();
- RefShaDict = NULL;
-}
-