Ejemplo n.º 1
0
    filename = get_testdata_files('CT_small.dcm')[0]
    filename2 = get_testdata_files("rtplan.dcm")[0]
    instances.append(dcmread(filename))
    instances.append(dcmread(filename2))
    """
    fdir = '/path/to/directory'
    for fpath in os.listdir(fdir):
        instances.append(dcmread(os.path.join(fdir, fpath)))
    """
    if ds.QueryRetrieveLevel == 'PATIENT':
        if 'PatientID' in ds:
            matching = [
                inst for inst in instances if inst.PatientID == ds.PatientID
            ]

        # Skip the other possible attributes...

    # Skip the other QR levels...
    # Yield the total number of C-STORE sub-operations required
    yield len(instances)
    # Yield the matching instances
    for instance in matching:
        # Pending
        yield (0xFF00, instance)


ae.on_c_move = on_c_move

# Start listening for incoming association requests
ae.start_server(('', 11112))
Ejemplo n.º 2
0
    yield len(dcm_files)
    
    # Address and port to send to
    if move_aet == b'ANY-SCP         ':
        yield '10.40.94.43', 104
    else:
        yield None, None
    
    # Matching datasets to send
    for dcm in dcm_files:
        data = read_file(dcm, force=True)
        yield data

# Create application entity
ae = AE(ae_title=args.aetitle,
        port=args.port,
        scu_sop_class=StorageSOPClassList, 
        scp_sop_class=QueryRetrieveSOPClassList,
        transfer_syntax=transfer_syntax)

ae.maximum_pdu_size = args.max_pdu

# Set timeouts
ae.network_timeout = args.timeout
ae.acse_timeout = args.acse_timeout
ae.dimse_timeout = args.dimse_timeout

ae.on_c_move = on_c_move

ae.start()