Program: gdcm
Module: $RCSfile: gdcmDocument.cxx,v $
Language: C++
- Date: $Date: 2005/10/27 10:18:22 $
- Version: $Revision: 1.314 $
+ Date: $Date: 2005/11/03 14:21:50 $
+ Version: $Revision: 1.321 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
/// In order to fix things "Quick and Dirty" the dictionary was
/// altered on PURPOSE but now contains a WRONG value.
/// In order to fix things and restore the dictionary to its
- /// correct value, one needs to decided of the semantics by deciding
+ /// correct value, one needs to decide of the semantics by deciding
/// whether the following tags are either :
/// - multivaluated US, and hence loaded as ValEntry, but afterwards
/// also used as BinEntry, which requires the proper conversion,
return a;
}
-
//
// -----------------File I/O ---------------
/**
uint32_t i;
unsigned short vrLgth =
Global::GetVR()->GetAtomicElementLength(entry->GetVR());
- if( entry->GetVR() == "OW" )
- vrLgth = 1;
+
+// FIXME : trouble expected if we read an ... OW Entry (LUT, etc ..)
+// if( entry->GetVR() == "OW" )
+// vrLgth = 1;
switch(vrLgth)
{
+ case 1:
+ {
+ break;
+ }
case 2:
{
uint16_t *data16 = (uint16_t *)data;
}
/**
- * \brief Re-computes the length of a ACR-NEMA/Dicom group from a DcmHeader
+ * \brief Re-computes the length of the Dicom group 0002.
*/
int Document::ComputeGroup0002Length( )
{
{
vr = entry->GetVR();
- // FIXME : group 0x0002 is *always* Explicit VR!
- // --> Except for Implicit VR Transfer Syntax (GE Private) !!
-
- //if ( filetype == ExplicitVR )
- //{
//if ( (vr == "OB")||(vr == "OW")||(vr == "UT")||(vr == "SQ"))
// (no SQ, OW, UT in group 0x0002;)
if ( vr == "OB" )
// explicit VR AND (OB, OW, SQ, UT) : 4 more bytes
groupLength += 4;
}
- //}
+
groupLength += 2 + 2 + 4 + entry->GetLength();
}
}
// we used a heuristic that found "UL" in the first tag and/or
// 'Transfer Syntax' told us it is.
// Alas this doesn't guarantee that all the tags will be in explicit VR.
- // In some cases one finds implicit VR tags mixed within an explicit VR file
+ // In some cases one finds implicit VR tags mixed within an explicit VR file.
// Hence we make sure the present tag is in explicit VR and try to fix things
// if it happens not to be the case.
if ( !CheckDocEntryVR(vr) )
{
gdcmWarningMacro( "Unknown VR " << std::hex << "0x("
- << vr[0] << vr[1] << ") at offset :"
- << positionOnEntry );
+ << (unsigned int)vr[0] << "|" << (unsigned int)vr[1]
+ << ") at offset :" << positionOnEntry );
Fp->seekg(positionOnEntry, std::ios::beg);
return GDCM_VRUNKNOWN;
}
if ( net2host )
{
SwapCode = 4321;
- gdcmDebugMacro( "HostByteOrder != NetworkByteOrder");
+ gdcmDebugMacro( "HostByteOrder != NetworkByteOrder, SwapCode = 4321");
}
else
{
SwapCode = 1234;
- gdcmDebugMacro( "HostByteOrder = NetworkByteOrder");
+ gdcmDebugMacro( "HostByteOrder = NetworkByteOrder, SwapCode = 1234");
}
// Position the file position indicator at first tag
{
Group0002Parsed = true;
// we just came out of group 0002
- // if Transfer syntax is Big Endian we have to change CheckSwap
+ // if Transfer Syntax is Big Endian we have to change CheckSwap
std::string ts = GetTransferSyntax();
+ if ( ts == GDCM_UNKNOWN )
+ {
+ gdcmDebugMacro("True DICOM File, with NO Transfer Syntax (?!) " );
+ return;
+ }
if ( !Global::GetTS()->IsTransferSyntax(ts) )
{
- gdcmDebugMacro("True DICOM File, with NO Tansfer Syntax: " << ts );
+ gdcmWarningMacro("True DICOM File, with illegal Transfer Syntax: ["
+ << ts << "]");
return;
}
if ( Global::GetTS()->GetSpecialTransferSyntax(ts) ==
TS::ImplicitVRLittleEndian )
- {
- Filetype = ImplicitVR;
- }
+ {
+ Filetype = ImplicitVR;
+ }
// FIXME Strangely, this works with
//'Implicit VR BigEndian Transfer Syntax (GE Private)