I’m new to slicer and python. Currently I’m trying to write an extension that involves reading nested dicom files. I can read normal files using this code…
aquisitionModality[volumeNumber] = slicer.dicomDatabase.fileValue(filename,'0008,0060')
but I have been unable to read nested tags such as (0008,1032) (fffe,e000) (0008,0104) - where the tags are labelled in this order in the DICOM File Metadata display. I’m sure I must be missing something very simple…
To access DICOM tags within sequence (SQ) tags, you can get the DICOM filename as described here, then use pydicom (bundled with Slicer) to read the file and retrieve any values.
this has no direct answer but here it is how to do it using pydicom
plan = dicom.read_file(filename)
aquisitionModality[volumeNumber] = float(plan[0x08,0x1032][0x08,0x0104].value)
You have to nest the tags, the (fffe,e000) accounts for the list so unravel using