facebookresearch / fastMRI

A large-scale dataset of both raw MRI measurements and clinical MRI images.
https://fastmri.org
MIT License
1.28k stars 370 forks source link

Allow the data objects (module and dataset) to filter on contrast #256

Closed zaccharieramzi closed 2 years ago

zaccharieramzi commented 2 years ago

Please:

It would be nice to be able to do the following:

data_module = FastMriDataModule(
    ...,
    test_contrasts='CORPD_FBK',
    val_contrasts='CORPD_FBK',
    train_contrasts=['CORPD_FBK', 'CORPDFS_FBK'],
)

This would enable:

I want this to perform finer evaluation anyway, so I can do a PR if interested.

mmuckley commented 2 years ago

Hello @zaccharieramzi, this is a pretty good idea, but I think we would probably prefer to have something a little more generic. Would you consider a lambda function that could be applied to the examples attribute of SliceDataset? You could use the lambda to filter based on any data stored in the examples tuples.

zaccharieramzi commented 2 years ago

Agreed. Let me work on this.

zaccharieramzi commented 2 years ago

Maybe the only issue is then that you don't have argparse support, but I guess it can always be added by the end user.