@@ -238,7 +238,7 @@ def prep_conversion(sid, dicoms, outdir, heuristic, converter, anon_sid,
238238
239239def update_complex_name (metadata , filename , suffix ):
240240 """
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
242242 sequence with magnitude/phase part.
243243
244244 Parameters
@@ -257,15 +257,18 @@ def update_complex_name(metadata, filename, suffix):
257257 Updated filename with rec entity added in appropriate position.
258258 """
259259 # 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' ,
261264 '_magnitude' , '_magnitude1' , '_magnitude2' ,
262265 '_phasediff' , '_phase1' , '_phase2' ]
263266 if any (ut in filename for ut in unsupported_types ):
264267 return filename
265268
266269 # Check to see if it is magnitude or phase part:
267270 if 'M' in metadata .get ('ImageType' ):
268- mag_or_phase = 'magnitude '
271+ mag_or_phase = 'mag '
269272 elif 'P' in metadata .get ('ImageType' ):
270273 mag_or_phase = 'phase'
271274 else :
@@ -275,19 +278,19 @@ def update_complex_name(metadata, filename, suffix):
275278 filetype = '_' + filename .split ('_' )[- 1 ]
276279
277280 # 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 :
281284 raise BIDSError (
282- "Reconstruction label for images will be automatically set, "
285+ "Part label for images will be automatically set, "
283286 "remove from heuristic"
284287 )
285288
286289 # 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 ]:
288291 if (label == filetype ) or (label in filename ):
289292 filename = filename .replace (
290- label , "_rec -%s%s" % (mag_or_phase , label )
293+ label , "_part -%s%s" % (mag_or_phase , label )
291294 )
292295 break
293296
0 commit comments