The short answer is: Instead of getParentItem()
you should call getParent()
on the item in order to get the SQ element that contains this item, because a DcmSequenceOfItems
is not a DcmItem
. However, DcmDataset
is derived from DcmItem
, that's why you get the top-level DICOM data set when you call getParentItem()
on an item of a top-level SQ element. All this information should also be available from the API documentation (if not, please let me know and I'll improve it).
In principle, the DcmPathProcessor
could do what you want, but it is currently rather limited in terms of functionality and only supports the other direction, i.e. finds an item or element (or even multiple) from a given path.