Ejemplo n.º 1
0
 def _setup_assessors(proj_id, subj_id, session):
     for i in range(1, 3):
         SessionTools.add_assessor(
             session,
             '{}-x-{}-x-{}-x-{}-x-Proc_X_v1'.format(proj_id, subj_id,
                                                    session.label(), i),
             assessor_presets['Proc_X_v1'], 'no_inputs')
Ejemplo n.º 2
0
    def test_build_matrix(self):

        input_headers = ['xsitype', 'quality', 'type', 'files']
        input_xsitype = ['xnat:mrScanData']
        input_quality = ['unusable', 'usable', 'preferred']
        input_type = ['T1', 'T2']
        input_files = [
            [],
            [('NIFTI', ['images.nii'])],
            # [('NIFTI', ['images.nii']), ('SNAPSHOTS', ['snapshot.jpg.gz',
            # 'snapshot(1).jpg.gz'])]
        ]
        input_values = [input_xsitype, input_quality, input_type, input_files]
        input_table_values = itertools.product(*input_values)
        input_table = [[dict(zip(input_headers, r))]
                       for r in input_table_values]

        headers = ['required', 'select', 'quality', 'inputs']
        required = [None, False, True]
        select = [None, 'foreach']
        quality = [None, False, True]
        input_fields = [[]] + [i for i in input_table]
        values = [required, select, quality, input_fields]
        table_values = itertools.product(*values)
        table = [dict(zip(headers, r)) for r in table_values]

        # generate the scan artefacts against which this is run
        for scans in input_table:
            for scan in scans:
                SessionTools.add_scan(None, 'scan1', scan)

        print((len(table)))
Ejemplo n.º 3
0
    def test_build_matrix(self):

        input_headers = ['xsitype', 'quality', 'type', 'files']
        input_xsitype = ['xnat:mrScanData']
        input_quality = ['unusable', 'usable', 'preferred']
        input_type = ['T1', 'T2']
        input_files = [
            [],
            [('NIFTI', ['images.nii'])],
            #[('NIFTI', ['images.nii']), ('SNAPSHOTS', ['snapshot.jpg.gz', 'snapshot(1).jpg.gz'])]
        ]
        input_values = [input_xsitype, input_quality, input_type, input_files]
        input_table_values = itertools.product(*input_values)
        input_table = map(lambda r: [dict(itertools.izip(input_headers, r))],
                          input_table_values)

        headers = ['required', 'select', 'quality', 'inputs']
        required = [None, False, True]
        select = [None, 'foreach']
        quality = [None, False, True]
        input_fields = [[]] + [i for i in input_table]
        values = [required, select, quality, input_fields]
        table_values = itertools.product(*values)
        table = map(lambda r: dict(itertools.izip(headers, r)), table_values)

        # generate the scan artefacts against which this is run
        for scans in input_table:
            for scan in scans:
                SessionTools.add_scan(None, 'scan1', scan)


        print len(table)
Ejemplo n.º 4
0
 def _setup_assessors(proj_id, subj_id, session):
     for i in range(1, 3):
         SessionTools.add_assessor(
             session,
             '{}-x-{}-x-{}-x-{}-x-Proc_X_v1'.format(proj_id, subj_id, session.label(), i),
                                   assessor_presets['Proc_X_v1'],
                                   'no_inputs')
Ejemplo n.º 5
0
    def test_create_assessor_with_no_input(self):
        with XnatUtils.get_interface(host=host) as intf:
            intf.connect()

            e = intf.select_experiment(proj_id, subj_id, sess_id)
            if not e.exists():
                self.assertTrue(
                    False, "Unexpected: {}//{}//{} does not exist".format(
                        proj_id, subj_id, sess_id))

            proc_a_params = {
                'xsitype': asrxsitype,
                'proctype': 'Proc_A_v1',
                'files': [('SEG', ['seg.gz'])]
            }
            SessionTools.add_assessor(e, 'proc1-x-subj1-x-sess1-x-2-Proc_A_v1',
                                      proc_a_params, 'no_inputs')
Ejemplo n.º 6
0
    def test_create_assessor_with_no_input(self):
        with XnatUtils.get_interface(host=host) as intf:
            intf.connect()

            e = intf.select_experiment(proj_id, subj_id, sess_id)
            if not e.exists():
                self.assertTrue(
                    False,
                    "Unexpected: {}//{}//{} does not exist".format(
                        proj_id, subj_id, sess_id
                    ))

            proc_a_params = {
                'xsitype': asrxsitype,
                'proctype': 'Proc_A_v1',
                'files': [
                    ('SEG', ['seg.gz'])
                ]
            }
            SessionTools.add_assessor(e,
                                      'proc1-x-subj1-x-sess1-x-2-Proc_A_v1',
                                      proc_a_params,
                                      'no_inputs')
Ejemplo n.º 7
0
 def _setup_scans(session, scan_descriptors):
     for s, d in scan_descriptors:
         print((s, d))
         SessionTools.add_scan(session, s, scan_presets[d])
Ejemplo n.º 8
0
 def _setup_scans(session, scan_descriptors):
     for s, d in scan_descriptors:
         print(s, d)
         SessionTools.add_scan(session, s, scan_presets[d])