junyuchen245 / TransMorph_Transformer_for_Medical_Image_Registration

TransMorph: Transformer for Unsupervised Medical Image Registration (PyTorch)
MIT License
453 stars 76 forks source link

how to train the model on a custom dataset #49

Closed morteza89 closed 1 year ago

morteza89 commented 1 year ago

Hi,

If we have a custom dataset of MRI images of hands and we want to train the model for that purpose, 1. what should be the format of data in train_dir and val_dir to train the model? I mean costum_data/Train/------ subject_0 <--- Should this be a 3D MRI data of shape (frame, H, W)? or it has to have the related mask as well?

    subject_1
  1. Is each subject one MRI data of (frame, H, W) shape? , or should it be the fixed MRI data along with the moving MRI data we want to register?

Thanks,

junyuchen245 commented 1 year ago

Hi @morteza89 ,

It should be relatively straightforward for you to use your own dataset script according to your needs, e.g.: https://github.com/junyuchen245/TransMorph_Transformer_for_Medical_Image_Registration/blob/9c34ac92ec4626c88714fd2336aaff59c163e626/OASIS/TransMorph/data/datasets.py#L10

The model solely necessitates two inputs - the moving and the fixed images.

Thanks, Junyu