Giter Site home page Giter Site logo

artorg-unibe-ch / qam Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 3.0 9.52 MB

Library to compute 3D surface-distances for evaluating liver ablation/tumor completeness based on segmentation images.

License: GNU General Public License v3.0

Python 100.00%
segmentation liver-disease tumor-segmentation segmentation-evaluation surface-distances medical-image-analysis euclidean-distances radiomics 3d-surface-distances ablation

qam's Introduction

Quantitative Ablation Margin (QAM)

Library to compute 3D surface-distances between a tumor and an ablation volume.

You can find more about ablation treatments for liver cancer in the following open access book chapter "Stereotactic Image-Guidance for Ablation of Malignant Liver Tumors" from Liver Pathology.

image

We used an adapted Dice Soerensen coefficient to evaluate the ablation completeness in treating liver tumors. The quantitative ablation margin (QAM) calculation is illustrated in the next figure. The output is an array of 3D surface distances that can also be visualized as traffic-light colored histogram (see last step in the pipeline). image

Installation

The library can be installed via pip from the GitHub repository

python -m pip install git+https://github.com/artorg-unibe-ch/qam.git

Usage

To calculate the ablation margin one needs a segmentation mask of the tumor, ablation, and (optional) liver. All images need to be in the same spacing, and co-registered.

Usage on the command line

python -m qam -t tumor_file -a ablation_file -l liver_file -om output_filename -p patient_id

Usage in own code

Import the packages

from qam import margin, plotting, visualization

Calculate the ablation margin:

distances = margin.compute_distances(tumor, ablation, liver, spacing_mm)
df = margin.summarize(subject_id, lesion_id, distances)

Plot the margin as a histogram:

non_ablated, insuffieciently_ablated, completely_ablated =\
plotting.plot_histogram_surface_distances(pat_name=patient_id, lesion_id=lesion_id,
                                            output_file=output_file_png,
                                            distance_map=surface_distance['distances_gt_to_pred'],
                                            title='Quantitative Ablation Margin',
                                            print_case_details=True)

To visualize the margin in 3D, the NIFTI files can be passed directly:

visualization.visualize_3d_margin(tumor_nii, ablation_nii, output_file_wrl)

With automation like Snakemake

It is possible to use the code in an automated way. An example using Snakemake is provided in the examples.

qam's People

Contributors

ipa avatar rmsandu avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

qam's Issues

np.bool support dropped on numpy 1.24.0

Hello,
I am trying to use this package in my code. I am using numpy 1.24.1 and I get the following error:

"AttributeError: module 'numpy' has no attribute 'bool'".

Apparently (NVIDIA/TensorRT#2557) numpy.bool is no longer supported, so I had to install numpy 1.23 and it now seems to work.

You may want to update the code for other users.

Thank you.

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.