Commit 3e3f30a2b0ad3d206594914b0b29ba4ffe370aad
1 parent
3c2d1625
added a matlab function to load a grayscale image stack
Showing
1 changed file
with
21 additions
and
0 deletions
Show diff stats
1 | +function S = stimImageStack(filemask) | ||
2 | + files = dir(filemask); | ||
3 | + | ||
4 | + %figure out the file size | ||
5 | + I = imread([files(1).folder '/' files(1).name]); | ||
6 | + X = size(I, 1); | ||
7 | + Y = size(I, 2); | ||
8 | + Z = length(files); | ||
9 | + | ||
10 | + S = zeros(X, Y, Z, 'uint8'); | ||
11 | + | ||
12 | + h = waitbar(0, ['Loading ' num2str(Z) ' images...']); | ||
13 | + for i = 1:Z | ||
14 | + I = rgb2gray(imread([files(1).folder '/' files(1).name])); | ||
15 | + S(:, :, i) = I; | ||
16 | + waitbar(i/Z, h); | ||
17 | + end | ||
18 | + close(h); | ||
19 | +end | ||
20 | + | ||
21 | + |