Program: gdcm
Module: $RCSfile: gdcmDocument.cxx,v $
Language: C++
- Date: $Date: 2005/01/10 03:09:07 $
- Version: $Revision: 1.169 $
+ Date: $Date: 2005/01/11 00:21:48 $
+ Version: $Revision: 1.172 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
static const char *TransferSyntaxStrings[] = {
// Implicit VR Little Endian
"1.2.840.10008.1.2",
- // Implicit VR Big Endian DLX G.E?
+ // Implicit VR Big Endian DLX (G.E Private)
"1.2.840.113619.5.2",
// Explicit VR Little Endian
"1.2.840.10008.1.2.1",
/// \todo check the result
Fp->read((char*)a, l);
- if( Fp->fail() || Fp->eof()) //Fp->gcount() == 1
+ if( Fp->fail() || Fp->eof())
{
delete[] a;
return;
a=( ((a<< 8) & 0xff00ff00) | ((a>>8) & 0x00ff00ff) );
break;
default :
- //std::cout << "swapCode= " << SwapCode << std::endl;
- gdcmErrorMacro( "Unset swap code");
+ gdcmErrorMacro( "Unset swap code:" << SwapCode );
a = 0;
}
return a;
else
{
// fusible
- std::cout<< "MaxSizeLoadEntry exceeded, neither a BinEntry "
- << "nor a ValEntry ?! Should never print that !" << std::endl;
+ gdcmErrorMacro( "MaxSizeLoadEntry exceeded, neither a BinEntry "
+ << "nor a ValEntry ?! Should never print that !" );
}
// to be sure we are at the end of the value ...
if( length % 2 )
{
newValue = Util::DicomString(str, length+1);
- gdcmVerboseMacro("Warning: bad length: " << length );
- gdcmVerboseMacro("For string :" << newValue.c_str());
+ gdcmVerboseMacro("Warning: bad length: " << length <<
+ ",For string :" << newValue.c_str());
// Since we change the length of string update it length
//entry->SetReadLength(length+1);
}
if ( ValEntry *valEntry = dynamic_cast<ValEntry* >(entry) )
{
- if ( Fp->fail() || Fp->eof())//Fp->gcount() == 1
+ if ( Fp->fail() || Fp->eof())
{
- gdcmVerboseMacro( "Unread element value");
+ gdcmVerboseMacro("Unread element value");
valEntry->SetValue(GDCM_UNREAD);
return;
}
// and the dictionary entry depending on them.
uint16_t correctGroup = SwapShort( entry->GetGroup() );
uint16_t correctElem = SwapShort( entry->GetElement() );
- DictEntry *newTag = GetDictEntry( correctGroup,
- correctElem );
+ DictEntry *newTag = GetDictEntry( correctGroup, correctElem );
if ( !newTag )
{
// This correct tag is not in the dictionary. Create a new one.
std::string Document::FindDocEntryVR()
{
if ( Filetype != ExplicitVR )
- return(GDCM_UNKNOWN);
+ return GDCM_UNKNOWN;
long positionOnEntry = Fp->tellg();
// Warning: we believe this is explicit VR (Value Representation) because
if( !CheckDocEntryVR(vr) )
{
Fp->seekg(positionOnEntry, std::ios::beg);
- return(GDCM_UNKNOWN);
+ return GDCM_UNKNOWN;
}
- return(vr);
+ return vr;
}
/**
/**
* \brief Skips to the begining of the next Header Entry
* \warning NOT end user intended method !
- * @param offset start of skipping
- * @param readLgth length to skip
-
+ * @param currentDocEntry entry to skip
*/
-void Document::SkipToNextDocEntry(DocEntry *newDocEntry)
+void Document::SkipToNextDocEntry(DocEntry *currentDocEntry)
{
- Fp->seekg((long)(newDocEntry->GetOffset()), std::ios::beg);
- Fp->seekg( (long)(newDocEntry->GetReadLength()),std::ios::cur);
+ Fp->seekg((long)(currentDocEntry->GetOffset()), std::ios::beg);
+ Fp->seekg( (long)(currentDocEntry->GetReadLength()),std::ios::cur);
}
/**
* the parser went Jabberwocky) one can hope improving things by
* applying some heuristics.
* @param entry entry to check
- * @param foundLength fist assumption about length
+ * @param foundLength first assumption about length
*/
void Document::FixDocEntryFoundLength(DocEntry *entry,
uint32_t foundLength)
*/
bool Document::IsDocEntryAnInteger(DocEntry *entry)
{
- uint16_t element = entry->GetElement();
+ uint16_t elem = entry->GetElement();
uint16_t group = entry->GetGroup();
const std::string &vr = entry->GetVR();
uint32_t length = entry->GetLength();
// When we have some semantics on the element we just read, and if we
// a priori know we are dealing with an integer, then we shall be
// able to swap it's element value properly.
- if ( element == 0 ) // This is the group length of the group
+ if ( elem == 0 ) // This is the group length of the group
{
if ( length == 4 )
{
// message and proceed on parsing (while crossing fingers).
long filePosition = Fp->tellg();
gdcmVerboseMacro( "Erroneous Group Length element length on : ("
- << std::hex << group << " , " << element
+ << std::hex << group << " , " << elem
<< ") -before- position x(" << filePosition << ")"
<< "lgt : " << length );
}
}
catch ( FormatError )
{
- throw FormatError("Document::FindDocEntryLengthOBOrOW()",
- " group or element not present.");
+ throw FormatError("Unexpected end of file encountered during ",
+ "Document::FindDocEntryLengthOBOrOW()");
}
// We have to decount the group and element we just read
if ( group != 0xfffe || ( ( elem != 0xe0dd ) && ( elem != 0xe000 ) ) )
{
- gdcmVerboseMacro( "Neither an Item tag nor a Sequence delimiter tag.");
+ long filePosition = Fp->tellg();
+ gdcmVerboseMacro( "Neither an Item tag nor a Sequence delimiter tag on :"
+ << std::hex << group << " , " << elem
+ << ") -before- position x(" << filePosition << ")" );
+
Fp->seekg(positionOnEntry, std::ios::beg);
throw FormatUnexpected( "Neither an Item tag nor a Sequence delimiter tag.");
}