I am actually not an expert and this is my first topic in the forum, so pleas forgive me if the question is silly. I was using a call like
Code: Select all
if (dataset->findAndGetOFStringArray(tag, value).good())
to check if a specific tag is existing in a dataset. This was working fine for single-frage dicom. For multi-frame disoms, this fails if the tag does not exist in the common tags. So, I wrote a function (see below) to generalize the test. The function is (first) supposed to the same test above and if it fails, it searches in the SharedFunctionalGroupsSequence.
The function does not seem to work properly. I used it to check for DCM_PixelSpacing. The input file contains the tag within the Shared Functional Groups Sequence, as I can see this by opening the file using MicroDicom software. Following the printed debugging text, the sequence itself is being found, but the last test always fails.
Do you see any reason for this? Am I writing something wrong?
Much thanks,
Zein
PS: This is my function
Code: Select all
bool DicomClass::isTagPresentInDataset(DcmDataset* dataset, const DcmTagKey& tag, OFString& value)
{
if (!dataset)
return false;
if (dataset->findAndGetOFStringArray(tag, value).good())
{
return true;
}
else
{
printf("Tag: %s\n", tag.toString());
DcmItem* dcmItem;
if (dataset->findAndGetSequenceItem(DCM_SharedFunctionalGroupsSequence, dcmItem, 0).good())
{
printf("SharedFunctionalGroupsSequence found\n");
if (dcmItem->findAndGetOFStringArray(tag, value).good()) // this seems to not work !!!!!!!!
{
printf("tag found in SharedFunctionalGroupsSequence\n");
return true;
}
}
}
return false;
}