@@ -181,7 +181,6 @@ def _gen_filename(self, name):
181
181
return config_file
182
182
return None
183
183
184
- ## dcm2niix update
185
184
186
185
class Dcm2niixInputSpec (CommandLineInputSpec ):
187
186
source_names = InputMultiPath (File (exists = True ), argstr = "%s" , position = - 1 ,
@@ -197,7 +196,6 @@ class Dcm2niixInputSpec(CommandLineInputSpec):
197
196
verbose = traits .Bool (False , argstr = '-v' , usedefault = True )
198
197
199
198
200
-
201
199
class Dcm2niixOutputSpec (TraitedSpec ):
202
200
converted_files = OutputMultiPath (File (exists = True ))
203
201
bvecs = OutputMultiPath (File (exists = True ))
@@ -224,9 +222,7 @@ class Dcm2niix(CommandLine):
224
222
225
223
def _format_arg (self , opt , spec , val ):
226
224
if opt in ['bids_format' , 'merge_imgs' , 'single_file' , 'verbose' ]:
227
-
228
225
spec = deepcopy (spec )
229
-
230
226
if val :
231
227
spec .argstr += ' y'
232
228
else :
@@ -249,43 +245,34 @@ def _parse_stdout(self, stdout):
249
245
bids = []
250
246
skip = False
251
247
find_b = False
252
-
253
248
for line in stdout .split ("\n " ):
254
249
if not skip :
255
250
out_file = None
256
251
if line .startswith ("Convert " ): # output
257
252
fname = str (re .search ('\S+/\S+' , line ).group (0 ))
258
-
259
253
if isdefined (self .inputs .output_dir ):
260
254
output_dir = self .inputs .output_dir
261
255
else :
262
256
output_dir = self ._gen_filename ('output_dir' )
263
257
264
258
out_file = os .path .abspath (os .path .join (output_dir , fname ))
265
-
266
259
# extract bvals
267
260
if find_b :
268
261
bvecs .append (out_file + ".bvec" )
269
262
bvals .append (out_file + ".bval" )
270
263
find_b = False
271
-
272
264
# next scan will have bvals/bvecs
273
265
elif 'DTI gradient directions' in line :
274
266
find_b = True
275
-
276
267
else :
277
268
pass
278
-
279
269
if out_file :
280
270
files .append (out_file + ".nii.gz" )
281
271
282
272
if self .inputs .bids_format :
283
273
bids .append (out_file + ".bids" )
284
-
285
274
continue
286
-
287
275
skip = False
288
-
289
276
# just return what was done
290
277
if not bids :
291
278
return files , bvecs , bvals
0 commit comments