Example #1
0
def swi_link_inputs(swi_info, link_to_dir, change_to_dir=True):

    util.mkcd_dir([link_to_dir], change_to_dir)

    input_files = swi_info['inputs']

    util.link_inputs(input_files + label_files, link_to_dir)
Example #2
0
def swi_link_inputs(input_dir, link_to_dir, change_to_dir=True):

    cenc_dirs = cenc.directories(input_dir)

    util.mkcd_dir([link_to_dir], change_to_dir)

    input_files = cenc_dirs['swi']['inputs']
    label_files = cenc_dirs['swi']['labels']

    util.link_inputs(input_files + label_files, link_to_dir)
Example #3
0
def prepare(input_dir):

    cenc_dirs = cenc.directories(input_dir)

    util.mkcd_dir([cenc_dirs['freesurfer']['input']])

    input_files = [
        os.path.join(cenc_dirs['cenc']['reorient'], 't1w.nii.gz'),
        os.path.join(cenc_dirs['cenc']['reorient'], 't2flair.nii.gz'),
        os.path.join(cenc_dirs['cenc']['reorient'], 't2tse.nii.gz')
    ]

    util.link_inputs(input_files, cenc_dirs['freesurfer']['input'])

    return
Example #4
0
def prepare( input_dir ):

     cenc_dirs = cenc.directories( input_dir)

     wm_lesions_dir       = cenc_dirs['wmlesions']['dirs']['root']
     wm_lesions_input_dir = cenc_dirs['wmlesions']['dirs']['input']
     wm_lesions_lpa_dir   = cenc_dirs['wmlesions']['dirs']['lpa']

     # Create Input Directory if it doesn't exist and link files 

     files = [  os.path.abspath( os.path.join( cenc_dirs['results']['dirs']['images'], 'nu.nii.gz')), 
                os.path.abspath( os.path.join( cenc_dirs['results']['dirs']['labels'], 'mask.nii.gz')), 
                os.path.abspath( os.path.join( cenc_dirs['cenc']['reorient'], 't2flair.nii.gz'))
                ]

     util.mkcd_dir( os.path.join(  wm_lesions_input_dir ) )
     util.link_inputs( files, wm_lesions_input_dir )
Example #5
0
def prepare(input_dir):

    cenc_dirs = cenc.directories(input_dir)

    util.mkcd_dir([cenc_dirs['freesurfer']['input']])

    input_files = [os.path.join(cenc_dirs['cenc']['reorient'], 't1w.nii.gz')]

    #    Preliminary testing of Freesurfer with the T2FLAIR and T2_TSE has not been very successful.
    #    Removing them from the workflow.
    #
    #     input_files = [ os.path.join( cenc_dirs['cenc']['reorient'], 't2flair.nii.gz'),
    #                     os.path.join( cenc_dirs['cenc']['reorient'], 't2tse.nii.gz')
    #                     ]

    util.link_inputs(input_files, cenc_dirs['freesurfer']['input'])

    return
Example #6
0
def methods_01_register( input_dir, verbose ):

    cenc_dirs = cenc.directories( input_dir)

    wm_lesions_dir       = cenc_dirs['wmlesions']['dirs']['root']
    wm_lesions_lpa_dir   = cenc_dirs['wmlesions']['dirs']['lpa']

    # Register

    util.mkcd_dir( [ cenc_dirs['wmlesions']['dirs']['register'] ], True)

    files = [  os.path.join( cenc_dirs['wmlesions']['dirs']['input'], 'nu.nii.gz'),
            os.path.join( cenc_dirs['wmlesions']['dirs']['input'], 't2flair.nii.gz'),
            os.path.join( cenc_dirs['results']['dirs']['labels'], 'mask.nii.gz')
            ]

    util.link_inputs( files, cenc_dirs['wmlesions']['dirs']['register'] )

    ants_register('t2flair')
Example #7
0
        print('\nCENC ID: ' + id)
        print('CENC participant directory : ', participant_dir)
        print('CENC nifti directory : ', nifti_dir)
        print('CENC fMRI tarball : ', os.path.join(out_dir, tarball_filename))
        print('\n')

    # Create Output Directory if it doesn't exist

    files = [
        os.path.abspath(os.path.join(dicom_dir, 'dcmConvertAll.cfg')),
        os.path.abspath(os.path.join(dicom_dir, 'dcmConvert_cenc.cfg')),
        os.path.abspath(os.path.join(nifti_dir, 'rest.nii.gz'))
    ]

    util.mkcd_dir(out_dir)
    util.link_inputs(files, out_dir)

    files_to_be_tarred = glob.glob('*')

    # Create TarBall

    tarball = tarfile.open(tarball_filename, 'w:gz')

    for f in files_to_be_tarred:
        tarball.add(f)

    tarball.close()

    # Clean Directory

    for ii in files_to_be_tarred: