Code Monkey home page Code Monkey logo

pytorch-unet3d-single_channel's Introduction

3D-Unet: patched based Pytorch implementation for medical images segmentation


Important News -- Repository Maintenance

This repository will no longer be developed and improved. A new version for medical images segmentation is available at https://github.com/davidiommi/SALMON


3D-Unet pipeline is a computational toolbox for segmentation using neural networks.

Same script applied for prostate segmentation can be found here: https://github.com/davidiommi/3D_Prostate_segmentation_pytorch

The training and the inference are patch based: the script randomly extract corresponding patches of the images and labels and feed them to the network during training. The inference script extract, segment the sigle patches and automatically recontruct them in the original size.

Example images

Sample MR images from the sagittal and coronal views for carotid artery segmentation (the segmentation result is highlighted in green)

MR3MR4


Requirements

pillow scikit-learn simpleITK keras scikit-image pandas pydicom nibabel tqdm torch>=0.4.1 torchvision>=0.2.1 dominate>=2.3.1 visdom>=0.1.8.

Python scripts and their function

  • organize_folder_structure.py: Organize the data in the folder structure for the network

  • NiftiDataset.py : They augment the data, extract the patches and feed them to the network (reads .nii files). NiftiDataset.py skeleton taken from https://github.com/jackyko1991/unet3d-pytorch

  • check_loader_patches: Shows example of patches fed to the network during the training

  • UNet.py: the architecture of the U-net.

  • utils.py : list of metrics and loss functions for the training

  • main.py: Runs the training and the prediction on the training and validation dataset.

  • predict.py: It launches the inference on training and validation data in the main.py

  • predict_single_image.py: It launches the inference on a single input image chosen by the user.

Usage

Use first organize_folder_structure.py to create organize the data in the following folder structure Modify the init.py to set the parameters and start the training/testing on the data:

Folder Structure:

.
├── Data_folder                   
|   ├── train_set              
|   |   ├── patient_1             # Training
|   |   |   ├── image             # Contains domain image 
|   |   |   └── label             # Contains domain label 
|   |   └── patient_2             
|   |   |   ├── image              
|   |   |   └── label              
|   ├── test_set               
|   |   ├── patient_3             # Testing
|   |   |   ├── image              
|   |   |   └── label              
|   |   └── patient_4             
|   |   |   ├── image              
|   |   |   └── label              
|   ├── validation_set               
|   |   ├── patient_5              # Validation
|   |   |   ├── image             
|   |   |   └── label              
|   |   └── patient_6             
|   |   |   ├── image              
|   |   |   └── label              

Features

  • 3D data processing ready
  • Augmented patching technique, requires less image input for training
  • one channel output (multichannel to be developed)
  • Generic image reader with SimpleITK support (Currently only support .nii/.nii.gz format for convenience, easy to expand to DICOM, tiff and jpg format)
  • Medical image pre-post processing with SimpleITK filters
  • Easy network replacement structure
  • Dice score similarity measurement as golden standard in medical image segmentation benchmarking

pytorch-unet3d-single_channel's People

Contributors

davidiommi 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

Watchers

 avatar

pytorch-unet3d-single_channel's Issues

when i run ''check_resolution.py'' and "check_loader_patches.py",I got a problem: Execute() takes 2 positional arguments but 10 were given

Dear David lommi

when i run ''check_resolution.py'' and "check_loader_patches.py",I met a problem:
#=====================================================================#
Traceback (most recent call last):
File "C:/Users/lenovo/Desktop/3D UNet Pytorch/check_resolution.py", line 19, in
a = resample_sitk_image(a, spacing=args.new_resolution, interpolator='linear')
File "C:\Users\lenovo\Desktop\3D UNet Pytorch\NiftiDataset.py", line 177, in resample_sitk_image
orig_pixelid)
TypeError: Execute() takes 2 positional arguments but 10 were given
Process finished with exit code 1
#======================================================================#
The data set format is based on the 'read me' you gave,I don't know how to how to deal with this problem.Could you please help me ?Looking forward to your reply!Thank you very much!

training dataset

I want to use images of .gif instead of .nii .
So I mordified label_name and data_name of def create_list() in NiftiDataset.py .
However there are errors!
%python check_loader_patches.py
RuntimeError: Exception thrown in SimpleITK ImageFileReader_Execute: /tmp/SimpleITK/Code/IO/src/sitkImageReaderBase.cxx:105:
sitk::ERROR: Unable to determine ImageIO reader for "./Data_folder/train_set/patient_1/image.gif"

Are images of .gif instead of .nii bad?

training set question

Hi, I am not understand about the data set setting of your program in the process of running. May I ask what data set this program applies to?Why do data_1 include A images and B labels in your training set?Shouldn't it be A images and A labels?
Also, Can it run under Win10?
Any help will be greatly appreciated

‘’https://github.com/davidiommi/3D_Prostate_segmentation_pytorch ‘’The link cannot be opened.

Hi,davidiommi

Thank you for sharing your code,When I want to open the following link:‘’https://github.com/davidiommi/3D_Prostate_segmentation_pytorch ‘’,it was found to be ineffective.I didn't find this repository on your home page.Could you please share it with me again? or could you please send it to my email address: [email protected].
Looking forward to your reply!Thank you very much!
Good Luck to 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.