Skip to content

BIDS related: potential change of .fif file split naming #7776

@sappelhoff

Description

@sappelhoff

TL;DR

would it be a big problem to change the FIF file "bids-style" split naming from _part-X to something else? (see:

mne-python/mne/io/utils.py

Lines 298 to 310 in 861e825

def _construct_bids_filename(base, ext, part_idx):
"""Construct a BIDS compatible filename for split files."""
# insert index in filename
deconstructed_base = base.split('_')
bids_supported = ['meg', 'eeg', 'ieeg']
for mod in bids_supported:
if mod in deconstructed_base:
idx = deconstructed_base.index(mod)
modality = deconstructed_base.pop(idx)
base = '_'.join(deconstructed_base)
use_fname = '%s_part-%02d_%s%s' % (base, part_idx, modality, ext)
return use_fname
)


When .fif files grow too large, they need to be split into chunks. In a BIDS context, where each file name follows a structure, we need some way to deal with this.

In 2017 or 2018 @jasmainak and @teonbrooks (I think? ... somebody else?) suggested to use *_part-X_meg.fif with the X being a number to define different parts of the same .fif recording.

Some context before the issue: The _part- syntax was (accidentally) not fully introduced into the specification: It is only a non-elaborated example in an appendix, see:

https://bids-specification.readthedocs.io/en/stable/99-appendices/06-meg-file-formats.html#neuromagelektamegin

This leads to the issue that now several other BIDS extension proposals want to use _part- and have started using it --> because they were not aware that it is already being used in MNE (because as I said, _part- is only mentioned in a non-elaborated example in an appendix).

The complete issue is here: bids-standard/bids-specification#429

The fight is essentially whether or not it's OK for MEG/MNE to claim _part- for themselves although it was never properly introduced into the spec.

One pragmatic solution is to

  1. drop the non-elaborated _part- example from the appendix of the BIDS spec
  2. properly introduce a new way to name split .fif files with a new PR to the BIDS spec (e.g., _split-X
  3. adapt MNE-Python to use that new, proper way (e.g., _split-X), and deprecating MNE support for the now invalid _part-X

This part of MNE would have to change:

mne-python/mne/io/utils.py

Lines 298 to 310 in 861e825

def _construct_bids_filename(base, ext, part_idx):
"""Construct a BIDS compatible filename for split files."""
# insert index in filename
deconstructed_base = base.split('_')
bids_supported = ['meg', 'eeg', 'ieeg']
for mod in bids_supported:
if mod in deconstructed_base:
idx = deconstructed_base.index(mod)
modality = deconstructed_base.pop(idx)
base = '_'.join(deconstructed_base)
use_fname = '%s_part-%02d_%s%s' % (base, part_idx, modality, ext)
return use_fname

There are other solutions described in the BIDS issue thread (I summarized them in this comment) but there are several parties with strong opinions, and if the pragmatic solution proposed in THIS issue is not a big deal for MNE folks, then going with this solution would resolve the BIDS issue in a straight forward way.

cc @robertoostenveld @effigies @yarikoptic

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions