mapping modality from SOP Class uid #986
Replies: 3 comments
-
No, there is no direct connection between the SOP class and the modality in pydicom / pynetdicom. If you need this, you have to add such a mapping yourself. |
Beta Was this translation helpful? Give feedback.
-
If by "modality" you mean the service class from Part 4 then it is possible. Using pydicom's inbuilt Storage UIDs: >>> from pydicom.uid import CTImageStorage
>>> from pynetdicom.sop_class import uid_to_service_class
>>> uid_to_service_class(CTImageStorage)
<class 'pynetdicom.service_class.StorageServiceClass'> Or a str: >>> uid_to_service_class("1.2.840.10008.5.1.4.31")
<class 'pynetdicom.service_class.BasicWorklistManagementServiceClass'> Or using pynetdicom's inbuilt SOP Classes (which are a subclass of pydicom's UID class): >>> from pynetdicom.sop_class import CTImageStorage
>>> CTImageStorage.service_class
<class 'pynetdicom.service_class.StorageServiceClass'>
>>> CTImageStorage.service_class.__name__.split(".")[-1]
'StorageServiceClass' These return the service class object, but as demonstrated you can parse that for the service name. Might be nice to add a On the other hand, if you mean the (0008,0060) Modality value then no, that's not possible, but it should be easy enough to create a set of mappings as suggested by @mrbean-bremen |
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick response. This is helpful. |
Beta Was this translation helpful? Give feedback.
-
Hello,
Given an sop class uid, I know I can get the SOP Class Name using pynetdicom. Is it possible to get the modality associated with the SOP Class?
Apolgies if this is wrong channel for this question.
Jenny
Beta Was this translation helpful? Give feedback.
All reactions