Skip to content

Streamlit application for quantitative analysis of intervertebral disc (IVD) degeneration

Notifications You must be signed in to change notification settings

alex-bene/BianqueNet

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HF Model Badge HF Space Badge Paper Badge

Quantitative Analysis of Intervertebral Disc (IVD) Degeneration

This project is used to perform quantitative analysis of IVD degeneration on spine sagittal T2-weighted MRI images. The generated reports include:

  • Geometrical parameters of IVD
  • Signal intensity difference of IVD
  • IVD degeneration quantitative analysis results

NOTE 📝

This is just a frontend for the BianqueNet model introduced in "Deep learning-based high-accuracy quantitation for lumbar intervertebral disc degeneration from MRI" - [paper] [original codebase].

Slight adjustements have been made to the original code for readability and package version compatibility. Also, docker-related files have been added for easier development.

Quickstart

Docker

The project includes the required docker files for running this project. To run the application, navigate to the project directory and execute:

docker compose up

Then, open your browser at http://localhost:8501 to see the application.

Expected Input File Conventions

The system expect spine sagittal T2-weighted MRI images. Images should be square and exported directly from the corresponding software (I would advise against screenshots). For correct results, rename the images using the integrated Edit button inside the app to set the correct age and gender.

Results

The output results are located in output folder. For each input file inside inputs\data_input, a subfolder inside output directory is created with the name of the input file. Inside each subfoder are 7 files.

  1. The quantitative_analysis_results.xlsx file contains the quantitative result table.
    • jihe_parameter sheet stores the Geometrical parameters of IVD (columns indicate L1/L2~L5/S1, and rows indicate DH, DHI, HDR)
    • SI_parameter sheet stores the Signal intensity difference of IVD
    • quantitative_results sheet stores the IVD degeneration quantitative analysis results (the first row represents the degree of degeneration of IVD, and the next four rows represent the degree of deviation of IVD parameters from the baseline parameters).
  2. Each .png file is the visualization file of the IVD degeneration parameters on the reference pattern spectrum.
  3. The .BMP file is the visualization file of the corner detection results.
├─output
│ ├─D20230410-A085-SM
│ │ │ quantitative_analysis_results.xlsx
│ │ │ DH.png
│ │ │ DHI.png
│ │ │ HDR.png
│ │ │ point_detect.BMP
│ │ │ SI_dj.png
│ │ └─SI_weizhi.png

Development

I recommend using Visual Studio Code (VS Code) with the Remote Development extension to work on this project. This allows you to open the project as a container and have all dependencies automatically set up.

To use VS Code, follow these steps:

  1. Open VS Code.
  2. Install the Remote Development extension if you haven't already.
  3. Press Ctrl/Cmd + Shift + P and select "Dev Containers: Open Folder in Container..." from the command palette.
  4. Wait for the container to set up and start the Streamlit application.

Once the application is running, you can view it by navigating to http://localhost:8501 in your browser and make any changes to the files inside the container.

Codebase Structure

There are 5 main directories:

  1. the function folder contains files for calculating parameters and drawing.
  2. the input folder contains two subfolders, baseline_range folder contains statistical benchmark parameters, and data_input folder contains examples of IVD T2MRI images.
  3. network_big_apex folder contains different network structures.
  4. output folder stores the output results.
  5. weights_big_apex folder contains the training parameters of BianqueNet. You can download the weights from the original repo's pcloud link or from the hugging face hub. The app will auto-download the model when you run it, if it's not already downloaded on the expected folder.
.
│ main.py
│ README.md
│ requirements.txt  
├─function
│ │ calcu_DHI_512.py
│ │ calcu_signal_strength.py
│ │ custom_transforms_mine.py
│ │ quantitative_analysis.py
│ │ segmentation_optimization.py
│ │ shiyan_jihe_signal_mean_std_plot_function.py
│ │ __init__.py
│ └─__pycache__     
├─input
│ ├─baseline_range
│ │ ├─DH       
│ │ ├─DHI     
│ │ ├─DWR       
│ │ └─SI   
│ └─data_input
│   └─D20230410-A085-SM.BMP  
├─network_big_apex
│ └─network_deeplab_upernet_aspp_psp_ab_swin_skips_1288
├─output
│ └─D20230410-A085-SM
├─weights_big_apex
│ └─deeplab_upernet_aspp_psp_ab_swin_skips_1288

TODO

  • Replace "Date Taken" with a patient ID.
  • When we save uploaded files in the app, assign a user/session id to them so that only the person who uploaded can see them.

Citation

If you use this code for your research, please cite the original paper:

@article{zheng2022bianquenet,
  author = {Zheng, Hua-Dong and Sun, Yue-Li and Kong, De-Wei and Yin, Meng-Chen and Chen, Jiang and Lin, Yong-Peng and Ma, Xue-Feng and Wang, Hongshen and Yuan, Guang-Jie and Yao, Min and Cui, Xue-Jun and Tian, Ying-Zhong and Wang, Yong-Jun},
  year = 2022,
  pages = 841,
  title = {Deep learning-based high-accuracy quantitation for lumbar intervertebral disc degeneration from MRI},
  volume = 13,
  journal = {Nature Communications},
}

About

Streamlit application for quantitative analysis of intervertebral disc (IVD) degeneration

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.3%
  • Dockerfile 0.7%