Skip to content
Snippets Groups Projects
Commit 09ac2e1a authored by Masneri Stefano's avatar Masneri Stefano
Browse files

Add progress bar for CZIReader

parent 0fabdd50
Branches
Tags
No related merge requests found
......@@ -63,7 +63,7 @@ for s = stacks
idxT = 1;
for t = timeseries
% update progress bar
currNum = t + (idxCh-1)*nT + (idxS-1)*nCh*nT;
currNum = idxT + (idxCh-1)*nT + (idxS-1)*nCh*nT;
progBar.update(currNum/maxNum * 100);
%set index
......
......@@ -87,7 +87,7 @@ for s = stacks
for row = tileRow
for col = tileCol
% update progress bar
currNum = t + (idxCh-1)*nT + (idxS-1)*nCh*nT + ...
currNum = idxT + (idxCh-1)*nT + (idxS-1)*nCh*nT + ...
(col-1)*nS*nCh*nT + (row-1)*nC*nS*nCh*nT;
progBar.update(currNum/maxNum * 100);
%set series
......
......@@ -5,6 +5,9 @@ function [ data ] = getAllData( obj )
% AUTHOR: Stefano Masneri
% Date: 13.10.2016
progBar = TextProgressBar('BioReader --> Extracting data: ', 30);
numDirEntries = length(obj.directoryEntries);
if obj.wrongMetadata
%initialize data
data = zeros(obj.height, obj.width, obj.channels, obj.stacks, obj.time, ...
......@@ -12,7 +15,9 @@ if obj.wrongMetadata
%now browse through directory entries again, and extract the subblocks
% Now go through all the directory entries
for k = 1:length(obj.directoryEntries)
for k = 1:numDirEntries
progBar.update(k/numDirEntries * 100);
dirEntry = obj.directoryEntries(k);
% Get image
tmpImg = obj.readRawSubblockSegm('dirEntry', dirEntry);
......@@ -36,7 +41,9 @@ else
obj.series, obj.datatype);
% Now go through all the directory entries
for k = 1:length(obj.directoryEntries)
for k = 1:numDirEntries
progBar.update(k/numDirEntries * 100);
dirEntry = obj.directoryEntries(k);
% Get image
tmpImg = obj.readRawSubblockSegm('dirEntry', dirEntry);
......
......@@ -47,6 +47,15 @@ series = p.Results.S;
data = zeros(length(rows), length(cols), length(channels), length(stacks), ...
length(timeseries), length(series), obj.datatype);
% get numelements in each dimension
nS = numel(stacks);
nCh = numel(channels);
nT = numel(timeseries);
maxNum = nS * nCh * nT;
% define progress bar
progBar = TextProgressBar('BioReader --> Extracting data: ', 30);
idxZ = 1;
for z = stacks
idxCh = 1;
......@@ -55,6 +64,10 @@ for z = stacks
for t = timeseries
idxS = 1;
for s = series
% update progress bar
currNum = idxS + (idxT-1)*nS + (idxCh-1)*nT*nS;
progBar.update(currNum/maxNum * 100);
%get directory entry
dirEntry = obj.directoryEntries(obj.dirEntryIndices{ch, z, t, s});
tmpImg = obj.readRawSubblockSegm('dirEntry', dirEntry);
......
......@@ -68,6 +68,16 @@ sizeCols = round(length(cols) * (1 + (length(tileCols) - 1) * (1 - obj.tileOverl
data = zeros(sizeRows, sizeCols, length(channels), length(stacks), ...
length(timeseries), length(series), obj.datatype);
% get numelements in each dimension
nZ = numel(stacks);
nC = numel(channels);
nT = numel(timeseries);
nS = numel(series);
maxNum = nZ * nC * nT * nS;
% define progress bar
progBar = TextProgressBar('BioReader --> Extracting data: ', 30);
%get index of start of each new tile
pixelStartTileRow = 1 + round((0:length(tileRows)-1) * (1 - obj.tileOverlap) * length(rows));
pixelStartTileCol = 1 + round((0:length(tileCols)-1) * (1 - obj.tileOverlap) * length(cols));
......@@ -82,6 +92,11 @@ for z = stacks
for t = timeseries
idxS = 1;
for s = series
% update progress bar
currNum = idxS + (idxT-1)*nS + (idxCh-1)*nS*nT + ...
(idxZ-1)*nS*nC*nT;
progBar.update(currNum/maxNum * 100);
%get directory entry
dirEntries = obj.directoryEntries(obj.dirEntryIndices{ch, z, t, s});
for k = 1:length(dirEntries)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment