예제 #1
0
def get_inputs():  #pylint: disable=unused-variable
    from mrtrix3 import app, path, run
    run.command('mrconvert ' + path.from_user(app.ARGS.in_5tt) + ' ' +
                path.to_scratch('5tt.mif'))
    if app.ARGS.dirs:
        run.command('mrconvert ' + path.from_user(app.ARGS.dirs) + ' ' +
                    path.to_scratch('dirs.mif') + ' -strides 0,0,0,1')
예제 #2
0
def get_inputs(): #pylint: disable=unused-variable
  mask_path = path.to_scratch('mask.mif', False)
  if os.path.exists(mask_path):
    app.warn('-mask option is ignored by algorithm \'manual\'')
    os.remove(mask_path)
  run.command('mrconvert ' + path.from_user(app.ARGS.in_voxels) + ' ' + path.to_scratch('in_voxels.mif'))
  if app.ARGS.dirs:
    run.command('mrconvert ' + path.from_user(app.ARGS.dirs) + ' ' + path.to_scratch('dirs.mif') + ' -strides 0,0,0,1')
예제 #3
0
파일: fsl.py 프로젝트: MRtrix3/mrtrix3
def get_inputs(): #pylint: disable=unused-variable
  image.check_3d_nonunity(path.from_user(app.ARGS.input, False))
  run.command('mrconvert ' + path.from_user(app.ARGS.input) + ' ' + path.to_scratch('input.mif'))
  if app.ARGS.mask:
    run.command('mrconvert ' + path.from_user(app.ARGS.mask) + ' ' + path.to_scratch('mask.mif') + ' -datatype bit -strides -1,+2,+3')
  if app.ARGS.t2:
    if not image.match(path.from_user(app.ARGS.input, False), path.from_user(app.ARGS.t2, False)):
      raise MRtrixError('Provided T2 image does not match input T1 image')
    run.command('mrconvert ' + path.from_user(app.ARGS.t2) + ' ' + path.to_scratch('T2.nii') + ' -strides -1,+2,+3')
예제 #4
0
파일: fsl.py 프로젝트: MRtrix3/mrtrix3
def check_first(prefix, structures):  #pylint: disable=unused-variable
    from mrtrix3 import app, path  #pylint: disable=import-outside-toplevel
    vtk_files = [prefix + '-' + struct + '_first.vtk' for struct in structures]
    existing_file_count = sum(
        [os.path.exists(filename) for filename in vtk_files])
    if existing_file_count != len(vtk_files):
        if 'SGE_ROOT' in os.environ and os.environ['SGE_ROOT']:
            app.console(
                'FSL FIRST job may have been run via SGE; awaiting completion')
            app.console(
                '(note however that FIRST may fail silently, and hence this script may hang indefinitely)'
            )
            path.wait_for(vtk_files)
        else:
            app.DO_CLEANUP = False
            raise MRtrixError(
                'FSL FIRST has failed; ' +
                ('only ' if existing_file_count else '') +
                str(existing_file_count) + ' of ' + str(len(vtk_files)) +
                ' structures were segmented successfully (check ' +
                path.to_scratch('first.logs', False) + ')')
예제 #5
0
def get_inputs():  #pylint: disable=unused-variable
    check_gif_input(path.from_user(app.ARGS.input, False))
    run.command('mrconvert ' + path.from_user(app.ARGS.input) + ' ' +
                path.to_scratch('input.mif'))
예제 #6
0
def get_inputs(): #pylint: disable=unused-variable
  import shutil
  from mrtrix3 import app, path, run
  run.command('mrconvert ' + path.from_user(app.ARGS.input) + ' ' + path.to_scratch('input.mif'))
  if app.ARGS.lut:
    run.function(shutil.copyfile, path.from_user(app.ARGS.lut, False), path.to_scratch('LUT.txt', False))
예제 #7
0
def get_inputs(): #pylint: disable=unused-variable
  # Most freeSurfer files will be accessed in-place; no need to pre-convert them into the temporary directory
  # However convert aparc image so that it does not have to be repeatedly uncompressed
  run.command('mrconvert ' + path.from_user(os.path.join(app.ARGS.input, 'mri', 'aparc+aseg.mgz'), True) + ' ' + path.to_scratch('aparc.mif', True))
  if app.ARGS.template:
    run.command('mrconvert ' + path.from_user(app.ARGS.template, True) + ' ' + path.to_scratch('template.mif', True) + ' -axes 0,1,2')