Coder Social home page Coder Social logo

acenet-for-neuroanatomy-segmentation's Introduction

ACEnet-for-Neuroanatomy-Segmentation

ACEnet: Anatomical Context-Encoding Network for Neuroanatomy Segmentation


Preprocessing

Data can be found at 2012 MALC MICCAI challenge website.

  1. Use Freesurfer to preprocess data into 256x256x256 along with the brainmask generated.
  2. convert data and brainmasks to numpy, refer to ./data_utils/utils.py function remaplabels() to generate corresponding labels.

The file should follow the directory:

|-->Project
    |-->resampled
       |-->training-imagesnpy (1000_3.npy and 1000_3_brainmask.npy)
       |-->training-labels-remapnpy (1000_3_glm.npy --labels for coarse segmentation)
       |-->training-labels139 (1000_3_glm.npy --labels for fine-grained segmentation)
       |-->testing-imagesnpy (1003_3.npy and 1000_3_brainmask.npy)
       |-->testing-labels-remapnpy (1003_3_glm.npy --labels for coarse segmentation)
       |-->testing-labels139 (1003_3_glm.npy --labels for fine-grained segmentation)
    |-->segmentation
       |-->all git files

Installation:

git clone https://github.com/ymli39/ACEnet-for-Neuroanatomy-Segmentation
cd ACEnet-for-Neuroanatomy-Segmentation
pip install nibabel tqdm

Training

Parameter could be tuned at the beginning of the running files: train.py, test_coarse.py, test_fine.py.

You need to modify the folowing subjects for training and testing:

RESUME_PATH: directory to resume the model
SAVE_DIR: directory to save the model
NUM_CLASS: label classes +1 (background)
TWO_STAGES: use two stage training
RESUME_PRETRAIN: set False if want to train from epoch 0, True to resume the pretrained epoch

DATA_DIR = '../resampled/'
DATA_LIST = './datasets/'

-b-train: For NVIDIA TITAN XP GPU with 12 GB memory, use batch size of 4. 
-b-test: use 2, must be bigger than 1.
-num-slices: slice thickness used for Spatial Encoding Module, use 3 for coase-grained segmentation and 7 for for-grained segmentation.
--lr-scheduler: used poly
--lr: for train from scratch, use 0.01 and 0.02 for coarse and fine-grained respecitvely, for pretrain, use 0.001 and 0.005 for coarse and fine-grained respecitvely.

For start a new training, use:

CUDA_VISIBLE_DEVICES=0 python train.py --resume-pretrain False

For load the data augmented pretrain model, use:

CUDA_VISIBLE_DEVICES=0 python train.py --resume-pretrain True

For running the test, use:

CUDA_VISIBLE_DEVICES=0 python test_(coarse/fine).py

Testing

I have updated a test_demo folder for people to use, this folder contains the models trained on 30 MALC 2012 dataset in both coarse-grained and fine-grained segmentations.

You could chose any MRI images to generate corresponding segmentation labels. This model takes the input of a MRI brain images and outputs the setgmentation mask and skull mask.

The testing run script is referred in file "runscript.txt"


Update

I added a dataloader file for loading nifty data. The file could be found under directory: ./data_utils/MRIloader_nifty.py


Reference

Please refer to the paper for more implementation details:

@article{li2021acenet,
  title={ACEnet: Anatomical Context-Encoding Network for Neuroanatomy Segmentation},
  author={Li, Yuemeng and Li, Hongming and Fan, Yong},
  journal={Medical Image Analysis},
  pages={101991},
  year={2021},
  publisher={Elsevier}
}

acenet-for-neuroanatomy-segmentation's People

Contributors

ymli39 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

acenet-for-neuroanatomy-segmentation's Issues

ACEnet results

Hello author.Recently, I have done some preprocessing again, and I found that the images and labels slicing methodswere different before, so the performance was not good. I recently adjusted the preprocessing, and found that theeffect was good, this is the result of it.The fine-grained segmentation performance can be achieved 0.776,and coarse-grained segmentation performance can be achieved 0.900

This is the result of fine- grained segmentation:
image
image

This is the result of coarse-grained segmentation:
image

But my visualization results for the left and right brain segmentation color is the same, such a result is correct?

ACEnet issues

hello,I now think there might be something wrong with my preprocessing.My pretreatment process is as follows, do you think it is correct.
1:Use freesurfer to preprocess traing-images,traing-labels,testing-images,testing-labels into 256256256,command is mri_convert
--crop 128 128 134 input output;
2:Use the recon-all command to generate brainmask;
3:use ./data_utils/utils.py function convertTonpy() to convert data and brainmasks to numpy;
4:use ./data_utils/utils.py function remaplabels() to generate corresponding labels.

incorrect test

Hi,i tried to test on coarsed malc2012 with the preprocessed data,but the result of dice is different with the final checkpoint,always 0.034 on every test sample,it seems didn't successfully use weights. if you know the reason,please tell me how to resolve it,thanks much!

Dataset unavaliable.

Hi, can you share the 2012 Multi-Atlas Labeling Challenge dataset? I tried to apply for the dataset through official website but no response is returned.

ACEnet tissues

Hello, there is something wrong with this code recently. Why do you take 22 slices and stack them when verifying?
image

ACEnet issues

Hello,I have a few questions in restore to the Acenet experiment.
Coase-grained segmentation's performance is the same as in the paper,dice_score can reach 0.89.The chart below shows the predicted results:
image
However fine-grained segmentation's performance is very poor,dice_score can only reach 0.2.The chart below shows the predicted results:
image
I also use test_demo.py to check the data preformance,The results are good at coarse-grained.Blow are pred.nii.gz and skull.nii.gz
image
image
However the results are very poor at fine-grained.
image
image
So I wonder if there is something wrong with fine-grained labels generation.MICCAI2012 datasets have 133 fine structures,however But 139 labels are generated here.

Visualization Code

Excuse me,author
Although i've unfortunately known that you didn't preserve your visualization codes , i still ask you to share your main code,it's critical for me to analyze the question in my framework, i believe many others need it.I am sorry for the intrusion again!thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.