Skip to content
OishiLabPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

58 Commits

Folders and files

Repository files navigation

OpenMAP_Logo_with_name

OpenMAP-D

OpenMAP-D parcellates Adult's DTI into 170 anatomical regions based on JHU-atlas in 60 (sec/case).
(CSF label includes eyeball)

Installation Instructions

  1. install python and make virtual environment
    python3.8 or later is recommended.

  2. Clone this repository:

git clone https://github.com/OishiLab/OpenMAP-D.git
  1. Please install PyTorch compatible with your environment.
    https://pytorch.org/

Once you select your environment, the required commands will be displayed.

image

If you want to install an older Pytorch environment, you can download it from the link below.
https://pytorch.org/get-started/previous-versions/

  1. Go into the repository and install:
cd OpenMAP-D
pip install -r requirements.txt

How to use it

Using OpenMAP-D is straightforward. You can use it in any terminal on your linux system. We provide CPU as well as GPU support. Running on GPU is a lot faster though and should always be preferred. Here is a minimalistic example of how you can use OpenMAP-D.

python3 parcellation.py -i INPUT_DIRNAME -o OUTPUT_DIRNAME -m MODEL_DIRNAME

If you want to specify the GPU, please add CUDA_VISIBLE_DEVICES=N.

CUDA_VISIBLE_DEVICES=1 python3 parcellation.py -i INPUT_DIRNAME -o OUTPUT_DIRNAME -m MODEL_DIRNAME

If the error occurs for Windows users, please change Python3 to Python.

How to download the pretrained model.

You can get the pretrained model from the this link. Link of pretrained model!

Folder

All images you input must be in NifTi format and have a .nii extension.

INPUT_DIRNAME/
  ├ A_00.nii(DWI)
  ├ A_01.nii(B0)
  ├ A_02.nii(COLOR_R)
  ├ A_03.nii(COLOR_G)
  ├ A_04.nii(COLOR_B)
  ├ A_05.nii(FA, OPTIONAL)
  ├ A_06.nii(MD, OPTIONAL)
  ├ A_07.nii(EIGEN_VALUE0, OPTIONAL)
  ├ A_08.nii(EIGEN_VALUE1, OPTIONAL)
  ├ A_09.nii(EIGEN_VALUE2, OPTIONAL)
  ├ B_00.nii(DWI)
  ├ B_01.nii(B0)
  ├ B_02.nii(COLOR_R)
  ├ B_03.nii(COLOR_G)
  ├ B_04.nii(COLOR_B)
  ├ ...

OUTPUT_DIRNAME/
  ├ A/
  |   ├ A_0*.nii # input image
  |   ├ A_volume.csv # volume information (mm^3) and optional information (depends on input image size)
  |   └ A_170.nii # parcellation map
  └ B/
      ├ B_0*.nii
      ├ B_volume.csv
      └ B_170.nii
  |
  └ ...

MODEL_DIRNAME/
  ├ SSNet/SSNet.pth
  ├ PNet
  |   ├ coronal.pth
  |   ├ sagittal.pth
  |   └ axial.pth
  └ HNet/
      ├ coronal.pth
      └ axial.pth

Creating the Input Directory for the OpenMAP-D

To create the input directory structure as referenced below, it is necessary to separate the color image into its RGB components. You can use the convert_to_openmap_format.py script to generate the required input directory. Note

  • Ensure that the following file naming conventions are used:
    • DWI images should be named as A_dwi.nii(A is subject identifier)
    • b0 images should be named as A_b0.nii
    • color images should be named as A_color.nii
    • fa images should be named as A_fa.nii
    • md images should be named as A_md.nii
    • eigen value 0 images should be named as A_e0.nii
    • eigen value 1 images should be named as A_e1.nii
    • eigen value 2 images should be named as A_e2.nii
  • If the subject names are different, you can place all the images into the same directory. The script can then process them in a single run to generate the Input directory.
python3 convert_to_openmap_format.py -i INPUT_DIRNAME -f CONVERT_DIRNAME
  • INPUT_DIRNAME: The directory that will be prepared as an input folder for OpenMAP using convert_to_openmap_format.py .
  • CONVERT_DIRNAME: The directory containing the files you want to convert.

FAQ

  • How much GPU memory do I need to run OpenMAP-D?
    We ran all our experiments on NVIDIA TITAN RTX GPUs with 24 GB memory. For inference you will need less, but since inference in implemented by exploiting the fully convolutional nature of CNNs the amount of memory required depends on your image. Typical image should run with less than 4 GB of GPU memory consumption. If you run into out of memory problems please check the following: 1) Make sure the voxel spacing of your data is correct and 2) Ensure your MRI image only contains the head region.

  • Will you provide the training code as well?
    No. The training code is tightly wound around the data which we cannot make public.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages