Code Monkey home page Code Monkey logo

medical-detection3d-toolkit's Introduction

Medical-Detection3d-Toolkit

Landmark detection engine for 3D medical images

Framework

avatar

We use V-Net-a variant of 3D U-Net-for landmark detection. The overall landmark detection pipeline is very similar to the segmentation pipeline.

Training

We first generate the landmark mask for each intensity image. You may ask that each landmark is a world coordinate, how can we generate a mask for a coordinate? Good question! We solve it by taking all the voxels within a predefined physical distance (e.g., 3mm) of a landmark's coordinate as the voxels of that landmark. In this way, we can generate a multi-class mask as shown in the above picture. In the landmark mask, the value of landmark voxels are set to positive, the value of background voxels are set to zero. To make our model more robust, we set value of the background voxels that are very close to the landmark voxels (e.g., < 3mm) to negative, so they are regarded as invalid voxels that won't be computed in the loss function.

We then train a multi-class segmentation model given the generated landmark mask for each original image. The detals of training a segmentation can be referred to the V-Net paper. The only difference is that we use Focal loss-instead of Dice loss that was proposed in the paper-as the loss function. We found Focal loss was more stable than the Dice loss.

Inference

For a given test image and the trained segmentation model, we first obtain the probability maps for all landmarks. As shown in the above picture, each probability map represents the prediction of the landmark. We can simply pick the voxel with the highest probability as the final prediction. Or we can use the weighed voxel center as the final prediction. The latter method is more accurate and robust than the former one.

How to use?

Training

  1. Clone the code repository.
$ git clone https://github.com/qinliuliuqin/Medical-Detection3d-Toolkit.git
  1. Generate the landmark mask using this code. An example landmark mask can be found here.

In the landmark mask, there are three types of voxels:

Voxel value Voxel type
Positive: 1 - N landmark voxels-voxels of different landmarks should have different voxel value (e.g., for the landmark ith, voxels of this landmark can be set to i.)
0 background voxels
-1 invalid voxles
  1. Generate the training file, an example file can be found here.

  2. Train the model using this code, an example configuration file can be found Here.

Inference

lmk_det_infer.py

medical-detection3d-toolkit's People

Contributors

qinliuliuqin avatar

Watchers

 avatar

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.