项目作者: mattools

项目描述 :
Generic class for representation of 2D/3D...5D images with Matlab
高级语言: MATLAB
项目地址: git://github.com/mattools/matlab-image-class.git
创建时间: 2015-07-30T08:21:27Z
项目社区:https://github.com/mattools/matlab-image-class

开源协议:BSD 2-Clause "Simplified" License

下载


matlab-image-class

Generic class for representation of 2D/3D…5D images with Matlab.

Description

This package consists in the Image class, that encapsulates a (possibly multidimensional)
data array together with various meta-data used to interpret the data (spatial calibration,
look-up table, grayscale extent…).

The Image class can manage up to five dimensions, corresponding to the X, Y, Z, Channels, and Time.
Images are asociated to a type that indicates how the content should be interpreted: “color”, “intensity”, “binary”, “label”…

Nearly 200 methods are provided for quickly applying image processing operators on image instances,
by keeping relevant meta-data such as spatial calibration, and automatically inferring the type of the
result images. A User Manual is available in pdf format.

The Image class is at the basis of the development of the ImageM application (http://github.com/mattools/ImageM). The MatStats package (https://github.com/mattools/matStats) may be necessary for some functions.

Example 1

The following example performs a segmentation on a grayscale image. It uses computation of gradient, filtering, morphological processing, and management of label images.

  1. % read a grayscale image
  2. img = Image.read('coins.png');
  3. % compute gradient as a vector image.
  4. grad = gradient(img);
  5. % Compute the norm of the gradient, and smooth
  6. gradf = boxFilter(norm(grad), [5 5]);
  7. figure; show(gradf, []);
  8. % compute watershed after imposition of extended minima
  9. emin = extendedMinima(gradf, 20, 4);
  10. grad2 = imposeMinima(gradf, emin, 4);
  11. lbl = watershed(grad2, 4);
  12. % display binary overlay over grayscale image
  13. show(overlay(img, lbl==0, 'g'));
  14. % cleanup segmentation and convert to RGB image
  15. lbl2 = killBorders(lbl);
  16. show(label2rgb(lbl2, 'jet', 'w'));

segmentation pipeline of a grayscale image using watershed

Example 2

The following example presents various ways to explore and display the content of a 3D image.

  1. % read data, adjust contrast, and specify spatial calibration
  2. img = adjustDynamic(Image.read('brainMRI.hdr'));
  3. img.Spacing = [1 1 2.5];
  4. % show as three orthogonal planes
  5. figure; showOrthoPlanes(img, [60 80 13]); axis equal;
  6. % show as three orthogonal slices in 3D
  7. figure; showOrthoSlices(img, [60 80 13]); axis equal; view(3);
  8. axis(physicalExtent(img));
  9. % display as isosurface
  10. figure; isosurface(gaussianFilter(img, [5 5 5], 2), 50);
  11. axis equal; axis(physicalExtent(img)); view([145 25]); light;

Various representations of 3D image using Image class