mne-tools/mne-bids-pipeline

Adjust vmin/vmax parameters in epochs image in report to rejection limits

SophieHerbst opened this issue · 12 comments

When checking the reports for the cleaned epochs, I would like to set the scale limits to the defined epochs rejection thresholds.
Otherwise, when the scale limits are set automatically it is impossible to interpret the colors and figure out quickly whether the thresholds were high enough.
If I am not mistaken, this requires an adjustement in mne.report.add_epochs, to hand down the rejection limits?
In the pipeline, I would suggest to make it the default that the epochs images are scaled to the rejection limits when clean epochs are displayed in the report.
WDYT?

One disadvantage is that if people have their thresholds set very high because they know they only want to exclude artifacts are huge (or because autoreject sets them that way), but their signals of interest are small (and SNR high other than the large artifacts that get rejected), then the range of the epochs images will end up being compressed (all white)

I see your point. Is there a custom way for me to adjust them in the report created by the pipeline to have the same limits for all my participants?

any insights on how to do this @hoechenberger ?

@SophieHerbst It would require a change to MNE-Python and subsequently to the Pipeline. Nothing difficult, but still a bit of work:

Then we could do Report.add_epochs(..., image_kwargs={"vmin": ..., "vmax": ...})

Once we have this, we'd need to expose this functionality (or a more restricted subset of it) via the Pipeline configuration.

Mh, ok, it sounds like a bit of work, but I would find it very useful. Shall I give it a try?

Shall I give it a try?

Sure, if you have the time, please feel free to take a stab at this!

Now the change in MNE is done, we need to decide how to set vmin/vmax in the pipeline.
It feels a bit too much to add them as possible configuration parameters, but I do not see another way.
Defaults: None?

Then we could do Report.add_epochs(..., image_kwargs={"vmin": ..., "vmax": ...})

Once we have this, we'd need to expose this functionality (or a more restricted subset of it) via the Pipeline configuration.

I think something like report_add_epochs_kwargs: Optional[dict] = None and in your use case you'd do

report_add_epochs_kwargs = dict(image_kwargs=dict(...))

could work

@larsoner I realize that we need to be able to pass vmin and vmax for all channel types. This requires to also pick them for channel types when plotting the epochs image in mne's report.py, l 3898, right?
.pick(ch_type, verbose=False)

In my config, I would have this:

report_add_epochs_kwargs = dict(image_kwargs=dict(grad = dict(vmin=-reject['grad'], vmax=-reject['grad']), 
                                                  mag = dict(vmin=reject['mag'], vmax=reject['mag'])))

Sure but we could consider adding a convenience alias report_add_epochs_kwargs = 'reject' if you want. This would have the advantage of also potentially working with stuff like autoreject-set limits, which you wouldn't have access to in the config.py file itself.

I think this was resolved via #859