Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
if(RecCode.find("ACRNEMA_LIBIDO") == 0 || // any version
RecCode.find("CANRME_AILIBOD") == 0) // for brain-damaged softwares
// with "little-endian strings"
{
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);
Filetype = ACR_LIBIDO;
std::string rows = GetEntryString(0x0028, 0x0010);
std::string columns = GetEntryString(0x0028, 0x0011);
* \brief Tries to open the file Document::Filename and
* checks the preamble when existing,
* or if the file starts with an ACR-NEMA look-like element.
* \brief Tries to open the file Document::Filename and
* checks the preamble when existing,
* or if the file starts with an ACR-NEMA look-like element.
//-- DICOM --
Fp->seekg(126L, std::ios::cur); // Once per Document
char dicm[4]; // = {' ',' ',' ',' '};
//-- DICOM --
Fp->seekg(126L, std::ios::cur); // Once per Document
char dicm[4]; // = {' ',' ',' ',' '};
//-- Broken ACR or DICOM (?) with no Preamble; may start with a Shadow Group --
// FIXME : We cannot be sure the preable is only zeroes..
// (see ACUSON-24-YBR_FULL-RLE.dcm )
//-- Broken ACR or DICOM (?) with no Preamble; may start with a Shadow Group --
// FIXME : We cannot be sure the preable is only zeroes..
// (see ACUSON-24-YBR_FULL-RLE.dcm )
zero == 0x0001 || zero == 0x0100 || zero == 0x0002 || zero == 0x0200 ||
zero == 0x0003 || zero == 0x0300 || zero == 0x0004 || zero == 0x0400 ||
zero == 0x0005 || zero == 0x0500 || zero == 0x0006 || zero == 0x0600 ||
zero == 0x0007 || zero == 0x0700 || zero == 0x0008 || zero == 0x0800 ||
zero == 0x0028 || 0x2800 // worse : some ACR-NEMA like files
zero == 0x0001 || zero == 0x0100 || zero == 0x0002 || zero == 0x0200 ||
zero == 0x0003 || zero == 0x0300 || zero == 0x0004 || zero == 0x0400 ||
zero == 0x0005 || zero == 0x0500 || zero == 0x0006 || zero == 0x0600 ||
zero == 0x0007 || zero == 0x0700 || zero == 0x0008 || zero == 0x0800 ||
zero == 0x0028 || 0x2800 // worse : some ACR-NEMA like files
// -- Neither ACR/No Preamble Dicom nor DICOMV3 file
CloseFile();
// Don't user Warning nor Error, not to pollute the output
// while directory recursive parsing ...
gdcmDebugMacro( "Neither ACR/No Preamble Dicom nor DICOMV3 file: "
// -- Neither ACR/No Preamble Dicom nor DICOMV3 file
CloseFile();
// Don't user Warning nor Error, not to pollute the output
// while directory recursive parsing ...
gdcmDebugMacro( "Neither ACR/No Preamble Dicom nor DICOMV3 file: "
* (ACR-NEMA, ExplicitVR, ImplicitVR)
*/
void Document::WriteContent(std::ofstream *fp, FileType filetype, bool, bool)
* (ACR-NEMA, ExplicitVR, ImplicitVR)
*/
void Document::WriteContent(std::ofstream *fp, FileType filetype, bool, bool)
bool delim_mode_intern = delim_mode;
bool first = true;
gdcmDebugMacro( "Enter in ParseDES, delim-mode " << delim_mode
bool delim_mode_intern = delim_mode;
bool first = true;
gdcmDebugMacro( "Enter in ParseDES, delim-mode " << delim_mode
std::cout << std::dec <<"(long)(Fp->tellg()) " << (long)(Fp->tellg()) // in Debug mode
<< std::hex << " 0x(" <<(long)(Fp->tellg()) << ")" << std::endl;
std::cout << std::dec <<"(long)(Fp->tellg()) " << (long)(Fp->tellg()) // in Debug mode
<< std::hex << " 0x(" <<(long)(Fp->tellg()) << ")" << std::endl;
// if ( !delim_mode && ((long)(Fp->tellg())-offset) >= l_max) // Once per DocEntry
if ( !delim_mode ) // 'and then' doesn't exist in C++ :-(
if ( ((long)(Fp->tellg())-offset) >= l_max) // Once per DocEntry, when no delim mode
// if ( !delim_mode && ((long)(Fp->tellg())-offset) >= l_max) // Once per DocEntry
if ( !delim_mode ) // 'and then' doesn't exist in C++ :-(
if ( ((long)(Fp->tellg())-offset) >= l_max) // Once per DocEntry, when no delim mode
// Uncoment this cerr line to be able to 'follow' the DocEntries
// when something *very* strange happens
// Uncoment this cerr line to be able to 'follow' the DocEntries
// when something *very* strange happens
std::cerr<<newDocEntry->GetKey()<<" "<<newDocEntry->GetVR()<<std::endl;
// an Item Starter found elsewhere but in the first position
std::cerr<<newDocEntry->GetKey()<<" "<<newDocEntry->GetVR()<<std::endl;
// an Item Starter found elsewhere but in the first position
bool outOfBounds = false;
if (!delim_mode )
if ( ((long)(Fp->tellg())-offset) >= l_max ) //Once per DataEntry when no delim mode
bool outOfBounds = false;
if (!delim_mode )
if ( ((long)(Fp->tellg())-offset) >= l_max ) //Once per DataEntry when no delim mode
if ( !delim_mode ) // 'and then' doesn't exist in C++ :-(
if ( ((long)(Fp->tellg())-offset) >= l_max) // Once per SeqEntry when no delim mode
if ( !delim_mode ) // 'and then' doesn't exist in C++ :-(
if ( ((long)(Fp->tellg())-offset) >= l_max) // Once per SeqEntry when no delim mode
// The most frequent is when a SQ terminator is missing (?!?)
gdcmWarningMacro("in ParseSQ : should never get here!");
UnexpectedEOF = true;
// The most frequent is when a SQ terminator is missing (?!?)
gdcmWarningMacro("in ParseSQ : should never get here!");
UnexpectedEOF = true;
// avoid infinite loop when Bad assumption was made on illegal 'unknown length' UN //JPRx
if (offsetStartCurrentSQItem <= OffsetOfPreviousParseDES)
// avoid infinite loop when Bad assumption was made on illegal 'unknown length' UN //JPRx
if (offsetStartCurrentSQItem <= OffsetOfPreviousParseDES)
/// \todo: a method that *doesn't* load anything (maybe with MaxSizeLoadEntry=0 ?)
/// + a ForceLoad call on the +/- 20 'usefull' fields
/// Allow user to tell the fields he wants to ForceLoad
/// \todo: a method that *doesn't* load anything (maybe with MaxSizeLoadEntry=0 ?)
/// + a ForceLoad call on the +/- 20 'usefull' fields
/// Allow user to tell the fields he wants to ForceLoad
// Delimiters (0xfffe), are not explicit VR ...
if ( CurrentGroup == 0xfffe )
return GDCM_VRUNKNOWN;
// Delimiters (0xfffe), are not explicit VR ...
if ( CurrentGroup == 0xfffe )
return GDCM_VRUNKNOWN;
// Warning: we believe this is explicit VR (Value Representation) because
// we used a heuristic that found "UL" in the first tag and/or
// 'Transfer Syntax' told us it is.
// Warning: we believe this is explicit VR (Value Representation) because
// we used a heuristic that found "UL" in the first tag and/or
// 'Transfer Syntax' told us it is.
gdcmWarningMacro( "Unknown VR " << vr.GetHexaRepresentation() << std::hex
<< " at offset : 0x(" << CurrentOffsetPosition-4
<< ") for group " << std::hex << CurrentGroup );
gdcmWarningMacro( "Unknown VR " << vr.GetHexaRepresentation() << std::hex
<< " at offset : 0x(" << CurrentOffsetPosition-4
<< ") for group " << std::hex << CurrentGroup );
// 'Leonardo' source. Hence, one might consider commenting out the
// following fix on efficiency reasons.
else if ( gr == 0x0009 && ( elem == 0x1113 || elem == 0x1114 ) )
// 'Leonardo' source. Hence, one might consider commenting out the
// following fix on efficiency reasons.
else if ( gr == 0x0009 && ( elem == 0x1113 || elem == 0x1114 ) )
// Ideally we should check we are in Explicit and double check
// that VR=UL... this is done properly in gdcm2
if( foundLength == 6 )
// Ideally we should check we are in Explicit and double check
// that VR=UL... this is done properly in gdcm2
if( foundLength == 6 )
gdcmWarningMacro( "Replacing Length from 6 into 4" );
foundLength = 4;
entry->SetReadLength(4); // a bug is to be fixed !
gdcmWarningMacro( "Replacing Length from 6 into 4" );
foundLength = 4;
entry->SetReadLength(4); // a bug is to be fixed !
// message and proceed on parsing (while crossing fingers).
long filePosition = Fp->tellg(); // Only when elem 0x0000 length is not 4 (?!?)
(void)filePosition;
// message and proceed on parsing (while crossing fingers).
long filePosition = Fp->tellg(); // Only when elem 0x0000 length is not 4 (?!?)
(void)filePosition;
<< std::hex << group << " , " << elem
<< ") -before- position x(" << filePosition << ")"
<< "lgt : " << length );
<< std::hex << group << " , " << elem
<< ") -before- position x(" << filePosition << ")"
<< "lgt : " << length );
dictEntry->Unregister(); // GetDictEntry registered it
// for VR = "UN", length is always stored on 4 bytes.
dictEntry->Unregister(); // GetDictEntry registered it
// for VR = "UN", length is always stored on 4 bytes.
{
// We thought this was explicit VR, but we end up with an
// implicit VR tag. Let's backtrack.
{
// We thought this was explicit VR, but we end up with an
// implicit VR tag. Let's backtrack.
int offset = Fp->tellg();//Only when heuristic for Explicit/Implicit was wrong
gdcmWarningMacro("Entry (" << newEntry->GetKey() << ") at x("
int offset = Fp->tellg();//Only when heuristic for Explicit/Implicit was wrong
gdcmWarningMacro("Entry (" << newEntry->GetKey() << ") at x("
// to trust manufacturers.
// (we often find 'Implicit VR' tag,
// even when Transfer Syntax tells us it's Explicit ...
// to trust manufacturers.
// (we often find 'Implicit VR' tag,
// even when Transfer Syntax tells us it's Explicit ...
if ( s == TS::DeflatedExplicitVRLittleEndian)
{
gdcmWarningMacro("Transfer Syntax ["
<< GetTransferSyntaxName() << "] :"
<< " not yet dealt with ");
if ( s == TS::DeflatedExplicitVRLittleEndian)
{
gdcmWarningMacro("Transfer Syntax ["
<< GetTransferSyntaxName() << "] :"
<< " not yet dealt with ");
// The following shouldn't occur very often
// Let's check at the very end.
if ( ts == GDCM_UNKNOWN )
{
gdcmDebugMacro("True DICOM File, with NO Transfer Syntax (?!) " );
// The following shouldn't occur very often
// Let's check at the very end.
if ( ts == GDCM_UNKNOWN )
{
gdcmDebugMacro("True DICOM File, with NO Transfer Syntax (?!) " );
if ( !Global::GetTS()->IsTransferSyntax(ts) )
{
gdcmWarningMacro("True DICOM File, with illegal Transfer Syntax: ["
<< ts << "]");
return;
if ( !Global::GetTS()->IsTransferSyntax(ts) )
{
gdcmWarningMacro("True DICOM File, with illegal Transfer Syntax: ["
<< ts << "]");
return;