Skip to content

Commit 21e604d

Browse files
authored
add examples in readme.md
1 parent b801eec commit 21e604d

File tree

1 file changed

+48
-5
lines changed

1 file changed

+48
-5
lines changed

README.md

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,53 @@
11
# 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.
33

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)
56
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...).
78

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"...
911

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

Comments
 (0)