Skip to content
muellerdo edited this page Oct 13, 2019 · 6 revisions

Core steps of the MIScnn pipeline

The MIScnn pipeline is represented by 4 core classes:

  • Data I/O
  • Data Augmentation (optional)
  • Preprocessor
  • Neural Network Model

These classes handle all required steps for medical image segmentation and can be extensively customized. All classes, except the Data Augmentation class, use switchable interfaces which results into high configurability and offers simple integration of user-defined solutions.

usage_visualization

Workflow of MIScnn

1) Data I/O

The first step in the MIScnn pipeline is to establish the Data I/O class. The Data I/O handles the complete data loading of biomedical images, its segmentation and storage of predicted files, as well as temporary files like batches.

In order to open the MIScnn pipeline for a various data formats and structures, the data I/O class uses switchable I/O interfaces. It is possible to use already provided I/O interfaces with a fixed data structure or custom I/O interfaces for integration of your specific data structure into the MIScnn pipeline.

Before initializing an instance of the Data I/O class, we have to select an I/O interface. This interface have to load our data set into the MIScnn pipeline. In our example, we are using the KiTS19 data set which are kidney tumor CT scans encoded in the NIfTI format. Therefore, we call the provided NIfTI interface with a single channel (grayscale image) and 3 classes for the segmentation (background, kidney and tumor).

from miscnn.data_loading.interfaces.nifti_io import NIFTI_interface

interface = NIFTI_interface(pattern="case_000[0-9]*", channels=1,
                            classes=3)

Afterwards, we can initialize the Data I/O class by passing our newly created interface and the path to the data set to the constructor.

from miscnn.data_loading.data_io import Data_IO

data_path = "/home/mudomini/projects/kits19/data/"
data_io = Data_IO(interface, data_path)

2) Preprocessor

###########################################

TODO

###########################################

Finally, we can initialize the Preprocessor class.

Therefore, we are passing our Data I/O Interface, the Data Augmentation object and our list of Subfunctions. Additionally, we configure our Preprocessor to create batches on-the-fly (preprare_batches=False) by random cropping patches with size 80x160x160 out of the image. Also a batch should contain 2 patches.

After the initialization, we adjust the overlap between patches for prediction to increase prediction accuracy.

Create a Preprocessor instance to configure how to preprocess the data into batches

from miscnn.processing.preprocessor import Preprocessor

pp = Preprocessor(data_io, batch_size=4, analysis="patchwise-crop",
                  patch_shape=(128,128,128))

asd

pp = Preprocessor(data_io, batch_size=32, analysis="full-image")
Data Augmentation

After the Data I/O Interface initialization, the Data Augmentation class can be configured. A Preprocessor object with default parameters automatically initialize a Data Augmentation class with default values, but here we initialize it by hand to illustrate the exact workflow of the MIScnn pipeline.

The parameters for the Data Augmentation configure which augmentation techniques should be applied to the data set. In this case, we are using all possible augmentation techniques in order to run extensive data augmentation and avoid overfitting

pp = Preprocessor(data_io, batch_size=32, analysis="full-image")

3) Neural Network Model

asd

# Create a deep learning neural network model with a standard U-Net architecture
from miscnn.neural_network.model import Neural_Network
from miscnn.neural_network.architecture.unet.standard import Architecture
unet_standard = Architecture()
model = Neural_Network(preprocessor=pp, architecture=unet_standard)

Congratulations to your ready-to-use Medical Image Segmentation pipeline including data I/O, preprocessing and data augmentation with default setting.

Let's run a model training on our data set. Afterwards, predict the segmentation of a sample using the fitted model.

# Training the model with all except one sample for 500 epochs
sample_list = data_io.get_indiceslist()
model.train(sample_list[0:-1], epochs=500)

# Predict the one remaining sample
pred = model.predict([sample_list[-1]], direct_output=True)

For more detailed coding examples, check out the MIScnn wiki for tutorials or examples.

Clone this wiki locally