Hi everyone,
I had to implement a check, if a file to import has dicom-data associated.
Hence, I took a look at the example in the script repository.
However, I tried different approaches, which resulted in (for me) unexpected results.
Node:
ID: 2555
DataNode: vtkMRMLScalarVolumeNode
Name (from DataNode): TestName
Parent: 2557
Children:
OwnerPluginName: Volumes
Expanded: true
UIDs:
DICOM:2.16.840.1.114033.0.20170412.2476798.0.1
DICOMInstanceUID:2.16.840.1.114033.0.20170412.2476798.0.1.1
Attributes:
DICOM.Modality:PT
DICOM.ReferencedInstanceUIDs:
DICOM.SeriesNumber:1000
Function:
>> shNode = slicer.vtkMRMLSubjectHierarchyNode.GetSubjectHierarchyNode(slicer.mrmlScene)
>>> attribute = shNode.GetItemAttribute(2555, 'DICOM.instanceUIDs')
>>> attribute
''
>>> attribute = shNode.GetItemDataNode(2555).GetAttribute('DICOM.instanceUIDs')
>>> attribute
'2.16.840.1.114033.0.20170412.2476798.0.1.1'
The same applies to attribute names:
>>> names = shNode.GetItemDataNode(2555).GetAttributeNames()
>>> names
('DICOM.instanceUIDs',)
>>> names = shNode.GetItemAttributeNames(2555)
>>> names
('DICOM.Modality', 'DICOM.ReferencedInstanceUIDs', 'DICOM.SeriesNumber')
Hence, the behaviour is as it follows:
-
shNode.GetItemAttribute(id, attribute)
: returns Attributes -
node.GetAttribute(attribute)
: returns UIDs
For me as a user, this was kind of surprising. Is this intended behaviour, did I miss something?
Thanks in advance!