X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmDocument.cxx;h=11b88a2e6fefc1d8b1aebba0dd568c1c0cdeda05;hb=6278320cc85da00d2d56ffbf07806e84966892c3;hp=efe6d1c92f85856307ad1b4667a63b8a34699a3b;hpb=2299a5f222b24d22ed55327d9f842991a8da3794;p=gdcm.git diff --git a/src/gdcmDocument.cxx b/src/gdcmDocument.cxx index efe6d1c9..11b88a2e 100644 --- a/src/gdcmDocument.cxx +++ b/src/gdcmDocument.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocument.cxx,v $ Language: C++ - Date: $Date: 2008/01/02 10:48:52 $ - Version: $Revision: 1.377 $ + Date: $Date: 2008/09/15 15:49:22 $ + Version: $Revision: 1.381 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -284,10 +284,12 @@ bool Document::DoTheLoadingDocumentJob( ) std::string RecCode; RecCode = GetEntryString(0x0008, 0x0010); // recognition code (RET) + if(RecCode.find("ACRNEMA_LIBIDO") == 0 || // any version RecCode.find("CANRME_AILIBOD") == 0) // for brain-damaged softwares // with "little-endian strings" { + Filetype = ACR_LIBIDO; std::string rows = GetEntryString(0x0028, 0x0010); std::string columns = GetEntryString(0x0028, 0x0011); @@ -1228,7 +1230,7 @@ void Document::ParseDES(DocEntrySet *set, long offset, { /////////////////////// SeqEntry : VR = "SQ" - unsigned long l = newDocEntry->GetReadLength(); + unsigned long l = newDocEntry->GetReadLength(); if ( l != 0 ) // don't mess the delim_mode for 'zero-length sequence' { if ( l == 0xffffffff ) @@ -1327,7 +1329,9 @@ void Document::ParseDES(DocEntrySet *set, long offset, first = false; if (UnexpectedEOF) // some terminator was missing + { break; + } } // end While gdcmDebugMacro( "Exit from ParseDES, delim-mode " << delim_mode ); } @@ -1389,8 +1393,8 @@ bool Document::ParseSQ( SeqEntry *seqEntry, if (offsetStartCurrentSQItem <= OffsetOfPreviousParseDES) { - gdcmWarningMacro("Bad assumption was made on illegal 'unknown length' UN!"); - gdcmWarningMacro("OffsetOfPreviousParseDES " << std::hex << OffsetOfPreviousParseDES + gdcmWarningMacro("Bad assumption was made on illegal 'unknown length' UN!" << std::endl << + "OffsetOfPreviousParseDES " << std::hex << OffsetOfPreviousParseDES << " offsetStartCurrentSQItem " << offsetStartCurrentSQItem); /// \todo when "Bad assumption (SQ) on illegal 'unknown length' UN", Backtrack again + try OB return false; @@ -1399,9 +1403,8 @@ bool Document::ParseSQ( SeqEntry *seqEntry, { OffsetOfPreviousParseDES = offsetStartCurrentSQItem; } - + // fill up the current SQItem, starting at the beginning of fff0,e000 - Fp->seekg(offsetStartCurrentSQItem, std::ios::beg); // Once per SQItem ParseDES(itemSQ, offsetStartCurrentSQItem, l+8, dlm_mod); offsetStartCurrentSQItem = Fp->tellg(); // Once per SQItem @@ -1423,7 +1426,8 @@ bool Document::ParseSQ( SeqEntry *seqEntry, * \brief When a private Sequence + Implicit VR is encountered * we cannot guess it's a Sequence till we find the first * Item Starter. We then backtrack to do the job. - * @param docEntry Item Starter that warned us + * @param docEntry Item Starter that warned us + * @param set DocEntrySet (ElementSet/SQItem) the DocEntry will belong */ DocEntry *Document::Backtrack(DocEntry *docEntry, DocEntrySet *set) { @@ -1544,7 +1548,7 @@ void Document::FindDocEntryLength( DocEntry *entry ) // (the 'straight' images will no longer be readable ...) if ( vr == "OB" || vr == "OW" || vr == "OL" || vr == "SQ" || vr == "UT" - || vr == "UN" || changeFromUN == true) + || vr == "UN" || changeFromUN == true) { changeFromUN = false; // The following reserved two bytes (see PS 3.5-2003, section @@ -1660,8 +1664,8 @@ uint32_t Document::FindDocEntryLengthOBOrOW() { gdcmWarningMacro( "Neither an Item tag nor a Sequence delimiter tag on :" - << std::hex << group << " , " << elem - << ")" ); + << std::hex << group << "|" << elem << ") Pos. on entry was 0x(" <seekg(positionOnEntry, std::ios::beg); // Once per fragment (if any) of OB,OW DataElements throw FormatUnexpected( @@ -1724,7 +1728,7 @@ VRKey Document::FindDocEntryVR() if ( !Global::GetVR()->IsValidVR(vr) ) { - gdcmWarningMacro( "Unknown VR " << vr.GetHexaRepresentation() + gdcmWarningMacro( "Unknown VR " << vr.GetHexaRepresentation() << std::hex << " at offset : 0x(" << CurrentOffsetPosition-4 << ") for group " << std::hex << CurrentGroup );