@@ -85,3 +85,28 @@ def test_synthesizeflash(create_files_in_directory):
85
85
syn2 = freesurfer .SynthesizeFLASH (t1_image = filelist [0 ], pd_image = filelist [1 ], flip_angle = 20 , te = 5 , tr = 25 )
86
86
assert syn2 .cmdline == ('mri_synthesize 25.00 20.00 5.000 %s %s %s'
87
87
% (filelist [0 ], filelist [1 ], os .path .join (outdir , 'synth-flash_20.mgz' )))
88
+
89
+ @pytest .mark .skipif (freesurfer .no_freesurfer (), reason = "freesurfer is not installed" )
90
+ def test_mandatory_outvol (create_files_in_directory ):
91
+ filelist , outdir = create_files_in_directory
92
+ mni = freesurfer .MNIBiasCorrection ()
93
+
94
+ # make sure command gets called
95
+ assert mni .cmd == "mri_nu_correct.mni"
96
+
97
+ # test raising error with mandatory args absent
98
+ with pytest .raises (ValueError ): mni .run ()
99
+
100
+ # test raising error with only partial mandatory args present
101
+ mni .inputs .in_file = filelist [0 ] #mgz
102
+ with pytest .raises (ValueError ): mni .run ()
103
+
104
+ # rest of mandatory inputs
105
+ mni .inputs .out_file = 'bias_corrected_file'
106
+
107
+ assert mni .cmdline == ('mri_nu_correct.mni --i %s --n 4 --o bias_corrected_file.mgz'
108
+ % filelist [0 ])
109
+ # constructor based tests
110
+ mni2 = freesurfer .MNIBiasCorrection (in_file = filelist [0 ], out_file = 'bias_corrected_file' )
111
+ assert mni2 .cmdline == ('mri_nu_correct.mni --i %s --n 4 --o bias_corrected_file.mgz'
112
+ % filelist [0 ])
0 commit comments