Giter Club home page Giter Club logo

med_segmentation's Introduction

MedSeg: Medical Segmentation

All Contributors

Introduction

This repository contains code to train and evaluate 3D Convolutional Neural Networks for semantic segmentation on medical images. The architectures developed in this framework are a combination of auto-encoder UNet with shortcut connections as in ResNet, densely connections for deep supervision as in DensetNet and Merge-And-Run mapping for attention focusing as in MRGE.

Credits

Many thanks to all contributors of this repository. If you like it, please click on Star!

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

Küstner T, Hepp T, Fischer M, Schwartz M, Fritsche A, Häring HU, Nikolaou K, Bamberg F, Yang B, Schick F, Gatidis S, Machann J
"Fully automated and standardized segmentation of adipose tissue compartments via deep learning in 3D whole-body MRI of epidemiological cohort studies" Radiology Artificial Intelligence 2020.
[BibTeX]   [Endnote]

@article{Kuestner2020,
    title={Fully automated and standardized segmentation of adipose tissue compartments via deep learning in 3D whole-body MRI of epidemiological cohort studies},
    author={Thomas K\"ustner and Tobias Hepp and Marc Fischer and Martin Schwartz and Andreas Fritsche and Hans-Ulrich Häring and Konstantin Nikolaou and Fabian Bamberg and Bin Yang and Fritz Schick and Sergios Gatidis and J\"urgen Machann},
    journal={Radiology Artificial Intelligence},
    year={2020},
}

Documentation

Installation

Clone the repository and install the requirements

$ git clone https://gitlab.com/iss_mia/cnn_segmentation/ desired_directory
$ python3 -m pip install -r requirements.txt

Usage

Set all parameters in the configuration file. Check call arguments:

$ python3 main.py -h 

Preprocessing

Conversion of input data (DICOM, NiFTY, Matlab/HDF5) to TFRecords

$ python3 main.py --preprocess -c config/config_default.yml

Training

Network training on specified databases

$ python3 main.py --train -c config/config_default.yml -e experiment_name

Evaluation

Evaluate metrics of trained network

$ python3 main.py --evaluate -c config/config_default.yml -e experiment_name

Prediction

Predict segmentation mask for test dataset with trained network

$ python3 main.py --predict -c config/config_default.yml -e experiment_name

Database information

Get database information stored in Patient class

$ python3 readme/Patient_example.py -c config/config_default.yml

Networks/Architectures

Architectures are implemented in /models/ModelSet.py.

DCNet

densely connected with merge-and-run mapping network

Dilated dense convolution

Densely connected networks (including modifications: dilated convs, ...)

UNet

vanilla UNet and extension for inclusion of positional input

Dilated DenseNet

Densely connected network with dilations

Loss functions

Custom loss functions are defined in /models/loss_function.py.

Metrics

Custom evaluation metrics are defined in /models/metrics.py.

Applications

  • Whole-body semantic organ segmentation
  • Whole-body adipose tissue segmentation

License

This project is licensed under the Apache License - see the LICENSE file for details.

Contributors

Thanks to Marc Fischer for providing the med_io pipeline around which this framework was structured.


marcfi

💻 🤔 🚧 🔧

Thomas Kuestner

💻 🤔 🚧 📆 📖 👀 ⚠️

tobiashepp

💻 🤔 🚧 🔧 🛡️

a-doering

💻

KaijieMo1

💻 📖

sergiosgatidis

🤔 📆 💬

SarahMue

💻 🤔 🔌 🚧

CDStark

💻 🚧

fl3on

💻 ⚠️

haison

🐛

med_segmentation's People

Contributors

allcontributors[bot] avatar dependabot[bot] avatar fl3on avatar kaijiemo1 avatar thomaskuestner avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

med_segmentation's Issues

Change setup.py to same as requirements.txt

Hi Thomas,
Current setup.py is difference with requirements.txt
I think should change code as
from setuptools import setup, find_packages

`
import os

with open('./requirements.txt') as f:
requirements = f.read().splitlines()

setup(
name='med_segmentation',
version='1.0.0',
author='MIDAS and kSpace Astronauts',
author_email='[email protected]',
description='Medical Image Segmentation',
long_description=open(os.path.join(os.path.dirname(file), 'README.md')).read(),
package_dir={'med_seg': 'med_seg'},
packages=['med_seg'],
license='public',
keywords='None',
classifiers=[
'Natural Language :: English',
'Programming Language :: Python :: 3 :: Only'
],
install_requires==requirements,
)
`

Ask about landmark detection encode

Hi Thomas,
Thank you for your code.
As I check the code has the model for landmark detection (body identification).
I want to apply this for cardiac (AV, Apex, Aorta root, mitral valve, left/right coronary)
but I don't know how to encode for above code? (is encoded as a mask or as X, Y, Z position?)

Thanks,
Tran

Using your trained model

I would like to use your trained model over my dataset. Would it be possible to use your DL model as a pre-trained model and do a transfer learning?

Which model in ModelSet.py is the DCNet model

Hi, thanks for sharing this work. I cloned this repository and read the paper "Fully automated and standardized segmentation of adipose tissue compartments via deep learning in 3D whole-body MRI of epidemiological cohort studies". Now I am wondering which of the models in ModelSet.py are used in the paper. Which one corresponds to the proposed DCNet and which one corresponds to the reference UNet?

Possible example?

Would it be possible to publish an example case such that we could see how to run this pipeline practically? For example just a folder containing a 3D data set, where when you run the pipeline the segmentation maps are produced? Would help a lot with user adoption.

sort slice location have problem with my dataset

Hi Thomas,
I don't know why sorted function doesn't work for my dataset as it starts from negative

sorted(dicom_paths, key=lambda dicom_path: pydicom.dcmread(dicom_path).SliceLocation)

So I try by use numpy argsort as below.

    slicelocation = np.zeros(len(dicom_paths))
    # sort as slice location
    for f, i in zip(dicom_paths, range(len(dicom_paths))):
        ds = pydicom.read_file(f)
        if('slicelocation' in ds):	slicelocation[i] = ds.SliceLocation
        else:	slicelocation[i] = ds.ImagePositionPatient[2]
    order = np.argsort(slicelocation)
    dicom_paths= np.array(dicom_paths)[order]

Pretrained model available?

Hello,
is there a pretrained model available? Most people do not have annotated datasets which they could use for training. They just want to generate tissue segmentations on their data. For this purpose a pretrained model which is ready to use would be great.

Error when trying to run example

Hello, when I try to run this line: python3 main.py --preprocess -c config/config_default.yml I get the error

sage: MedSeg [-h] [-e EXP_NAME] [--preprocess PREPROCESS] [--train TRAIN] [--evaluate EVALUATE] [--predict PREDICT] [--restore RESTORE] [-c CONFIG_PATH] [--gpu GPU]
[--gpu_memory GPU_MEMORY] [--calculate_max_shape_only CALCULATE_MAX_SHAPE_ONLY] [--split_only SPLIT_ONLY] [--train_epoch TRAIN_EPOCH] [--filters FILTERS]
[--model_name MODEL_NAME] [--train_batch TRAIN_BATCH] [--dataset DATASET]
MedSeg: error: argument --preprocess: expected one argument

Any idea what is going on?

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.