GSTT-CSC / project-template

Template for new projects
0 stars 0 forks source link

69 datamodule and data import are combined #70

Open mikewoodward94 opened 1 month ago

mikewoodward94 commented 1 month ago

Summary of changes

Added a new file called XNATDataImport.py and adapted train.py and DataModule.py accordingly.

Reason for changes

The current implementation of pulling data from XNAT during the initialising of the PyTorch Lightning DataModule is messy and confusing. Adding the data import as a separate step is clearer, and additionally allows for simpler unit testing and data validation.

In this PR I've also updated the DataModule to align with best practices (https://lightning.ai/docs/pytorch/stable/data/datamodule.html). This includes removing the get_data() step as it is now not needed and renaming prepare_data() as setup().