Hello
Probably a very basic question, after loading the DICOM stack as a scalar volume, how in the code can I obtain one of the header tag information (e.g. Patient Position, or Reconstruction Kernel)? If there are some sample code to look up to, that will be great.
To continue on this thread, this is what I have tried on Python interactor window:
shNode = slicer.vtkMRMLSubjectHierarchyNode.GetSubjectHierarchyNode(slicer.mrmlScene)
volumeNode = slicer.mrmlScene.GetNodeByID(‘vtkMRMLScalarVolumeNode1’)
shNode.GetAttributeFromItemAncestor(shNode.GetItemByDataNode(volumeNode),‘DICOM.PatientName’)
It can return something, but if I substitute DICOM.PatientName with some other attributes, such as DICOM.modality or DICOM.ConvolutionKernel, there is nothing returned, but I clearly see the value of these attributes, what am I missing?
Only some high level tags are stored in the node. To get the rest of the dicom header info you use the instance uid and you can either access via the database or use pydicom to look at the instances directly.
Hmm, for that kind of manipulation probably the easiest is to iterate through the exported files and modify attributes with pydicom like is done in the DicomPatcher.
What tags would you like to save? We can add some more of the commonly used standard tags, if that helps.
For adding arbitrary custom tags using pydicom as @pieper suggested should work well. You can integrate the this additional update step nicely in the DICOM export GUI by implementing a custom DICOM export plugin. It should be just a few ten lines of extra code. See an example of a custom DICOM import/export plugin in SlicerRT.