def test_tempfilt(fsl_output_type=None): prev_type = set_output_type(fsl_output_type) files, testdir, origdir, out_ext = create_files_in_directory() # Get the command filt = fsl.TemporalFilter(in_file="a.nii", out_file="b.nii") # Test the underlying command yield assert_equal, filt.cmd, "fslmaths" # Test that both filters are initialized off yield assert_equal, filt.cmdline, "fslmaths a.nii -bptf -1.000000 -1.000000 b.nii" # Test some filters windows = [(-1, -1), (0.1, 0.1), (-1, 20), (20, -1), (128, 248)] for win in windows: filt.inputs.highpass_sigma = win[0] filt.inputs.lowpass_sigma = win[1] yield assert_equal, filt.cmdline, "fslmaths a.nii -bptf %.6f %.6f b.nii" % win # Test that we don't need to ask for an out file filt = fsl.TemporalFilter(in_file="a.nii", highpass_sigma=64) yield assert_equal, filt.cmdline, \ "fslmaths a.nii -bptf 64.000000 -1.000000 %s" % os.path.join(testdir, "a_filt%s" % out_ext) # Clean up our mess clean_directory(testdir, origdir) set_output_type(prev_type)
def test_tempfilt(create_files_in_directory): files, testdir, out_ext = create_files_in_directory # Get the command filt = fsl.TemporalFilter(in_file="a.nii", out_file="b.nii") # Test the underlying command assert filt.cmd == "fslmaths" # Test that both filters are initialized off assert filt.cmdline == "fslmaths a.nii -bptf -1.000000 -1.000000 b.nii" # Test some filters windows = [(-1, -1), (0.1, 0.1), (-1, 20), (20, -1), (128, 248)] for win in windows: filt.inputs.highpass_sigma = win[0] filt.inputs.lowpass_sigma = win[1] assert filt.cmdline == "fslmaths a.nii -bptf %.6f %.6f b.nii" % win # Test that we don't need to ask for an out file filt = fsl.TemporalFilter(in_file="a.nii", highpass_sigma=64) assert filt.cmdline == \ "fslmaths a.nii -bptf 64.000000 -1.000000 %s" % os.path.join(testdir, "a_filt%s" % out_ext)