Code Monkey home page Code Monkey logo

cnn-dicom-segmentation's Introduction

HealthCare

Project : Image Segmentation of Dicom Images to remove headrest label from head CT scans

Please give a โญ if you like my work.๐Ÿ‘ฝ

Description

  • Programming Language - Python2.7, Jupyter, Tensorflow
  • Task: Remove Headrest from all the scans of patient given in dicom format using Convolutional Neural Networks by Image Segmentation

Data Preprocessing

  • Reading Dicom Images from pydicom package and store image in numpy arrays.
  • Converting raw grayscaled images stored in Hounsfield Units into meaningful numpy arrays for CNNs by rescaling them using slope and threshold taken from dicom image header. Below is the example of Hounsfield units histogram representation before scaling of a dicom image.

    Here is the Hounsfield units histogram representation after scaling and threshold correction for the same dicom image.

  • Creating Ground truth labels by segmenting images using K-Means clustering and finding non-connected components in a clustered image to identify headrest label.This works with 95%+ accuracy as only few examples are there where headrest is connected directly to head in a CT scan image. Below is one of the example where our method fails and this will be solved by using CNNs:

    Segmenting them by calculating mean and standard deviation of HU units for each label created in previous step, this is done because more often some small noisy components of head may also get labelled as headrest which are not connected to head in a CT scan image. Then, we give headrest label pixels as 1 in the image and rest all label pixels as 0 in the image.
  • Storing these labels as segmented labels for training input images.

Building CNNs

  • Input Image of 512 * 512 greyscaled images of head CT scans.
  • Output - Segmented label for Headrest
  • Built different models:
    • 3 Layer - 2 Convolutional/Deconvolutional in each layer - 2 Max pooling - "VALID" padding (size not same of output)
    • 7 Layer - 2 Convolutional/Deconvolutional (First 3 layers), 4 (Next 3 layers), 8(Last layer) - 6 pooling and upsampling layers - "SAME" padding (Final model used for predicting images.) Here is the architecture of convolutional neural network model:

  • Performing much better than thresholding methods

Results & Visualization

  • Achieved accuracy above 99% in Image segmentation of 500 dicom images. Here is one example of one test image.

  • Since model was trained on only head CT scan images, here is the segmented image of chest CT scan image when feeded to the model.

  • There is an awesome visualization of how model improves and predicts a batch of 10 images per epoch in a video format. Here is the link for the video or you can also download it from /images/Epoc_video.mp4

Special credit to Joel Akeret for beautiful implementation of Image Segmentation of Tensorflow. Please visit his repo for detailed code.

cnn-dicom-segmentation's People

Contributors

harsh1795 avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

cnn-dicom-segmentation's Issues

Hi harsh! I didn't see any dicom files

Thanks for your sharing! I want to try this program, but I didn't see any .dicom file, Would you like to send me the DICOM file that on the Readme page?

Need help regarding DICOM Images preprocessing

Hi Harsh,
I am working on CHAOS 2019 DICOM CT Scan dataset for Liver Segmentation which has training dataset with labels(Ground Truth Images) and Testing dataset.
I want to know details about the preprocessing of the DICOM image database for training the deep neural network (CNN).
I need your help to understand detail preprocessing step wise so that I will be in a position to apply the steps to the DICOM image database.
Expecting a reply from your side. Your help will be much appreciated. Thanks in advance.

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.