def test_DilateImage_outputs():
    output_map = dict(out_file=dict(), )
    outputs = DilateImage.output_spec()

    for key, metadata in output_map.items():
        for metakey, value in metadata.items():
            yield assert_equal, getattr(outputs.traits()[key], metakey), value
Exemplo n.º 2
0
def test_DilateImage_outputs():
    output_map = dict(out_file=dict(),
    )
    outputs = DilateImage.output_spec()

    for key, metadata in output_map.items():
        for metakey, value in metadata.items():
            yield assert_equal, getattr(outputs.traits()[key], metakey), value
Exemplo n.º 3
0
def test_DilateImage_inputs():
    input_map = dict(ignore_exception=dict(nohash=True,
    usedefault=True,
    ),
    nan2zeros=dict(position=3,
    argstr='-nan',
    ),
    kernel_file=dict(position=5,
    xor=['kernel_size'],
    argstr='%s',
    ),
    out_file=dict(hash_files=False,
    genfile=True,
    position=-2,
    argstr='%s',
    ),
    args=dict(argstr='%s',
    ),
    internal_datatype=dict(position=1,
    argstr='-dt %s',
    ),
    terminal_output=dict(mandatory=True,
    nohash=True,
    ),
    environ=dict(nohash=True,
    usedefault=True,
    ),
    kernel_shape=dict(position=4,
    argstr='-kernel %s',
    ),
    output_type=dict(),
    operation=dict(position=6,
    mandatory=True,
    argstr='-dil%s',
    ),
    output_datatype=dict(position=-1,
    argstr='-odt %s',
    ),
    kernel_size=dict(position=5,
    xor=['kernel_file'],
    argstr='%.4f',
    ),
    in_file=dict(position=2,
    mandatory=True,
    argstr='%s',
    ),
    )
    inputs = DilateImage.input_spec()

    for key, metadata in input_map.items():
        for metakey, value in metadata.items():
            yield assert_equal, getattr(inputs.traits()[key], metakey), value
Exemplo n.º 4
0
lesion_mask   = os.path.join(data_dir, subject_id + '_' + X, 
                            'lesion/lesion_mask_mni.nii.gz')

# define working dir
work_dir = os.path.join(out_dir, subject_id) 
if not os.path.exists(work_dir):
	os.makedirs(work_dir)
# go into working dir
os.chdir(work_dir)

lesion_mask_dil = os.path.join(work_dir, 
			       'lesion_mask_mni_dilated.nii.gz')
print lesion_mask_dil

###### Step 1: dilating lesion mask #############################
dilate = DilateImage()
dilate.inputs.in_file      = lesion_mask
dilate.inputs.operation    = 'modal'
dilate.inputs.out_file     = lesion_mask_dil
#print dilate.cmdline
dilate.run()

##### Step 2: get intra-subject gm mask #########################

rest_list = []
rest_str  = []
i = 0

print "intra-subject rest mask ..."
for name in glob.glob(data_dir + subject_id + '*' +
                      '/preprocessed/func/connectivity/' +
Exemplo n.º 5
0
lesion_mask = os.path.join(data_dir, subject_id + '_' + X,
                           'lesion/lesion_mask_mni.nii.gz')

# define working dir
work_dir = os.path.join(out_dir, subject_id)
if not os.path.exists(work_dir):
    os.makedirs(work_dir)
# go into working dir
os.chdir(work_dir)

lesion_mask_dil = os.path.join(work_dir, 'lesion_mask_mni_dilated.nii.gz')
print lesion_mask_dil

###### Step 1: dilating lesion mask #############################
dilate = DilateImage()
dilate.inputs.in_file = lesion_mask
dilate.inputs.operation = 'modal'
dilate.inputs.out_file = lesion_mask_dil
#print dilate.cmdline
dilate.run()

##### Step 2: get intra-subject gm mask #########################

rest_list = []
rest_str = []
i = 0

print "intra-subject rest mask ..."
for name in glob.glob(data_dir + subject_id + '*' +
                      '/preprocessed/func/connectivity/' +
def test_DilateImage_inputs():
    input_map = dict(
        args=dict(argstr='%s', ),
        environ=dict(
            nohash=True,
            usedefault=True,
        ),
        ignore_exception=dict(
            nohash=True,
            usedefault=True,
        ),
        in_file=dict(
            argstr='%s',
            mandatory=True,
            position=2,
        ),
        internal_datatype=dict(
            argstr='-dt %s',
            position=1,
        ),
        kernel_file=dict(
            argstr='%s',
            position=5,
            xor=['kernel_size'],
        ),
        kernel_shape=dict(
            argstr='-kernel %s',
            position=4,
        ),
        kernel_size=dict(
            argstr='%.4f',
            position=5,
            xor=['kernel_file'],
        ),
        nan2zeros=dict(
            argstr='-nan',
            position=3,
        ),
        operation=dict(
            argstr='-dil%s',
            mandatory=True,
            position=6,
        ),
        out_file=dict(
            argstr='%s',
            genfile=True,
            hash_files=False,
            position=-2,
        ),
        output_datatype=dict(
            argstr='-odt %s',
            position=-1,
        ),
        output_type=dict(),
        terminal_output=dict(
            mandatory=True,
            nohash=True,
        ),
    )
    inputs = DilateImage.input_spec()

    for key, metadata in input_map.items():
        for metakey, value in metadata.items():
            yield assert_equal, getattr(inputs.traits()[key], metakey), value