MDSTk Logo

Medical Data Segmentation Toolkit

FIT Logo
Medical Data Segmentation Toolkit is a collection of 2D/3D image processing tools originaly aimed at medical image segmentation. It contains number of routines for volumetric data processing (3D filtering, edge detection, segmentation, etc.) as well as fast low-level vector graphics library for surface and tetrahedral meshing. Base parts of the MDSTk (image processing and system libraries, modules, etc.) are public, distributed on its web site. We will be pleased if somebody find out that this toolkit could be useful.

The current version is 1.1.1.

MDSTk is distributed under a public license which permits modification and distribution of the toolkit. For more information, see the full text of the license.

  • Multiplatform toolkit running on Linux and Windows platform, supported compilers are
    1. GCC 3.2+ compiler on linux systems,
    2. MinGW compiler (windows port of GCC compiler),
    3. MS Visual C++ 7.1+ compiler on windows systems.
  • Uses the excellent CMake (Cross-platform Make) build system.
  • Simple modular architecture.
  • 2D/3D image processing library including
    • number of convolution filters,
    • edge detectors (e.g. 3D canny edge detector),
    • FFT,
    • segmentation algorithms (thresholding, RG, FCM, Watersheds, etc.),
    • texture analysis (LBP features).
  • Experimental support for the OpenCV library. You can can take advantage of both libraries.
  • Math library based on the Eigen + UMFPACK libraries providing static/dynamic vectors and matrices, sparse matrices, etc. including linear algebra routines (e.g. eigenvalues and eigenvectors problem).
  • Some advanced algorithms implemented:
    • Fuzzy c-Means clustering,
    • optimization of GMMs (Gaussian Mixture Models) using Expectation-Maximization algorithm (EM algorithm).
  • Several image/slice formats supported: DICOM, JPEG and PNG.
  • Low-level vector graphics library for effective handling of polygonal surface models and tetrahedra meshes.
  • Benefit from templated C++ code, e.g. speed and scalability.
  • Interesting programming techniques used, such as smart pointers, reference counting, singletons, serialization, iterators and so on.
  • Inter-module communication over channels implemented via files, named/unnamed pipes, shared memory (and network in future).
  • Multiplatform system library encapsulating threads, mutexes, critical sections, timers and etc.
  • Source code documentation generated using Doxygen.
  • Public BSD-like license, all source codes available.

Brief guide
MDSTk toolkit was designed to be highly modular. It consists of a number of separate modules providing fundamental functions and algorithms. Individul modules may be connected using simple channels into more complex units. Actually, there are channels implemented over files, named pipes, stdio and shared memory. Hence, modules are typicaly chained using shell unnamed pipes and the | character.

Running module from command line:

-i Specification of a module input channel. Channel is described with a string of the form
Allowed medium types are stdio, file, pipe and shm. First one has no attributes, file and pipe have only one attribute - the filename. Communication over shared memory is not elementary (see documentation).
-o Output channel specification same as above.
-log Option selects a module log type. Allowed values are null for no logging, stderr for logging to the stderr, file means logging to a file and both sets logging to the both stderr and file.
-h Shows more detailed help.


  1. mdsLoadJPEG < temp/berounka.jpg | mdsSliceInfo or
    mdsLoadJPEG -i file:temp/berounka.jpg | mdsSliceInfo
    - Reads input image and prints basic information about it.

  2. mdsLoadJPEG < temp/berounka.jpg >berounka.slc
    - Reads input image and saves it in the MDSTk format.

  3. mdsLoadDicom < data/dicom/80.dcm | mdsSliceRange -auto | mdsSliceView
    - Loads image data in DICOM format, changes pixel value range from 12-bit (density medical data) to the 0..255 (8-bit grayscale image) and shows it.

  4. mdsLoadDicom < data/dicom/80.dcm | mdsSliceFilter -filter gaussian -sigma 1.0 | mdsSliceRange -auto | mdsSliceView
    - Gaussian smoothing of the input image.

Source code description
All source codes of MDSTk libraries and modules can be found in the 'src' directory. Because of templated design, huge code part can be found in header files which resides in the 'include' directory.

Libraries description:

libBase Base classes, templates and functions (singletons, small objects, type traits, logging, ...).
libMath Static/dynamic vectors, matrices, random numbers, etc.
libImage Image and volume data processing functions.
libImageIO Loading and saving of image data from/to various formats.
libSystem Multiplatform library encapsulating threads, mutexes, critical sections, timers and etc.
libModule I/O channels, object serialization, ...
libVectorEntity Vector graphics library (polygonal surfaces, tetrahedral meshes and so on).

Base modules:

mdsCreateSHM Creates and handles a block of shared memory.
mdsLoadDicom Reads an image in the DICOM format from the input channel and converts it to the MDSTk native format. Typical output is a density 12-bit grayscale image, called slice in medical imaging.
mdsLoadJPEG Reads and converts any JPEG image.
mdsLoadPNG Reads and converts any PNG image.
mdsMakeVolume Module makes density volume data (3D image) from several input slices.
mdsRGBImage2Slice Converts input RGB image to slice.
mdsRGBImageView Shows input RGB image in OpenGL window.
mdsSaveJPEG Converts input slice to the JPEG image format.
mdsSavePNG Converts input slice to the PNG image format.
mdsSliceAffineTransform Affine geometric image transform.
mdsSliceBlending Merges two images/slices.
mdsSliceCornerDetector Provides basic image corner detection methods (Harris and Susan).
mdsSliceCut Keeps values of a specified interval of pixels unchanged, remaining ones are set to zero.
mdsSliceEdgeDetector Advanced edge detection algorithms (e.g. Canny edge detector).
mdsSliceFFT This sample module computes two-dimensional DFT of an input slice.
mdsSliceFilter Provides several image filtering functions such as Median, Sobel and Prewit operators, Gaussian smoothing and many others.
mdsSliceHistEqualization Histogram equalization.
mdsSliceHistogram Shows histogram of input slice.
mdsSliceInfo Shows information about input slice.
mdsLBPCompare Compares LBP histograms of two images.
mdsLBPExtract Extracts LBP codes from an image.
mdsLBPHistogram Estimates normalized LBP histogram of an image.
mdsSliceOpticalFlow Estimates optical flow between two images using the Lucas-Kanade method.
mdsSliceRange Extends a given pixel value interval to specified range (linear interpolation).
mdsSliceSubsampling Module demonstrates use of the Gaussian pyramid for image subsampling.
mdsSliceSeg Sample slice segmentation module.
mdsSliceSegHT Slice segmentation based on histogram thresholding.
mdsSliceSegRG Simple region growing segmentation algorithm.
mdsSliceSegEM Pixel-based segmentation using GMMs (Gaussian Mixture Models and well known Expectation-Maximization algorithm.
mdsSliceSegFCM Another pixel-based segmentation algorithm. It uses the fuzzy C-means clustering algorithm.
mdsSliceSegWatersheds Watersheds-based image segmentation.
mdsSliceTresholding Simple pixel value tresholding.
mdsSliceView Visualizes input slice using GLUT and OpenGL.
mdsVolumeBlending Merges two volumes.
mdsVolumeCut Leaves a specified interval of voxel values unchanged and sets remaining ones are set to zero.
mdsVolumeFilter Several volume filtering functions (Median, Sobel operator, etc.)
mdsVolumeEdgeDetector 3D Canny edge detection algorithm.
mdsVolumeHistEqualization Volume data histogram equalization.
mdsVolumeHistogram Shows volume data histogram.
mdsVolumeInfo Prints information about input volume.
mdsVolumeLandmarkDetector Experimental algorithms for detection of landmark points in volume data.
mdsVolumeRange Extends a given voxel value interval to specified range.
mdsVolumeSeg Sample volume segmentation module.
mdsVolumeSegEM Voxel-based segmentation using GMMs (Gaussian Mixture Models and well known Expectation-Maximization algorithm.
mdsVolumeSegFCM Another voxel-based segmentation algorithm. It uses the fuzzy C-means clustering algorithm.
mdsVolumeSegHT Volume segmentation based on histogram thresholding.
mdsVolumeSegRG Region growing segmentation of volume data. Very slow implementation! Should be remade in future.
mdsVolumeSlit Splits input volume into several slices.
mdsVolumeTresholding Simple voxel value tresholding.
mdsVolumeView Reads input volume and visualizes it using GLUT and OpenGL.

Source code documentation
MDSTk uses Doxygen as a documentation system. Doxygen makes it easy for a programmer to provide up-to-date source code documentation because it is a part of the source code. This documentation can be a great help for you if you want to find or add some toolkit feature. Automatically generated documentation is placed in the 'doc/doxygen' directory.

How can you build the documentation? First, install the Doxygen system ( and optionaly the Graphviz package ( for drawing graphs such as the class diagram.

If you use Makefiles and 'make' command to compile the toolkit just type

> make doc

Even easier it is under MS Visual Studio. Open the generated solution choose project 'ALL_DOC' and compile it. This will make Doxygen documentation for you. You will find it in your build directory.

Last Change: 2010/11/07