if not opts.username:
    parser.print_help()
    sys.exit(-1)

if opts.csv:
    try:
        csv_file = open(opts.csv, 'a')
    except:
        print "Problem with file " + opts.csv
        exit(-1)
else:
    print "No CSV option"

idb = HcpInterface(opts.hostname, opts.username, opts.password, opts.project)
idb.subject_label = opts.subject
idb.session_label = opts.session

deface_types = ('Bias_Transmit', 'Bias_Receive', 'T1w', 'T2w', 'T1w_MEG', 'T2w_MEG')
deface_seriesdescs = ('BIAS_BC', 'BIAS_32CH', 'AFI', 'T1w_MPR1', 'T2w_SPC1', 'T1w_MPR2', 'T2w_SPC2')


def verifyValidation():
    """
    Checks for ProtocolVal at the experiment level.
    """
    print "--Verifying Validation"
    uri = '/REST/experiments?xsiType=val:protocolData&project=%s&session_label=%s' % \
        (idb.project, idb.session_label)
    validation = idb.getJson(uri)
    
Exemplo n.º 2
0
                        print msg
                        log.warning(msg)
                        continue
                    idb.scan_resource = 'NIFTI'
                    log.info("Putting NIFTI resource - " + abspath)
                    idb.putScanResource(abspath)

if __name__ == "__main__":
    subjects = get_subjects_from(opts.source)
    idb.project = opts.project

    if opts.dicom:
        msg = "== Applying anonymize script: " + opts.anon
        print msg
        log.info(msg)
        for sub in subjects:
            os.path.walk(sub, process_dicoms, sub)
        upload_dicom()
    elif opts.nifti:
        for sub in subjects:
            idb.subject_label = sub
            idb.session_label = sub
            msg = "\n== Uploading NIFTI for subject " + sub + "..."
            print msg
            log.info(msg)
            upload_nifti()
    else:
        print "Either --dicom or --nifti must be specified."
        parser.print_help()
        sys.exit(-1)
Exemplo n.º 3
0
    for qc_ass in qc_assessments:
        idb.deleteSessionAssessor(qc_ass['label'])

if __name__ == "__main__":
    sessions = opts.sessions.split(',')
    print "=" * 82
    print "Launching %s pipeline for %s sessions on %s" % \
        (opts.pipeline, sessions.__len__(), idb.url)
    print "Build directory: " + builddir
    print "Archive directory: " + archivedir
    print "=" * 82

    for s in sessions:
        idb.session_label = s
        idb.subject_label = idb.getSessionSubject()
        # TODO - fails sometimes, so check that this found something
        if not idb.subject_label:
            idb.subject_label = s.split('_')[0]  # Not general, but often works
        print '\n** Subject: ' + idb.subject_label
        print '** Session: ' + s + '\n'

        if opts.pipeline == 'validation':
            launchValidation()
        elif opts.pipeline == 'facemask':
            launchFacemask()
        elif opts.pipeline == 'dcm2nii':
            launchDicomToNifti()
        elif opts.pipeline == 'level2qc':
            # Set default delay for level2qc
            if not opts.delay: