示例#1
0
def test_store(pacs_srv: pacs.PACS):
    ds = Dataset()
    ds.SpecificCharacterSet = 'ISO_IR 192'
    ds.PatientID = 'test_id'
    ds.PatientName = 'Store^Store^Stor'
    ds.PatientBirthDate = '19800101'
    ds.StudyInstanceUID = '1.2.5'
    ds.StudyDate = '20200301'
    ds.StudyTime = '101010'
    ds.SeriesInstanceUID = '1.2.5.6'
    ds.Modality = 'CT'
    ds.SOPInstanceUID = '1.2.5.6'
    ds.SOPClassUID = '2.3.4'

    pacs_srv.c_store(ds)

    request = Dataset()
    request.PatientName = 'Store^*'
    request.SpecificCharacterSet = 'ISO_IR 192'
    request.QueryRetrieveLevel = 'IMAGE'
    request.StudyInstanceUID = None
    request.SeriesInstanceUID = None
    request.SOPInstanceUID = None
    request.Modality = None
    results = list(pacs_srv.c_find(request))
    assert len(results) == 1
示例#2
0
def test_patient_find_text_filter_negative(pacs_srv: pacs.PACS):
    request = Dataset()
    request.PatientSex = None
    request.SpecificCharacterSet = 'ISO_IR 192'
    request.QueryRetrieveLevel = 'PATIENT'
    request.PatientName = 'Test1^*'
    assert not list(pacs_srv.c_find(request))
示例#3
0
def test_study_find_patient_attrs_with_filters_negative(pacs_srv: pacs.PACS):
    request = Dataset()
    request.PatientName = 'Test1^*'
    request.SpecificCharacterSet = 'ISO_IR 192'
    request.QueryRetrieveLevel = 'STUDY'
    request.AccessionNumber = '1234'
    assert not list(pacs_srv.c_find(request))
示例#4
0
def test_study_find_no_patient_attrs(pacs_srv: pacs.PACS):
    request = Dataset()
    request.SpecificCharacterSet = 'ISO_IR 192'
    request.QueryRetrieveLevel = 'STUDY'
    request.AccessionNumber = '1234'
    results = list(pacs_srv.c_find(request))
    assert len(results) == 1
    assert results[0].AccessionNumber == '1234'
示例#5
0
def test_patient_find_date_range_negative(pacs_srv: pacs.PACS):
    request = Dataset()
    request.PatientName = None
    request.PatientSex = None
    request.SpecificCharacterSet = 'ISO_IR 192'
    request.QueryRetrieveLevel = 'PATIENT'
    request.PatientBirthDate = '19670101-19680102'
    assert not list(pacs_srv.c_find(request))
示例#6
0
def test_patient_find_text_filter_positive(pacs_srv: pacs.PACS):
    request = Dataset()
    request.PatientSex = None
    request.SpecificCharacterSet = 'ISO_IR 192'
    request.QueryRetrieveLevel = 'PATIENT'
    request.PatientName = 'Test^*'
    for patient in pacs_srv.c_find(request):
        assert patient.PatientName == 'Test^Test^Test'
        assert patient.PatientSex == 'M'
示例#7
0
def test_series_find_patient_filter(pacs_srv: pacs.PACS):
    request = Dataset()
    request.PatientName = 'Test^*'
    request.SpecificCharacterSet = 'ISO_IR 192'
    request.QueryRetrieveLevel = 'SERIES'
    request.SeriesInstanceUID = None
    request.Modality = None
    results = list(pacs_srv.c_find(request))
    assert len(results) == 4
示例#8
0
def test_study_find_modalities_in_study_no_filter(pacs_srv: pacs.PACS):
    request = Dataset()
    request.SpecificCharacterSet = 'ISO_IR 192'
    request.QueryRetrieveLevel = 'STUDY'
    request.AccessionNumber = '1234'
    request.ModalitiesInStudy = None
    results = list(pacs_srv.c_find(request))
    assert len(results) == 1
    assert results[0].ModalitiesInStudy == ['DX', 'SR']
示例#9
0
def test_study_find_patient_attrs_with_filters_positive(pacs_srv: pacs.PACS):
    request = Dataset()
    request.PatientName = 'Test^*'
    request.SpecificCharacterSet = 'ISO_IR 192'
    request.QueryRetrieveLevel = 'STUDY'
    request.AccessionNumber = '1234'
    results = list(pacs_srv.c_find(request))
    assert len(results) == 1
    assert results[0].AccessionNumber == '1234'
    assert results[0].PatientName == 'Test^Test^Test'
示例#10
0
def test_patient_find_date_range_positive(pacs_srv: pacs.PACS):
    request = Dataset()
    request.PatientName = None
    request.PatientSex = None
    request.SpecificCharacterSet = 'ISO_IR 192'
    request.QueryRetrieveLevel = 'PATIENT'
    request.PatientBirthDate = '19650101-19660102'
    for patient in pacs_srv.c_find(request):
        assert patient.PatientName == 'Test^Test^Test'
        assert patient.PatientSex == 'M'
示例#11
0
def test_patient_find_with_count(pacs_srv: pacs.PACS):
    request = Dataset()
    request.PatientName = None
    request.PatientSex = None
    request.SpecificCharacterSet = 'ISO_IR 192'
    request.QueryRetrieveLevel = 'PATIENT'
    request.NumberOfPatientRelatedStudies = None
    for patient in pacs_srv.c_find(request):
        assert patient.PatientName == 'Test^Test^Test'
        assert patient.PatientSex == 'M'
        assert patient.NumberOfPatientRelatedStudies == 2