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