|
1 | 1 | # matlab-image-class |
2 | | -Generic class for representation of 2D/3D...5D images with Matlab |
| 2 | +Generic class for representation of 2D/3D...5D images with Matlab. |
3 | 3 |
|
4 | | -This package consists in the `Image` class, that contains a (possibly multidimensional) |
| 4 | +## Description |
| 5 | +This package consists in the `Image` class, that encapsulates a (possibly multidimensional) |
5 | 6 | data array together with various meta-data used to interpret the data (spatial calibration, |
6 | | -look-up table, grayscale extent...). |
| 7 | +look-up table, grayscale extent...). |
7 | 8 |
|
8 | | -Many methods are provided for quickly apply image processing operators on image instances. |
| 9 | +The Image class can manage up to five dimensions, corresponding to the X, Y, Z, Channels, and Time. |
| 10 | +Images are asociated to a type that indicates how the content should be interpreted: "color", "intensity", "binary", "label"... |
9 | 11 |
|
10 | | -The `Image` class is at the basis of the development of the `ImageM` application (http://github.com/mattools/ImageM) |
| 12 | +Nearly 200 methods are provided for quickly applying image processing operators on image instances, |
| 13 | +by keeping relevant meta-data such as spatial calibration, and automatically inferring the type of the |
| 14 | +result images. |
| 15 | + |
| 16 | +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. |
| 17 | + |
| 18 | +## Example 1 |
| 19 | + |
| 20 | +The following example performs a segmentation on a grayscale image. It uses computation of gradient, filtering, morphological processing, and management of label images. |
| 21 | + |
| 22 | + % read a grayscale image |
| 23 | + img = Image.read('coins.png'); |
| 24 | + % compute gradient as a vector image. |
| 25 | + grad = gradient(img); |
| 26 | + % Compute the norm of the gradient, and smooth |
| 27 | + gradf = boxFilter(norm(grad), [5 5]); |
| 28 | + figure; show(gradf, []); |
| 29 | + % compute watershed after imposition of extended minima |
| 30 | + emin = extendedMinima(gradf, 20, 4); |
| 31 | + grad2 = imposeMinima(gradf, emin, 4); |
| 32 | + lbl = watershed(grad2, 4); |
| 33 | + % display binary overlay over grayscale image |
| 34 | + show(overlay(img, lbl==0, 'g')); |
| 35 | + % cleanup segmentation and convert to RGB image |
| 36 | + lbl2 = killBorders(lbl); |
| 37 | + show(label2rgb(lbl2, 'jet', 'w')); |
| 38 | + |
| 39 | +## Example 2 |
| 40 | + |
| 41 | +The following example presents various ways to explore and display the content of a 3D image. |
| 42 | + |
| 43 | + % read data, adjust contrast, and specify spatial calibration |
| 44 | + img = adjustDynamic(Image.read('brainMRI.hdr')); |
| 45 | + img.Spacing = [1 1 2.5]; |
| 46 | + % show as three orthogonal planes |
| 47 | + figure; showOrthoPlanes(img, [60 80 13]); axis equal; |
| 48 | + % show as three orthogonal slices in 3D |
| 49 | + figure; showOrthoSlices(img, [60 80 13]); axis equal; view(3); |
| 50 | + axis(physicalExtent(img)); |
| 51 | + % display as isosurface |
| 52 | + figure; isosurface(gaussianFilter(img, [5 5 5], 2), 50); |
| 53 | + axis equal; axis(physicalExtent(img)); view([145 25]); light; |
0 commit comments