def test_overlay(): filelist, outdir, cwd = create_files_in_directory() overlay = fsl.Overlay() # make sure command gets called yield assert_equal, overlay.cmd, 'overlay' # test raising error with mandatory args absent yield assert_raises, ValueError, overlay.run # .inputs based parameters setting overlay.inputs.stat_image = filelist[0] overlay.inputs.stat_thresh = (2.5, 10) overlay.inputs.background_image = filelist[1] overlay.inputs.auto_thresh_bg = True overlay.inputs.show_negative_stats = True overlay.inputs.out_file = 'foo_overlay.nii' yield assert_equal, overlay.cmdline, \ 'overlay 1 0 %s -a %s 2.50 10.00 %s -2.50 -10.00 foo_overlay.nii' % ( filelist[1], filelist[0], filelist[0]) # .run based parameter setting overlay2 = fsl.Overlay(stat_image=filelist[0], stat_thresh=(2.5, 10), background_image=filelist[1], auto_thresh_bg=True, out_file='foo2_overlay.nii') yield assert_equal, overlay2.cmdline, 'overlay 1 0 %s -a %s 2.50 10.00 foo2_overlay.nii' % ( filelist[1], filelist[0]) clean_directory(outdir, cwd)
def test_overlay(create_files_in_directory): filelist, outdir, _ = create_files_in_directory overlay = fsl.Overlay() # make sure command gets called assert overlay.cmd == 'overlay' # test raising error with mandatory args absent with pytest.raises(ValueError): overlay.run() # .inputs based parameters setting overlay.inputs.stat_image = filelist[0] overlay.inputs.stat_thresh = (2.5, 10) overlay.inputs.background_image = filelist[1] overlay.inputs.auto_thresh_bg = True overlay.inputs.show_negative_stats = True overlay.inputs.out_file = 'foo_overlay.nii' assert overlay.cmdline == \ 'overlay 1 0 %s -a %s 2.50 10.00 %s -2.50 -10.00 foo_overlay.nii' % ( filelist[1], filelist[0], filelist[0]) # .run based parameter setting overlay2 = fsl.Overlay(stat_image=filelist[0], stat_thresh=(2.5, 10), background_image=filelist[1], auto_thresh_bg=True, out_file='foo2_overlay.nii') assert overlay2.cmdline == 'overlay 1 0 %s -a %s 2.50 10.00 foo2_overlay.nii' % ( filelist[1], filelist[0])