Oh, I do see now that is an example plugin. Thanks, for the help so far, and if it is not worth it to look into that is totally fine. I will find another way to do what i wanted with the plugin or might have to dig into the code myself.
But since you asked here is a minimal working example anyway:
The problem can be found with running the mainline version from today, with just the multitenant plugin added. And standard configuration, except a file with the following to configure the multitenant plugin:
{
"MultitenantDicom" : {
"Servers" : [
{
"AET" : "ORTHANC_2",
"Port" : 4243,
"Labels" : [ "TEST" ],
"LabelsConstraint" : "None",
"LabelsStoreLevels" : [ "Study", "Series", "Instance" ]
}
]
}
}
Then at least one dicom file added to the server. I just used this small example file found online: https://www.rubomedical.com/dicom_files/dicom_viewer_0002.zip But any file should work.
With no tags added to any resource both dicom servers should see all files. The following Python code, then tries both servers with a simple C-Find request with SpecificCharacterSet set to “ISO_IR 192” and then to “”.
from pynetdicom import AE
from pynetdicom.sop_class import (
Verification,
PatientRootQueryRetrieveInformationModelGet,
PatientRootQueryRetrieveInformationModelFind,
)
from pydicom import Dataset
class DICOMConnection:
def __init__(self, ip, ae_title="ANY-SCP", port=4242):
self.databuffer = None
# Initialise the Application Entity
ae = AE()
ae.add_requested_context(Verification)
# Add the requested presentation contexts (QR SCU)
ae.add_requested_context(PatientRootQueryRetrieveInformationModelGet)
ae.add_requested_context(PatientRootQueryRetrieveInformationModelFind)
self.assoc = ae.associate(ip, port, ae_title=ae_title)
def terminate(self):
self.assoc.release()
def getUIDs(self, ds):
series = {}
responses = self.assoc.send_c_find(ds, PatientRootQueryRetrieveInformationModelFind)
for (status, identifier) in responses:
if status:
if status.Status == 0xFF00:
series[identifier.StudyInstanceUID] = identifier
else:
self.terminate()
return series
conec_main = DICOMConnection("localhost", "ORTHANC", 4242)
conec_plugin = DICOMConnection("localhost", "ORTHANC_2", 4243)
ds = Dataset()
ds.QueryRetrieveLevel = "STUDY"
ds.StudyInstanceUID = ""
ds.SpecificCharacterSet = "ISO_IR 192"
regular_with_SpecificCharacterSet = conec_main.getUIDs(ds)
multitenant_with_SpecificCharacterSet = conec_plugin.getUIDs(ds)
ds.SpecificCharacterSet = ""
regular_no_SpecificCharacterSet = conec_main.getUIDs(ds)
multitenant_no_SpecificCharacterSet = conec_plugin.getUIDs(ds)
print(f"Number of studies found connection to the main DICOM server with SpecificCharacterSet specified:"
f" {len(regular_with_SpecificCharacterSet)}")
print(f"Number of studies found connection to the main DICOM server with SpecificCharacterSet blank:"
f" {len(regular_no_SpecificCharacterSet)}")
print(f"Number of studies found connection to the DICOM server from the plugin with SpecificCharacterSet specified:"
f" {len(multitenant_with_SpecificCharacterSet)}")
print(f"Number of studies found connection to the DICOM server from the plugin with SpecificCharacterSet blank:"
f" {len(multitenant_no_SpecificCharacterSet)}")
conec_main.terminate()
conec_plugin.terminate()
The resulting output is then:
Number of studies found connecting to the main DICOM server with SpecificCharacterSet specified: 1
Number of studies found connecting to the main DICOM server with SpecificCharacterSet blank: 1
Number of studies found connecting to the DICOM server from the plugin with SpecificCharacterSet specified: 0
Number of studies found connecting to the DICOM server from the plugin with SpecificCharacterSet blank: 1
If querying the server from the plugin and specifying SpecificCharacterSet nothing is found. But for the other three permutations the study is found.