예제 #1
0
def main():
    """ Main function."""
    if ENV_SOURCE is not None and ENV_SOURCE != 'None' \
       and os.path.isfile(ENV_SOURCE):
        os.system('sh {}'.format(ENV_SOURCE))

    _working_dir = None
    if WORKING_DIR != 'None':
        _working_dir = os.path.join(WORKING_DIR, '${assessor_label}')
        if not os.path.exists(_working_dir):
            os.makedirs(_working_dir)

    if os.path.exists(NIFTYPIPE_EXE) or \
       XnatUtils.executable_exists(NIFTYPIPE_EXE):
        if OPENMP_CORE is not None and OPENMP_CORE != 'None':
            _omp = OMP.format(number_core=OPENMP_CORE)
        if _working_dir is not None:
            _wd = WDIR.format(working_dir=_working_dir)
        cmd = EXE_CMD.format(exe=NIFTYPIPE_EXE,
                             input=IN_FILE,
                             output=JOB_DIR,
                             db_xml=DB_TEMPLATE,
                             omp=_omp, wdir=_wd)
        os.system(cmd)
        make_pdf()
    else:
        raise Exception("Error: %s not found" % (NIFTYPIPE_EXE))
예제 #2
0
def main():
    """ Main function."""
    assr_handler = XnatUtils.AssessorHandler(ASSESSOR)
    session = assr_handler.get_session_label()

    moda = 'T1 FLAIR'
    if T2_FILE:
        moda = 'T1 FLAIR T2'

    _working_dir = None
    if WORKING_DIR != 'None':
        _working_dir = os.path.join(WORKING_DIR, ASSESSOR)
        if not os.path.exists(_working_dir):
            os.makedirs(_working_dir)

    if XnatUtils.executable_exists(NIFTYPIPE_EXE):
        _omp = ''
        _wd = ''
        _t2 = ''
        if OPENMP_CORE is not None and OPENMP_CORE != 'None':
            _omp = OMP.format(number_core=OPENMP_CORE)
        if _working_dir is not None:
            _wd = WDIR.format(working_dir=_working_dir)
        if T2_FILE is not None and T2_FILE != 'None':
            _t2 = T2.format(working_dir=T2_FILE)

        cmd = EXE_CMD.format(
            exe=NIFTYPIPE_EXE, modalities=moda, t2=_t2, omp=_omp, wdir=_wd)
        os.system(cmd)

        # PDF
        make_pdf(session)
    else:
        raise Exception("Error: executable %s not found" % (NIFTYPIPE_EXE))
예제 #3
0
def main():
    """ Main function."""
    if ENV_SOURCE is not None and os.path.isfile(ENV_SOURCE):
        os.system('sh {}'.format(ENV_SOURCE))

    _working_dir = None
    if WORKING_DIR != 'None':
        _working_dir = os.path.join(WORKING_DIR, '${assessor_label}')
        if not os.path.exists(_working_dir):
            os.makedirs(_working_dir)

    if XnatUtils.executable_exists(NIFTYPIPE_EXE):
        _omp = ''
        _wd = ''
        if OPENMP_CORE is not None and OPENMP_CORE != 'None':
            _omp = OMP.format(number_core=OPENMP_CORE)
        if _working_dir is not None:
            _wd = WDIR.format(working_dir=_working_dir)

        cmd = EXE_CMD.format(
            dwis=' '.join(DWIS.split(',')),
            bvals=' '.join(BVALS.split(',')),
            bvecs=' '.join(BVECS.split(',')),
            omp=_omp, wdir=_wd)
        os.system(cmd)
        make_pdf()
    else:
        raise Exception("Error: executable %s not found" % (NIFTYPIPE_EXE))
예제 #4
0
def main():
    """ Main function."""
    _working_dir = None
    if WORKING_DIR != 'None':
        _working_dir = os.path.join(WORKING_DIR, '${assessor_label}')
        if not os.path.exists(_working_dir):
            os.makedirs(_working_dir)

    if XnatUtils.executable_exists(NIFTYPIPE_EXE):
        _omp = ''
        _wd = ''
        if OPENMP_CORE is not None and OPENMP_CORE != 'None':
            _omp = OMP.format(number_core=OPENMP_CORE)
        if _working_dir is not None:
            _wd = WDIR.format(working_dir=_working_dir)

        cmd = EXE_CMD.format(exe_path=NIFTYPIPE_EXE,
                             gad=GAD_FILE,
                             mprage=MPRAGE_FILE,
                             labels=LABELS_FILE,
                             brain=BRAIN_FILE,
                             output=JOB_DIR,
                             omp=_omp,
                             wdir=_wd)
        os.system(cmd)
        rename_outputs()
        make_pdf()
    else:
        raise Exception("Error: executable %s not found" % (NIFTYPIPE_EXE))
예제 #5
0
def main():
    """ Main function."""
    _working_dir = None
    if WORKING_DIR != 'None':
        _working_dir = os.path.join(WORKING_DIR, '${assessor_label}')
        if not os.path.exists(_working_dir):
            os.makedirs(_working_dir)

    if XnatUtils.executable_exists(NIFTYPIPE_EXE):
        _omp = '' if OPENMP_CORE == 'None' \
               else OMP.format(number_core=OPENMP_CORE)
        _wd = '' if _working_dir is not None \
              else '--working_dir {0}'.format(_working_dir)
        _min = '' if MIN == 'None' else '--min {0}'.format(MIN)
        _max = '' if MAX == 'None' else '--max {0}'.format(MAX)

        cmd = EXE_CMD.format(exe_path=NIFTYPIPE_EXE,
                             vessels=" ".join(VESSELS_FILES.split(',')),
                             output=JOB_DIR,
                             omp=_omp,
                             wdir=_wd,
                             min=_min,
                             max=_max,
                             ct='--ct' if CT == '1' else '')
        os.system(cmd)
        make_pdf()
    else:
        raise Exception("Error: executable %s not found" % (NIFTYPIPE_EXE))