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