DcmItem::search() returns a stack of DcmObject pointers as search results.
These pointers in most instances need to be casted to DcmItem, DcmElement
or a subclass of these. In many cases, the type of the object was not
properly checked before the typecast. This could lead to segmentation faults
when invalid DICOM datasets were processed where elements had the wrong
value representation.
Gbp-Pq: Name 0001-Fixed-unchecked-typecasts-of-DcmItem-search-results.patch
/*
*
- * Copyright (C) 1994-2023, OFFIS e.V.
+ * Copyright (C) 1994-2024, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
*/
virtual OFBool isLeaf() const { return OFTrue; }
+ /** check if this element can be safely casted to DcmElement
+ * @return true if DcmElement, false otherwise
+ */
+ virtual OFBool isElement() const { return OFTrue; }
+
/** check if value of this element is loaded into main memory
* @return true if value is present in memory, false if value still resides in file
*/
/*
*
- * Copyright (C) 1994-2020, OFFIS e.V.
+ * Copyright (C) 1994-2024, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
*/
virtual OFBool isLeaf() const = 0;
+ /** check if this element can be safely casted to DcmElement
+ * @return true if DcmElement, false otherwise
+ */
+ virtual OFBool isElement() const { return OFFalse; }
+
/** check if this element is nested in a sequence of items, i.e.\ not a
* top-level or stand-alone element
* @return true if this element is nested, false otherwise
OFBool first = OFTrue;
DcmStack stack1, stack2;
/* check whether attributes are equal */
- while (item1->nextObject(stack1, first).good() && item2->nextObject(stack2, first).good())
+ while (item1->nextObject(stack1, first).good() && item2->nextObject(stack2, first).good() && stack1.top()->isElement() && stack2.top()->isElement())
{
if (!compareAttributes(OFstatic_cast(DcmElement *, stack1.top()), OFstatic_cast(DcmElement *, stack2.top()), fromSequence, i++, reason))
break;
OFBool first = OFTrue;
DcmElement *delem = NULL;
/* iterate over all record elements */
- while (record->nextObject(stack, first).good() && (result || !abortCheck))
+ while (record->nextObject(stack, first).good() && (result || !abortCheck) && stack.top()->isElement())
{
delem = OFstatic_cast(DcmElement *, stack.top());
if ((delem != NULL) && (delem->getLength() > 0))
DCMDATA_ERROR("Internal ERROR in DcmDirectoryRecord::fillElementsAndReadSOP()");
}
uiP = new DcmUniqueIdentifier(refSOPClassTag); // (0004,1510)
- if (refFile->search(DCM_SOPClassUID, stack).good())
+ if (refFile->search(DCM_SOPClassUID, stack).good() && (stack.top()->ident() == EVR_UI))
{
char *uid = NULL;
OFstatic_cast(DcmUniqueIdentifier *, stack.top())->getString(uid);
insert(uiP, OFTrue);
uiP = new DcmUniqueIdentifier(refSOPInstTag); // (0004,1511)
- if (refFile->search(DCM_SOPInstanceUID, stack).good() || refFile->search(DCM_MediaStorageSOPInstanceUID, stack).good())
+ if ((refFile->search(DCM_SOPInstanceUID, stack).good() || refFile->search(DCM_MediaStorageSOPInstanceUID, stack).good()) && (stack.top()->ident() == EVR_UI))
{
char *uid = NULL;
OFstatic_cast(DcmUniqueIdentifier *, stack.top())->getString(uid);
insert(uiP, OFTrue);
uiP = new DcmUniqueIdentifier(refFileXferTag); // (0004,1512)
- if (refFile->search(DCM_TransferSyntaxUID, stack).good())
+ if (refFile->search(DCM_TransferSyntaxUID, stack).good() && (stack.top()->ident() == EVR_UI))
{
char *uid = NULL;
OFstatic_cast(DcmUniqueIdentifier *, stack.top())->getString(uid);
/*
*
- * Copyright (C) 1994-2022, OFFIS e.V.
+ * Copyright (C) 1994-2024, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
{
if ((writeMode == EWM_updateMeta) || (elem->getLength() == 0))
{
- if (dataset->search(DCM_SOPClassUID, stack).good())
+ if (dataset->search(DCM_SOPClassUID, stack).good() && (stack.top()->ident() == EVR_UI))
{
char *uid = NULL;
l_error = OFstatic_cast(DcmUniqueIdentifier *, stack.top())->getString(uid);
else if (DCM_dcmdataLogger.isEnabledFor(OFLogger::WARN_LOG_LEVEL))
{
// check whether UID in meta-header is identical to the one in the dataset
- if (dataset->search(DCM_SOPClassUID, stack).good())
+ if (dataset->search(DCM_SOPClassUID, stack).good() && (stack.top()->ident() == EVR_UI))
{
OFString uidDataset, uidMetaHeader;
OFstatic_cast(DcmUniqueIdentifier *, stack.top())->getOFStringArray(uidDataset);
{
if ((writeMode == EWM_updateMeta) || (elem->getLength() == 0))
{
- if (dataset->search(DCM_SOPInstanceUID, stack).good())
+ if (dataset->search(DCM_SOPInstanceUID, stack).good() && (stack.top()->ident() == EVR_UI))
{
char* uid = NULL;
l_error = OFstatic_cast(DcmUniqueIdentifier *, stack.top())->getString(uid);
else if (DCM_dcmdataLogger.isEnabledFor(OFLogger::WARN_LOG_LEVEL))
{
// check whether UID in meta-header is identical to the one in the dataset
- if (dataset->search(DCM_SOPInstanceUID, stack).good())
+ if (dataset->search(DCM_SOPInstanceUID, stack).good() && (stack.top()->ident() == EVR_UI))
{
OFString uidDataset, uidMetaHeader;
OFstatic_cast(DcmUniqueIdentifier *, stack.top())->getOFStringArray(uidDataset);
/* check whether meta header is present (and non-empty, i.e. contains elements) */
if (metainfo && !metainfo->isEmpty())
{
- if (metainfo->search(DCM_TransferSyntaxUID, stack).good())
+ if (metainfo->search(DCM_TransferSyntaxUID, stack).good() && (stack.top()->ident() == EVR_UI))
{
DcmUniqueIdentifier *xferUI = OFstatic_cast(DcmUniqueIdentifier *, stack.top());
if (xferUI->getTag() == DCM_TransferSyntaxUID)
/*
*
- * Copyright (C) 1994-2023, OFFIS e.V.
+ * Copyright (C) 1994-2024, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
DcmStack stack;
OFBool result = OFFalse;
- if (search(key, stack, ESM_fromHere, searchIntoSub).good())
+ if (search(key, stack, ESM_fromHere, searchIntoSub).good() && stack.top()->isElement())
{
DcmElement *elem = OFstatic_cast(DcmElement *, stack.top());
if (elem != NULL)
DcmStack stack;
/* find the element */
OFCondition status = search(tagKey, stack, ESM_fromHere, searchIntoSub);
- if (status.good())
+ if (status.good() && stack.top()->isElement())
{
element = OFstatic_cast(DcmElement *, stack.top());
/* should never happen but ... */
DcmStack stack;
/* find the element */
OFCondition status = search(seqTagKey, stack, ESM_fromHere, searchIntoSub);
- if (status.good())
+ if (status.good() && stack.top()->isElement())
{
DcmElement *delem = OFstatic_cast(DcmElement *, stack.top());
/* should never happen but ... */
DcmStack stack;
/* find sequence */
OFCondition status = search(seqTagKey, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
- if (status.good())
+ if (status.good() && stack.top()->isElement())
{
/* get element */
DcmElement *delem = OFstatic_cast(DcmElement *, stack.top());
OFCondition status = search(seqTag, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
DcmSequenceOfItems *sequence = NULL;
/* sequence found? */
- if (status.good())
+ if (status.good() && stack.top()->isElement())
{
/* get element */
DcmElement *delem = OFstatic_cast(DcmElement *, stack.top());
DcmStack stack;
/* find sequence */
OFCondition status = search(seqTagKey, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
- if (status.good())
+ if (status.good() && stack.top()->isElement())
{
/* get element */
DcmElement *delem = OFstatic_cast(DcmElement *, stack.top());
status = search(seqTag, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
DcmSequenceOfItems *sequence = NULL;
/* sequence found? */
- if (status.good())
+ if (status.good() && stack.top()->isElement())
{
/* get element */
DcmElement *delem = OFstatic_cast(DcmElement *, stack.top());
obj = Object;
// only search on main dataset level
if ((obj != NULL) && (obj->search(tag, stack, ESM_fromHere, OFFalse /* searchIntoSub */) == EC_Normal) &&
- (stack.top()->getLength(Xfer) > 0))
+ (stack.top()->getLength(Xfer) > 0) && stack.top()->isElement())
{
return OFstatic_cast(DcmElement *, stack.top());
}
DcmStack stack;
const DcmTagKey tagKey = delem.getTag();
OFCondition result = dataset.search(tagKey, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
- if (result.good())
+ if (result.good() && stack.top()->isElement())
{
/* copy object from search stack */
result = delem.copyFrom(*stack.top());
DcmStack stack;
OFCondition result = dataset.search(tagKey, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
- if (result.good())
+ if (result.good() && stack.top()->isElement())
{
/* copy object from search stack */
delem = OFstatic_cast(DcmElement*, stack.top()->clone());
/*
*
- * Copyright (C) 2001-2022, OFFIS e.V.
+ * Copyright (C) 2001-2024, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
DcmElement *explanation = NULL;
DcmStack stack;
- if ((dataset->search(DCM_WindowCenter, stack, ESM_fromHere, OFFalse)).good())
+ if ((dataset->search(DCM_WindowCenter, stack, ESM_fromHere, OFFalse)).good() && stack.top()->isElement())
{
center = OFreinterpret_cast(DcmElement*, stack.top());
}
stack.clear();
- if ((dataset->search(DCM_WindowWidth, stack, ESM_fromHere, OFFalse)).good())
+ if ((dataset->search(DCM_WindowWidth, stack, ESM_fromHere, OFFalse)).good() && stack.top()->isElement())
{
width = OFreinterpret_cast(DcmElement*, stack.top());
}
stack.clear();
- if ((dataset->search(DCM_WindowCenterWidthExplanation, stack, ESM_fromHere, OFFalse)).good())
+ if ((dataset->search(DCM_WindowCenterWidthExplanation, stack, ESM_fromHere, OFFalse)).good() && stack.top()->isElement())
{
explanation = OFreinterpret_cast(DcmElement*, stack.top());
}
/*
*
- * Copyright (C) 1996-2023, OFFIS e.V.
+ * Copyright (C) 1996-2024, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
return OFFalse;
}
+ if (! stack.top()->isElement())
+ {
+ OFLOG_ERROR(storescuLogger, "updateStringAttributeValue: not a DcmElement: " << tag.getTagName() << " " << key);
+ return OFFalse;
+ }
+
DcmElement *elem = OFstatic_cast(DcmElement *, stack.top());
DcmVR vr(elem->ident());
static OFCondition
getString(DcmDataset *obj, DcmTagKey t, char *s, int maxlen, OFBool *spacePadded)
{
- DcmElement *elem;
+ DcmElement *elem = NULL;
DcmStack stack;
OFCondition ec = EC_Normal;
char* aString;
ec = obj->search(t, stack);
- elem = (DcmElement*)stack.top();
- if (ec == EC_Normal && elem != NULL) {
+ if (ec.good() && stack.top()->isElement())
+ elem = (DcmElement*)stack.top();
+
+ if (elem != NULL) {
if (elem->getLength() == 0) {
s[0] = '\0';
} else if (elem->getLength() > (Uint32)maxlen) {
static OFCondition
getUS(DcmDataset *obj, DcmTagKey t, Uint16 *us)
{
- DcmElement *elem;
+ DcmElement *elem = NULL;
DcmStack stack;
OFCondition ec = EC_Normal;
ec = obj->search(t, stack);
- elem = (DcmElement*)stack.top();
- if (ec == EC_Normal && elem != NULL) {
+ if (ec.good() && stack.top()->isElement())
+ elem = (DcmElement*)stack.top();
+
+ if (elem != NULL) {
ec = elem->getUint16(*us, 0);
}
- return (ec == EC_Normal)?(EC_Normal):(DIMSE_PARSEFAILED);
+ return (ec.good())?(EC_Normal):(DIMSE_PARSEFAILED);
}
static OFCondition
static OFCondition
getUL(DcmDataset *obj, DcmTagKey t, Uint32 *ul)
{
- DcmElement *elem;
+ DcmElement *elem = NULL;
DcmStack stack;
OFCondition ec = EC_Normal;
ec = obj->search(t, stack);
- elem = (DcmElement*)stack.top();
- if (ec == EC_Normal && elem != NULL) {
+ if (ec.good() && stack.top()->isElement())
+ elem = (DcmElement*)stack.top();
+
+ if (elem != NULL) {
ec = elem->getUint32(*ul, 0);
}
- return (ec == EC_Normal)?(EC_Normal):(DIMSE_PARSEFAILED);
+ return (ec.good())?(EC_Normal):(DIMSE_PARSEFAILED);
}
#if 0
static OFCondition
getAttributeList(DcmDataset *obj, DcmTagKey t, Uint16 **lst, int *listCount)
{
- DcmElement *elem;
+ DcmElement *elem = NULL;
DcmStack stack;
OFCondition ec = EC_Normal;
Uint16 *aList = NULL;
Uint32 nBytes = 0;
ec = obj->search(t, stack);
- elem = (DcmElement*)stack.top();
- if (ec == EC_Normal && elem != NULL) {
+ if (ec.good() && stack.top()->isElement())
+ elem = (DcmElement*)stack.top();
+
+ if (elem) {
nBytes = elem->getLength();
*listCount = (int)(nBytes / sizeof(Uint16));
if (*listCount > 0) {
}
}
- return (ec == EC_Normal)?(EC_Normal):(DIMSE_PARSEFAILED);
+ return (ec.good())?(EC_Normal):(DIMSE_PARSEFAILED);
}
/*
OFBool
DU_getStringDOElement(DcmItem *obj, DcmTagKey t, char *s, size_t bufsize)
{
- DcmByteString *elem;
DcmStack stack;
- OFCondition ec = EC_Normal;
char* aString;
- ec = obj->search(t, stack);
- elem = (DcmByteString*) stack.top();
- if (ec == EC_Normal && elem != NULL) {
+ OFCondition ec = obj->search(t, stack);
+ if (ec.good() && (stack.top() != NULL) && stack.top()->isElement()) {
+ DcmElement *elem = (DcmElement *) stack.top();
if (elem->getLength() == 0) {
s[0] = '\0';
} else {
ec = elem->getString(aString);
- if (ec == EC_Normal)
+ if (ec.good())
OFStandard::strlcpy(s, aString, bufsize);
}
}
- return (ec == EC_Normal);
+ return (ec.good());
}
OFBool
ec = obj->insert(e, OFTrue);
}
- return (ec == EC_Normal);
+ return (ec.good());
}
OFBool
{
DcmElement *elem;
DcmStack stack;
- OFCondition ec = EC_Normal;
- ec = obj->search(t, stack);
- elem = (DcmElement*) stack.top();
- if (ec == EC_Normal && elem != NULL) {
- ec = elem->getUint16(*us, 0);
+ OFCondition ec = obj->search(t, stack);
+ if (ec.good() && stack.top()->isElement())
+ {
+ elem = (DcmElement*) stack.top();
+ if (elem) ec = elem->getUint16(*us, 0);
}
- return (ec == EC_Normal);
+ return (ec.good());
}
OFBool
if (ec == EC_Normal) {
ec = obj->insert(e, OFTrue);
}
- return (ec == EC_Normal);
+ return (ec.good());
}
OFBool
OFFilename dirName;
OFStandard::getDirNameFromPath(dirName, filename, OFFalse /* assumeDirName */);
// iterate over all items (directory records) where ReferencedFileID is present
- while (dataset->search(DCM_ReferencedFileID, stack, ESM_afterStackTop, OFTrue).good())
+ while (dataset->search(DCM_ReferencedFileID, stack, ESM_afterStackTop, OFTrue).good() && stack.top()->isElement())
{
// make sure that the dataset and element pointer are there
if (stack.card() > 1)
/*
*
- * Copyright (C) 1998-2023, OFFIS e.V.
+ * Copyright (C) 1998-2024, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
{
// search existing sequence
DcmStack stack;
- if (EC_Normal == dataset->search(DCM_PresentationLUTSequence, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == dataset->search(DCM_PresentationLUTSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
dseq=(DcmSequenceOfItems *)stack.top();
}
if (dseq == NULL)
{
// search existing sequence
DcmStack stack;
- if (EC_Normal == dataset->search(DCM_VOILUTSequence, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == dataset->search(DCM_VOILUTSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
dseq=(DcmSequenceOfItems *)stack.top();
}
if (dseq == NULL)
/*
*
- * Copyright (C) 2000-2023, OFFIS e.V.
+ * Copyright (C) 2000-2024, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
OFOStringStream str;
ec = dset->search(key, stack, ESM_fromHere, OFFalse);
- elem = (DcmElement*) stack.top();
+ if (ec.good() && stack.top()->isElement())
+ {
+ elem = (DcmElement*) stack.top();
+ }
+
if (elem)
elem->print(str, DCMTypes::PF_shortenLongTagValues);
else
if (reference != NULL)
{
DcmStack stack;
- if (dataset->search(DCM_ContentDescription, stack, ESM_fromHere, OFFalse) == EC_Normal)
+ if (dataset->search(DCM_ContentDescription, stack, ESM_fromHere, OFFalse) == EC_Normal && (stack.top()->ident() == EVR_LO))
{
char *value = NULL;
if ((*OFstatic_cast(DcmLongString *, stack.top())).getString(value) == EC_Normal)
reference->Description = value;
}
stack.clear();
- if (dataset->search(DCM_ContentLabel, stack, ESM_fromHere, OFFalse) == EC_Normal)
+ if (dataset->search(DCM_ContentLabel, stack, ESM_fromHere, OFFalse) == EC_Normal && (stack.top()->ident() == EVR_LO))
{
char *value = NULL;
if ((*OFstatic_cast(DcmLongString *, stack.top())).getString(value) == EC_Normal)
DcmDataset *dset = fileformat.getDataset();
if (dset)
{
- if (EC_Normal == dset->search(DCM_SOPInstanceUID, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == dset->search(DCM_SOPInstanceUID, stack, ESM_fromHere, OFFalse) && stack.top()->isElement())
{
OFstatic_cast(DcmElement *, stack.top())->getString(instanceUID);
}
stack.clear();
- if (EC_Normal == dset->search(DCM_SOPClassUID, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == dset->search(DCM_SOPClassUID, stack, ESM_fromHere, OFFalse) && stack.top()->isElement())
{
OFstatic_cast(DcmElement *, stack.top())->getString(classUID);
}
DVPSPresentationLUT presentationLUT;
if (EC_Normal != presentationLUT.read(*dataset, OFFalse)) presentationLUT.setType(DVPSP_identity);
result = dataset->search(sopclassuid.getTag(), stack, ESM_fromHere, OFFalse);
- if (EC_Normal == result)
+ if (EC_Normal == result && (stack.top()->ident() == EVR_UI))
{
char *sopclass = NULL;
sopclassuid = *OFstatic_cast(DcmUniqueIdentifier *, stack.top());
/*
*
- * Copyright (C) 1999-2010, OFFIS e.V.
+ * Copyright (C) 1999-2024, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
DcmSequenceOfItems *dseq=NULL;
DcmItem *ditem=NULL;
- if (EC_Normal == dset.search(DCM_RETIRED_AnnotationContentSequence, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == dset.search(DCM_RETIRED_AnnotationContentSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
{
dseq=(DcmSequenceOfItems *)stack.top();
if (dseq)
/*
*
- * Copyright (C) 1998-2020, OFFIS e.V.
+ * Copyright (C) 1998-2024, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
/* first we look for the Curve Data */
DcmTagKey key(0x5000 + group,0x3000);
- if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse) && stack.top()->isElement())
{
d_curveData = (DcmElement *)(stack.top());
} else return EC_IllegalCall;
key.setElement(0x0005); // Curve Dimensions
stack.clear();
- if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse) && stack.top()->isElement())
{
d_curveDimensions = (DcmElement *)(stack.top());
} else return EC_IllegalCall;
key.setElement(0x0010); // Number of Points
stack.clear();
- if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse) && stack.top()->isElement())
{
d_numberOfPoints = (DcmElement *)(stack.top());
} else return EC_IllegalCall;
key.setElement(0x0020); // Type of Data
stack.clear();
- if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse) && stack.top()->isElement())
{
d_typeOfData = (DcmElement *)(stack.top());
} else return EC_IllegalCall;
key.setElement(0x0103); // Data Value Representation
stack.clear();
- if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse) && stack.top()->isElement())
{
d_dataVR = (DcmElement *)(stack.top());
} else return EC_IllegalCall;
key.setElement(0x0022); // Curve Description
stack.clear();
- if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse) && stack.top()->isElement())
{
d_curveDescription = (DcmElement *)(stack.top());
}
key.setElement(0x0030); // Axis Units
stack.clear();
- if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse) && stack.top()->isElement())
{
d_axisUnits = (DcmElement *)(stack.top());
}
key.setElement(0x2500); // Curve Label
stack.clear();
- if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse) && stack.top()->isElement())
{
d_curveLabel = (DcmElement *)(stack.top());
}
/*
*
- * Copyright (C) 1999-2010, OFFIS e.V.
+ * Copyright (C) 1999-2024, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
DcmSequenceOfItems *dseq=NULL;
DcmItem *ditem=NULL;
- if (EC_Normal == dset.search(DCM_DisplayedAreaSelectionSequence, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == dset.search(DCM_DisplayedAreaSelectionSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
{
dseq=(DcmSequenceOfItems *)stack.top();
if (dseq)
/*
*
- * Copyright (C) 1998-2021, OFFIS e.V.
+ * Copyright (C) 1998-2024, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search(DCM_ReferencedPresentationLUTSequence, stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search(DCM_ReferencedPresentationLUTSequence, stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_SQ))
{
DcmSequenceOfItems *seq=(DcmSequenceOfItems *)stack.top();
if (seq->card() ==1)
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)numberOfCopies.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)numberOfCopies.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_IS))
{
numberOfCopies = *((DcmIntegerString *)(stack.top()));
Sint32 numCopies=0;
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)printPriority.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)printPriority.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_CS))
{
printPriority = *((DcmCodeString *)(stack.top()));
OFString aString;
{
Uint32 numMediumTypes = cfg.getTargetPrinterNumberOfMediumTypes(cfgname);
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)mediumType.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)mediumType.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_CS))
{
mediumType = *((DcmCodeString *)(stack.top()));
OFString theMedium;
{
Uint32 numFilmDestination = cfg.getTargetPrinterNumberOfFilmDestinations(cfgname);
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)filmDestination.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)filmDestination.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_CS))
{
filmDestination = *((DcmCodeString *)(stack.top()));
OFString theDestination;
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)filmSessionLabel.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)filmSessionLabel.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_LO))
{
filmSessionLabel = *((DcmLongString *)(stack.top()));
ADD_TO_PDATASET(DcmLongString, filmSessionLabel)
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)ownerID.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)ownerID.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_SH))
{
ownerID = *((DcmShortString *)(stack.top()));
ADD_TO_PDATASET(DcmShortString, ownerID)
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)illumination.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)illumination.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
{
illumination = *((DcmUnsignedShort *)(stack.top()));
// we don't check illumination set by the user (for now)
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)reflectedAmbientLight.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)reflectedAmbientLight.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
{
reflectedAmbientLight = *((DcmUnsignedShort *)(stack.top()));
// we don't check reflected ambient light set by the user (for now)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search(DCM_ReferencedPresentationLUTSequence, stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search(DCM_ReferencedPresentationLUTSequence, stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_SQ))
{
DcmSequenceOfItems *seq=(DcmSequenceOfItems *)stack.top();
if (seq->card() ==1)
/*
*
- * Copyright (C) 1998-2010, OFFIS e.V.
+ * Copyright (C) 1998-2024, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
DcmSequenceOfItems *dseq=NULL;
DcmItem *ditem=NULL;
- if (EC_Normal == dset.search(DCM_GraphicAnnotationSequence, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == dset.search(DCM_GraphicAnnotationSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
{
dseq=(DcmSequenceOfItems *)stack.top();
if (dseq)
/*
*
- * Copyright (C) 1998-2017, OFFIS e.V.
+ * Copyright (C) 1998-2024, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
DcmSequenceOfItems *dseq=NULL;
DcmItem *ditem=NULL;
- if (EC_Normal == dset.search(DCM_GraphicLayerSequence, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == dset.search(DCM_GraphicLayerSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
{
dseq=(DcmSequenceOfItems *)stack.top();
if (dseq)
/*
*
- * Copyright (C) 1998-2010, OFFIS e.V.
+ * Copyright (C) 1998-2024, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
DcmSequenceOfItems *dseq=NULL;
DcmItem *ditem=NULL;
- if (EC_Normal == dset.search(DCM_GraphicObjectSequence, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == dset.search(DCM_GraphicObjectSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
{
dseq=(DcmSequenceOfItems *)stack.top();
if (dseq)
{
item = seq.getItem(i);
stack.clear();
- if (EC_Normal == item->search(DCM_ReferencedSOPClassUID, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == item->search(DCM_ReferencedSOPClassUID, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_UI))
{
aString.clear();
refuid = (DcmUniqueIdentifier *)(stack.top());
/*
*
- * Copyright (C) 1998-2018, OFFIS e.V.
+ * Copyright (C) 1998-2024, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
if (result==EC_Normal)
{
stack.clear();
- if (EC_Normal == dset.search(DCM_ReferencedImageSequence, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == dset.search(DCM_ReferencedImageSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
{
seq=(DcmSequenceOfItems *)stack.top();
if (seq->card() ==1)
// check referenced presentation LUT sequence
// if there is any reference, it must refer to one of the presentation LUTs we are managing.
stack.clear();
- if (EC_Normal == dset.search(DCM_ReferencedPresentationLUTSequence, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == dset.search(DCM_ReferencedPresentationLUTSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
{
seq=(DcmSequenceOfItems *)stack.top();
if (seq->card() ==1)
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)imageBoxPosition.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)imageBoxPosition.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
{
imageBoxPosition = *((DcmUnsignedShort *)(stack.top()));
// the image box position is checked elsewhere
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)magnificationType.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)magnificationType.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_CS))
{
magnificationType = *((DcmCodeString *)(stack.top()));
Uint32 numMagnifications = cfg.getTargetPrinterNumberOfMagnificationTypes(cfgname);
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)smoothingType.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)smoothingType.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_CS))
{
smoothingType = *((DcmCodeString *)(stack.top()));
Uint32 numSmoothings = cfg.getTargetPrinterNumberOfSmoothingTypes(cfgname);
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)configurationInformation.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)configurationInformation.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_ST))
{
configurationInformation = *((DcmShortText *)(stack.top()));
Uint32 numConfigurationInformation = cfg.getTargetPrinterNumberOfConfigurationSettings(cfgname);
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)polarity.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)polarity.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_CS))
{
polarity = *((DcmCodeString *)(stack.top()));
OFString thePolarity;
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)requestedImageSize.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)requestedImageSize.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_DS))
{
if (! cfg.getTargetPrinterSupportsRequestedImageSize(cfgname))
{
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)requestedDecimateCropBehavior.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)requestedDecimateCropBehavior.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_CS))
{
if (! cfg.getTargetPrinterSupportsDecimateCrop(cfgname))
{
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search(DCM_BasicGrayscaleImageSequence, stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search(DCM_BasicGrayscaleImageSequence, stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_SQ))
{
DcmSequenceOfItems *seq=(DcmSequenceOfItems *)stack.top();
if (seq->card() ==1)
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)samplesPerPixel.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)samplesPerPixel.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
{
samplesPerPixel = *((DcmUnsignedShort *)(stack.top()));
val = 0;
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)rows.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)rows.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
{
rows = *((DcmUnsignedShort *)(stack.top()));
val = 0;
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)columns.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)columns.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
{
columns = *((DcmUnsignedShort *)(stack.top()));
val = 0;
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)bitsStored.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)bitsStored.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
{
bitsStored = *((DcmUnsignedShort *)(stack.top()));
val = 0;
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)bitsAllocated.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)bitsAllocated.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
{
bitsAllocated = *((DcmUnsignedShort *)(stack.top()));
val = 0;
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)highBit.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)highBit.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
{
highBit = *((DcmUnsignedShort *)(stack.top()));
val = 0;
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)pixelRepresentation.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)pixelRepresentation.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
{
pixelRepresentation = *((DcmUnsignedShort *)(stack.top()));
val = 0;
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)photometricInterpretation.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)photometricInterpretation.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_CS))
{
photometricInterpretation = *((DcmCodeString *)(stack.top()));
OFString theColorModel;
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)pixelAspectRatio.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)pixelAspectRatio.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_IS))
{
pixelAspectRatio = *((DcmIntegerString *)(stack.top()));
if (pixelAspectRatio.getVM() != 2)
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search(DCM_PixelData, stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search(DCM_PixelData, stack, ESM_fromHere, OFFalse)) && stack.top()->isElement())
{
pixelData = new DcmPixelData(DCM_PixelData);
if (pixelData)
/*
*
- * Copyright (C) 1999-2010, OFFIS e.V.
+ * Copyright (C) 1999-2024, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
DcmSequenceOfItems *dseq=NULL;
DcmItem *ditem=NULL;
- if (EC_Normal == dset.search(DCM_RETIRED_ImageBoxContentSequence, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == dset.search(DCM_RETIRED_ImageBoxContentSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
{
dseq=(DcmSequenceOfItems *)stack.top();
if (dseq)
/*
*
- * Copyright (C) 1999-2022, OFFIS e.V.
+ * Copyright (C) 1999-2024, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
DcmSequenceOfItems *dseq=NULL;
DcmItem *ditem=NULL;
- if (EC_Normal == dset.search(DCM_RETIRED_PresentationLUTContentSequence, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == dset.search(DCM_RETIRED_PresentationLUTContentSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
{
dseq=(DcmSequenceOfItems *)stack.top();
if (dseq)
/*
*
- * Copyright (C) 1998-2022, OFFIS e.V.
+ * Copyright (C) 1998-2024, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
DcmSequenceOfItems *dseq=NULL;
DcmItem *ditem=NULL;
- if (EC_Normal == dset.search(DCM_ReferencedImageSequence, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == dset.search(DCM_ReferencedImageSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
{
dseq=(DcmSequenceOfItems *)stack.top();
if (dseq)
/*
*
- * Copyright (C) 1998-2010, OFFIS e.V.
+ * Copyright (C) 1998-2024, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
DcmSequenceOfItems *dseq=NULL;
DcmItem *ditem=NULL;
- if (EC_Normal == dset.search(DCM_ReferencedSeriesSequence, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == dset.search(DCM_ReferencedSeriesSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
{
dseq=(DcmSequenceOfItems *)stack.top();
if (dseq)
/*
*
- * Copyright (C) 1998-2021, OFFIS e.V.
+ * Copyright (C) 1998-2024, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
if (result==EC_Normal)
{
stack.clear();
- if (EC_Normal == dset.search(DCM_RETIRED_FilmBoxContentSequence, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == dset.search(DCM_RETIRED_FilmBoxContentSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
{
seq=(DcmSequenceOfItems *)stack.top();
if (seq->card() ==1)
// check referenced presentation LUT sequence
// if there is any reference, it must refer to one of the presentation LUTs we are managing.
stack.clear();
- if (EC_Normal == item->search(DCM_ReferencedPresentationLUTSequence, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == item->search(DCM_ReferencedPresentationLUTSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
{
seq=(DcmSequenceOfItems *)stack.top();
if (seq->card() ==1)
if (result==EC_Normal)
{
stack.clear();
- if (EC_Normal == dset.search(DCM_RETIRED_PrintManagementCapabilitiesSequence, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == dset.search(DCM_RETIRED_PrintManagementCapabilitiesSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
{
OFBool haveFilmBox = OFFalse;
OFBool haveGrayscaleImageBox = OFFalse;
destination.clear();
printerName.clear();
stack.clear();
- if (EC_Normal == dset.search(DCM_RETIRED_PrinterCharacteristicsSequence, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == dset.search(DCM_RETIRED_PrinterCharacteristicsSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
{
seq = (DcmSequenceOfItems *)stack.top();
if (seq->card() > 0)
{
// N-CREATE was successful, now evaluate Referenced Image Box SQ
stack.clear();
- if (EC_Normal == attributeListOut->search(DCM_ReferencedImageBoxSequence, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == attributeListOut->search(DCM_ReferencedImageBoxSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
{
seq=(DcmSequenceOfItems *)stack.top();
numItems = (size_t)seq->card();
// evaluate Referenced Basic Annotation Box SQ if present
stack.clear();
annotationContentList.clearAnnotationSOPInstanceUIDs();
- if (EC_Normal == attributeListOut->search(DCM_ReferencedBasicAnnotationBoxSequence, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == attributeListOut->search(DCM_ReferencedBasicAnnotationBoxSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
{
seq=(DcmSequenceOfItems *)stack.top();
numItems = (size_t)seq->card();
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search(DCM_ReferencedPresentationLUTSequence, stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search(DCM_ReferencedPresentationLUTSequence, stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_SQ))
{
DcmSequenceOfItems *seq=(DcmSequenceOfItems *)stack.top();
if (seq->card() ==1)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search(DCM_ReferencedFilmSessionSequence, stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search(DCM_ReferencedFilmSessionSequence, stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_SQ))
{
DcmUniqueIdentifier classUID(DCM_ReferencedSOPClassUID);
DcmUniqueIdentifier instanceUID(DCM_ReferencedSOPInstanceUID);
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)magnificationType.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)magnificationType.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_CS))
{
magnificationType = *((DcmCodeString *)(stack.top()));
Uint32 numMagnifications = cfg.getTargetPrinterNumberOfMagnificationTypes(cfgname);
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)smoothingType.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)smoothingType.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_CS))
{
smoothingType = *((DcmCodeString *)(stack.top()));
Uint32 numSmoothings = cfg.getTargetPrinterNumberOfSmoothingTypes(cfgname);
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)borderDensity.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)borderDensity.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_CS))
{
borderDensity = *((DcmCodeString *)(stack.top()));
Uint32 numBorderDensities = cfg.getTargetPrinterNumberOfBorderDensities(cfgname);
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)emptyImageDensity.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)emptyImageDensity.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_CS))
{
emptyImageDensity = *((DcmCodeString *)(stack.top()));
Uint32 numEmptyImageDensities = cfg.getTargetPrinterNumberOfEmptyImageDensities(cfgname);
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)maxDensity.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)maxDensity.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
{
maxDensity = *((DcmUnsignedShort *)(stack.top()));
// we don't check a max density set by the user (for now)
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)minDensity.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)minDensity.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
{
minDensity = *((DcmUnsignedShort *)(stack.top()));
Uint32 numMinDensities = cfg.getTargetPrinterNumberOfMinDensities(cfgname);
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)trim.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)trim.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_CS))
{
trim = *((DcmCodeString *)(stack.top()));
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)configurationInformation.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)configurationInformation.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_ST))
{
configurationInformation = *((DcmShortText *)(stack.top()));
Uint32 numConfigurationInformation = cfg.getTargetPrinterNumberOfConfigurationSettings(cfgname);
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)illumination.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)illumination.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
{
illumination = *((DcmUnsignedShort *)(stack.top()));
// we don't check illumination set by the user (for now)
if (result)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)reflectedAmbientLight.getTag(), stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)reflectedAmbientLight.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
{
reflectedAmbientLight = *((DcmUnsignedShort *)(stack.top()));
// we don't check reflected ambient light set by the user (for now)
{
stack.clear();
- if (rqDataset && (EC_Normal == rqDataset->search(DCM_ReferencedPresentationLUTSequence, stack, ESM_fromHere, OFFalse)))
+ if (rqDataset && (EC_Normal == rqDataset->search(DCM_ReferencedPresentationLUTSequence, stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_SQ))
{
DcmSequenceOfItems *seq=(DcmSequenceOfItems *)stack.top();
if (seq->card() ==1)
/*
*
- * Copyright (C) 1998-2010, OFFIS e.V.
+ * Copyright (C) 1998-2024, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
DcmSequenceOfItems *dseq=NULL;
DcmItem *ditem=NULL;
- if (EC_Normal == dset.search(DCM_TextObjectSequence, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == dset.search(DCM_TextObjectSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
{
dseq=(DcmSequenceOfItems *)stack.top();
if (dseq)
/*
*
- * Copyright (C) 1998-2010, OFFIS e.V.
+ * Copyright (C) 1998-2024, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
DcmSequenceOfItems *dseq=NULL;
DcmItem *ditem=NULL;
- if (EC_Normal == dset.search(DCM_VOILUTSequence, stack, ESM_fromHere, OFFalse))
+ if (EC_Normal == dset.search(DCM_VOILUTSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
{
dseq=(DcmSequenceOfItems *)stack.top();
if (dseq)
/*
*
- * Copyright (c) 2008-2021, OFFIS e.V. and ICSMED AG, Oldenburg, Germany
- * Copyright (C) 2013-2021, J. Riesmeier, Oldenburg, Germany
+ * Copyright (c) 2008-2024, OFFIS e.V. and ICSMED AG, Oldenburg, Germany
+ * Copyright (C) 2013-2024, J. Riesmeier, Oldenburg, Germany
* All rights reserved. See COPYRIGHT file for details.
*
* Source file for class DRTTypes
*
* Generated manually based on dsrtypes.cc
- * File created on 2008-12-05
- * Last modified on 2016-02-12 by Riesmeier
*
*/
{
DcmStack stack;
OFCondition result = dataset.search(tagKey, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
- if (result.good())
+ if (result.good() && stack.top()->isElement())
{
DcmElement *element = OFstatic_cast(DcmElement *, stack.top());
if (element != NULL)
/*
*
- * Copyright (C) 2000-2023, OFFIS e.V.
+ * Copyright (C) 2000-2024, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
macid = 0xFFFF;
DcmStack stack;
OFCondition result = item.search(DCM_MACIDNumber, stack, ESM_fromHere, OFFalse);
- if (result.good() && (stack.top()->isLeaf()))
+ if (result.good() && (stack.top()->isElement()))
{
result = ((DcmElement *)(stack.top()))->getUint16(macid);
}
// read MAC Calculation Transfer Syntax UID
if (result.good())
{
- if ((selectedMacParametersItem->search(DCM_MACCalculationTransferSyntaxUID, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isLeaf()))
+ if ((selectedMacParametersItem->search(DCM_MACCalculationTransferSyntaxUID, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isElement()))
{
char *uid = NULL;
if ((((DcmElement *)(stack.top()))->getString(uid)).good())
if (result.good())
{
stack.clear();
- if ((selectedMacParametersItem->search(DCM_MACAlgorithm, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isLeaf()))
+ if ((selectedMacParametersItem->search(DCM_MACAlgorithm, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isElement()))
{
OFString macidentifier;
if ((((DcmElement *)(stack.top()))->getOFString(macidentifier, 0)).good())
if (result.good())
{
stack.clear();
- if ((selectedSignatureItem->search(DCM_Signature, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isLeaf()))
+ if ((selectedSignatureItem->search(DCM_Signature, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->ident() == EVR_OB))
{
signature = new DcmOtherByteOtherWord(*((DcmOtherByteOtherWord *)(stack.top())));
if (signature == NULL) result = EC_MemoryExhausted;
DcmStack stack;
// read MAC Calculation Transfer Syntax UID
- if ((selectedMacParametersItem->search(DCM_MACCalculationTransferSyntaxUID, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isLeaf()))
+ if ((selectedMacParametersItem->search(DCM_MACCalculationTransferSyntaxUID, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isElement()))
{
char *uid = NULL;
if ((((DcmElement *)(stack.top()))->getString(uid)).good() && uid)
DcmStack stack;
// read MAC Algorithm
- if ((selectedMacParametersItem->search(DCM_MACAlgorithm, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isLeaf()))
+ if ((selectedMacParametersItem->search(DCM_MACAlgorithm, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isElement()))
{
if ((((DcmElement *)(stack.top()))->getOFString(str, 0)).good()) result = EC_Normal;
}
DcmStack stack;
// read signature UID
- if ((selectedSignatureItem->search(DCM_DigitalSignatureUID, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isLeaf()))
+ if ((selectedSignatureItem->search(DCM_DigitalSignatureUID, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isElement()))
{
if ((((DcmElement *)(stack.top()))->getOFString(str, 0)).good()) result = EC_Normal;
}
DcmStack stack;
// read signature date/time
- if ((selectedSignatureItem->search(DCM_DigitalSignatureDateTime, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isLeaf()))
+ if ((selectedSignatureItem->search(DCM_DigitalSignatureDateTime, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isElement()))
{
if ((((DcmElement *)(stack.top()))->getOFString(str, 0)).good()) result = EC_Normal;
}
// check MAC Calculation Transfer Syntax UID
if (result.good())
{
- if ((selectedMacParametersItem->search(DCM_MACCalculationTransferSyntaxUID, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isLeaf()))
+ if ((selectedMacParametersItem->search(DCM_MACCalculationTransferSyntaxUID, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isElement()))
{
char *uid = NULL;
if ((((DcmElement *)(stack.top()))->getString(uid)).good())
{
E_MACType mac = EMT_RIPEMD160;
stack.clear();
- if ((selectedMacParametersItem->search(DCM_MACAlgorithm, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isLeaf()))
+ if ((selectedMacParametersItem->search(DCM_MACAlgorithm, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isElement()))
{
OFString macidentifier;
if ((((DcmElement *)(stack.top()))->getOFString(macidentifier, 0)).good())
OFString aString;
DcmStack stack;
result = item.search(DCM_CertificateType, stack, ESM_fromHere, OFFalse);
- if (result.good())
+ if (result.good() && stack.top()->isElement())
{
result = ((DcmElement *)(stack.top()))->getOFString(aString, 0);
if (result.good())
{
stack.clear();
result = item.search(DCM_CertificateOfSigner, stack, ESM_fromHere, OFFalse);
- if (result.good())
+ if (result.good() && stack.top()->isElement())
{
DcmElement *cert = (DcmElement *)stack.top();
Uint8 *data = NULL;
/*
*
- * Copyright (C) 2000-2023, OFFIS e.V.
+ * Copyright (C) 2000-2024, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
DcmStack stack;
const DcmTagKey tagKey = delem.getTag();
OFCondition result = dataset.search(tagKey, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
- if (result.good())
+ if (result.good() && stack.top()->isElement())
{
/* copy object from search stack */
result = delem.copyFrom(*stack.top());
{
DcmStack stack;
OFCondition result = dataset.search(tagKey, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
- if (result.good())
+ if (result.good() && stack.top()->isElement())
{
DcmElement *delem = OFstatic_cast(DcmElement *, stack.top());
/* we need a reference to the original element in order to determine the SpecificCharacterSet */