Skip to content

Commit 247bc5b

Browse files
committed
tst: added test_fslmerge with check for tr updates
1 parent 42335d3 commit 247bc5b

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

nipype/interfaces/fsl/tests/test_utils.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,41 @@ def test_fslroi():
187187
# Fslroi class doesn't have a filled opt_map{}
188188

189189

190+
@skipif(no_fsl)
191+
def test_fslmerge():
192+
filelist, outdir, cwd = create_files_in_directory()
193+
194+
merger = fsl.Merge()
195+
196+
# make sure command gets called
197+
yield assert_equal, merger.cmd, 'fslmerge'
198+
199+
# test raising error with mandatory args absent
200+
yield assert_raises, ValueError, merger.run
201+
202+
# .inputs based parameters setting
203+
merger.inputs.in_files = filelist
204+
merger.inputs.merged_file = 'foo_merged.nii'
205+
merger.inputs.dimension = 't'
206+
yield assert_equal, merger.cmdline, 'fslmerge -t foo_merged.nii %s' % ' '.join(filelist)
207+
208+
# verify that providing a tr value updates the dimension to tr
209+
merger.inputs.tr = 2.25
210+
yield assert_equal, merger.cmdline, 'fslmerge -tr foo_merged.nii %s %.2f' % (' '.join(filelist), 2.25)
211+
212+
# .run based parameter setting
213+
merger2 = fsl.Merge(in_files=filelist,
214+
merged_file='foo_merged.nii',
215+
dimension='t',
216+
tr=2.25)
217+
218+
yield assert_equal, merger2.cmdline, \
219+
'fslmerge -tr foo_merged.nii %s %.2f' % (' '.join(filelist), 2.25)
220+
221+
clean_directory(outdir, cwd)
222+
# test arguments for opt_map
223+
# Fslmerge class doesn't have a filled opt_map{}
224+
190225
# test fslmath
191226
@skipif(no_fsl)
192227
def test_fslmaths():

0 commit comments

Comments
 (0)