@@ -235,7 +235,7 @@ def prep_conversion(sid, dicoms, outdir, heuristic, converter, anon_sid,
235
235
236
236
def update_complex_name (metadata , filename , suffix ):
237
237
"""
238
- Insert `_rec-<magnitude |phase>` entity into filename if data are from a
238
+ Insert `_part-<mag |phase>` entity into filename if data are from a
239
239
sequence with magnitude/phase part.
240
240
241
241
Parameters
@@ -254,15 +254,18 @@ def update_complex_name(metadata, filename, suffix):
254
254
Updated filename with rec entity added in appropriate position.
255
255
"""
256
256
# Some scans separate magnitude/phase differently
257
- unsupported_types = ['_bold' , '_phase' ,
257
+ # A small note: _phase is deprecated, but this may add part-mag to
258
+ # magnitude data while leaving phase data with a separate suffix,
259
+ # depending on how one sets up their heuristic.
260
+ unsupported_types = ['_phase' ,
258
261
'_magnitude' , '_magnitude1' , '_magnitude2' ,
259
262
'_phasediff' , '_phase1' , '_phase2' ]
260
263
if any (ut in filename for ut in unsupported_types ):
261
264
return filename
262
265
263
266
# Check to see if it is magnitude or phase part:
264
267
if 'M' in metadata .get ('ImageType' ):
265
- mag_or_phase = 'magnitude '
268
+ mag_or_phase = 'mag '
266
269
elif 'P' in metadata .get ('ImageType' ):
267
270
mag_or_phase = 'phase'
268
271
else :
@@ -272,19 +275,19 @@ def update_complex_name(metadata, filename, suffix):
272
275
filetype = '_' + filename .split ('_' )[- 1 ]
273
276
274
277
# Insert rec label
275
- if not ('_rec -%s' % mag_or_phase ) in filename :
276
- # If "_rec -" is specified, prepend the 'mag_or_phase' value.
277
- if '_rec -' in filename :
278
+ if not ('_part -%s' % mag_or_phase ) in filename :
279
+ # If "_part -" is specified, prepend the 'mag_or_phase' value.
280
+ if '_part -' in filename :
278
281
raise BIDSError (
279
- "Reconstruction label for images will be automatically set, "
282
+ "Part label for images will be automatically set, "
280
283
"remove from heuristic"
281
284
)
282
285
283
286
# Insert it **before** the following string(s), whichever appears first.
284
- for label in ['_dir' , '_run' , '_mod' , '_echo' , ' _recording' , '_proc' , '_space' , filetype ]:
287
+ for label in ['_recording' , '_proc' , '_space' , filetype ]:
285
288
if (label == filetype ) or (label in filename ):
286
289
filename = filename .replace (
287
- label , "_rec -%s%s" % (mag_or_phase , label )
290
+ label , "_part -%s%s" % (mag_or_phase , label )
288
291
)
289
292
break
290
293
0 commit comments