Esempio n. 1
0
from pynetdicom3.sop_class import VerificationSOPClass
from Anonymize import anony
import multiprocessing
from SQL import anony_config, get_list, get_active_rules

# Initialise the Application Entity and specify the listen port
anon_list = anony_config()
print('LocaL AE: ', anon_list[0])
print('MAX_threads : ', anon_list[1])
print('local_PORT: ', anon_list[2])
config_local_AE = anon_list[0]
config_MAX_threads = anon_list[1]
config_local_PORT = int(anon_list[2])

ae = AE(ae_title=config_local_AE, port=int(config_local_PORT))
ae.supported_contexts = StoragePresentationContexts
ae.maximum_associations = config_MAX_threads
ae.NumberOfActiveAssociations = config_MAX_threads

ae.add_supported_context(VerificationSOPClass)


def on_c_echo(context, info):
    return 0x0000


def operand_equal(ds, active_rule_tag, dicom_tag_value):
    print('Activve rule tag in equals to: ', active_rule_tag)

    return dicom_tag_value
Esempio n. 2
0
from pynetdicom3 import AE, VerificationPresentationContexts, PYNETDICOM_IMPLEMENTATION_UID, PYNETDICOM_IMPLEMENTATION_VERSION
from pynetdicom3.sop_class import CTImageStorage, MRImageStorage, StorageServiceClass
from pydicom.dataset import Dataset

ae = AE(ae_title=b'flavio-pacs', port=11112)
# Or we can use the inbuilt VerificationPresentationContexts list,
#   there's one for each of the supported Service Classes
# In this case, we are supporting any requests to use Verification SOP
#   Class in the association
ae.supported_contexts = VerificationPresentationContexts
#ae.add_supported_context(StorageServiceClass)
ae.add_supported_context(CTImageStorage)
ae.add_supported_context(MRImageStorage)

# Implement the AE.on_c_store callback
def on_c_store(ds, context, info):
    """Store the pydicom Dataset `ds`.

    Parameters
    ----------
    ds : pydicom.dataset.Dataset
        The dataset that the peer has requested be stored.
    context : namedtuple
        The presentation context that the dataset was sent under.
    info : dict
        Information about the association and storage request.

    Returns
    -------
    status : int or pydicom.dataset.Dataset
        The status returned to the peer AE in the C-STORE response. Must be