This repository contains code for downloading, sorting, extracting (to .mha i.e. a MetaImage) and viewing CT slices from open datasets like:-
- Install Anaconda with python3.7
- Install git
- Open a terminal and follow the commands
- Clone this repository
git clone [email protected]:prerakmody/medloader.git
- Install
cd medloader
conda env create --file environment.yml --name medloader
(Ensure it is in UTF-8 encoding)- this will take time as it need to download and install all packages
- Use
conda activate medloader
conda develop .
- Adds medloader as a python pacakge on your local machine
- Clone this repository
- To download/sort/extract the MICCAI 2015 dataset
- Keep medloader.dataloader.config.VOXEL_RESO as an empty tuple
=()
if you dont want to resmaple- Time consuming step (but it is recommended that all 3D volumes have the same pixel spacing)
python
demo/tf_han_miccai2015_loader.py- This shall create a
./_data/HaN_MICCAI2015
directory withraw/
andprocessed/
data files for each patient - If medloader.dataloader.config.VOXEL_RESO is kept empty, then also set the
resampled
flag toFalse
in demo.tf_han_miccai2015_trainer.params.dataloader
- This shall create a
- Note
- You may want to remove patient-id=
0522c0125
due to its small dimensions in the z-axis- If medloader.dataloader.config.HaN_MICCAI2015['GRID_3D']['SIZE'] = [96,96,96]
- Remove it from _data/HaN_MICCAI2015/processed/train/data_3D/{*.csv}
- If medloader.dataloader.config.HaN_MICCAI2015['GRID_3D']['SIZE'] = [96,96,96]
- You may want to remove patient-id=
- Keep medloader.dataloader.config.VOXEL_RESO as an empty tuple
- To train a model
- Run
python
demo/tf_han_miccai2015_trainer.py- You can change the params within that file if need be
- If you have a GPU with mem < 6GB, then change the demo.tf_han_miccai2015_trainer.params.model.name key to
config.MODEL_UNET3DSHALLOW
- If you still have memory issues, then change other parameters such as demo.tf_han_miccai2015_trainer.params.model.{batch_size,prefetch_batch,parallel_calls}
- Note:
- To enable demo.tf_han_miccai2015_trainer.params.model.profiler
- To run training script without sudo: Instrutions by Nvidia
- To enable demo.tf_han_miccai2015_trainer.params.model.profiler
- Run
- Remove conda env
conda env remove -n medloader
- Conbvert tensorflow code to PyTorch