Project-MONAI / Project-MONAI/MONAI
Dataset for longitudinal imaging data
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8.7k
- Forks
- 1.6k
- Avg merge
- 5d 1h
- Merged PRs (30d)
- 20
Description
In the medical domain, patients often undergo repeated image screening. Yet, all datasets so far implemented in MONAI only consider cross-sectional data. I think a dataset that handles longitudinal imaging data would therefore be a great addition to the repository.
I have already built a longitudinal dataset with and without caching of non-random transforms in my own research project and I would be happy to share it with this great repository. Just like other MONAI datasets, the dataset expects a list of dictionaries with the expectation that the data is ordered longitudinally:
[{ {
'T1': ['t1image1_1.nii.gz', 't1image1_2.nii.gz', 't1image1_3.nii.gz'], 'T1': ['t1image2_1.nii.gz', 't1image2_2.nii.gz', 't1image2_3.nii.gz']
'T2': ['t2image1_1.nii.gz', 't2image1_2.nii.gz', 't2image1_3.nii.gz'], 'T2': ['t2image2_1.nii.gz', 't2image2_2.nii.gz', 't2image2_3.nii.gz']
'extra': [123, 456, 789] 'extra': [123, 456, 789]
}, }]
Additionally, an argument specifying the image keys (e.g., T1 and T2 in the above example) needs to be added during the datasets initialisation:
dataset = SeqDataset(
data=data,
image_keys=['T1', 'T2'],
transforms=transforms)
Note: If there is interest in the longitudinal dataset, I also implemented a custom collate function (i.e., SequenceBatchCollater) that automatically pads or truncates the sequence of images to the desired length and can be used with any MONAI dataloader:
dataloader = monai.data.DataLoader(
dataset=dataset,
...,
collate_fn=SequenceBatchCollater(keys=['image', 'label'], seq_length=8)
With the custom collate function, the dataloader returns a batch of shape [B x S, C, H, W, ...], where S is the sequence length.
Let me know what you think of the implementation. In the case of interest, I would be happy to make a contribution to the project.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the proposed SeqDataset in data/datasets.py and SequenceBatchCollater in data/utils.py, then compare them with MONAI's existing dataset and DataLoader entry points. Check how image_keys, longitudinal ordering, caching, padding, and truncation would fit the repository's current APIs; done means an agreed design and integrated dataset behavior with suitable tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- data, machine-learning
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100