@@ -251,6 +251,9 @@ def update_complex_name(fileinfo, this_prefix_basename, suffix):
251
251
else :
252
252
mag_or_phase = suffix
253
253
254
+ # Determine scan suffix
255
+ filetype = '_' + this_prefix_basename .split ('_' )[- 1 ]
256
+
254
257
# Insert reconstruction label
255
258
if not ('_rec-%s' % mag_or_phase ) in this_prefix_basename :
256
259
# If "_rec-" is specified, prepend the 'mag_or_phase' value.
@@ -262,12 +265,18 @@ def update_complex_name(fileinfo, this_prefix_basename, suffix):
262
265
263
266
# If not, insert "_rec-" + 'mag_or_phase' into the prefix_basename
264
267
# **before** "_run", "_echo" or "_sbref", whichever appears first:
265
- for label in ['_run' , '_echo' , '_sbref' ]:
266
- if (label in this_prefix_basename ):
268
+ for label in ['_dir' , '_run' , '_mod' , '_echo' , '_recording' , '_proc' , '_space' , filetype ]:
269
+ if label == filetype :
270
+ this_prefix_basename = this_prefix_basename .replace (
271
+ filetype , "_rec-%s%s" % (mag_or_phase , filetype )
272
+ )
273
+ break
274
+ elif (label in this_prefix_basename ):
267
275
this_prefix_basename = this_prefix_basename .replace (
268
276
label , "_rec-%s%s" % (mag_or_phase , label )
269
277
)
270
278
break
279
+
271
280
return this_prefix_basename
272
281
273
282
@@ -289,10 +298,12 @@ def update_multiecho_name(fileinfo, this_prefix_basename, echo_times):
289
298
echo_number = fileinfo ['EchoNumber' ]
290
299
else :
291
300
echo_number = echo_times .index (fileinfo ['EchoTime' ]) + 1
301
+
302
+ # Determine scan suffix
292
303
filetype = '_' + this_prefix_basename .split ('_' )[- 1 ]
293
304
294
305
# Insert it **before** the following string(s), whichever appears first.
295
- for label in ['_run ' , filetype ]:
306
+ for label in ['_recording' , '_proc' , '_space ' , filetype ]:
296
307
if label == filetype :
297
308
this_prefix_basename = this_prefix_basename .replace (
298
309
filetype , "_echo-%s%s" % (echo_number , filetype )
@@ -321,10 +332,13 @@ def update_uncombined_name(fileinfo, this_prefix_basename, channel_names):
321
332
channel_number = '' .join ([c for c in fileinfo ['CoilString' ] if c .isdigit ()])
322
333
if not channel_number :
323
334
channel_number = channel_names .index (fileinfo ['CoilString' ]) + 1
335
+
336
+ # Determine scan suffix
324
337
filetype = '_' + this_prefix_basename .split ('_' )[- 1 ]
325
338
326
339
# Insert it **before** the following string(s), whichever appears first.
327
- for label in ['_run' , '_echo' , filetype ]:
340
+ # Choosing to put channel near the end since it's not in the specification yet.
341
+ for label in ['_recording' , '_proc' , '_space' , filetype ]:
328
342
if label == filetype :
329
343
this_prefix_basename = this_prefix_basename .replace (
330
344
filetype , "_channel-%s%s" % (channel_number , filetype )
0 commit comments