Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
leverUtilities
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenSource
leverUtilities
Commits
ab088a0f
Commit
ab088a0f
authored
Sep 8, 2017
by
Eric Wait
Browse files
Options
Downloads
Patches
Plain Diff
Added explicit thread count to klb reader / writer
parent
f8f9d2bd
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/MATLAB/+MicroscopeData/ReaderKLB.m
+9
-6
9 additions, 6 deletions
src/MATLAB/+MicroscopeData/ReaderKLB.m
src/MATLAB/+MicroscopeData/WriterKLB.m
+11
-8
11 additions, 8 deletions
src/MATLAB/+MicroscopeData/WriterKLB.m
with
20 additions
and
14 deletions
src/MATLAB/+MicroscopeData/ReaderKLB.m
+
9
−
6
View file @
ab088a0f
...
@@ -70,8 +70,8 @@ function [im, imD] = ReaderKLB(varargin)
...
@@ -70,8 +70,8 @@ function [im, imD] = ReaderKLB(varargin)
try
try
inType
=
class
(
MicroscopeData
.
KLB
.
readKLBroi
(
fullfile
(
imPath
,
klbList
(
1
)
.
name
),
ones
(
2
,
5
)));
inType
=
class
(
MicroscopeData
.
KLB
.
readKLBroi
(
fullfile
(
imPath
,
klbList
(
1
)
.
name
),
ones
(
2
,
5
)));
catch
catch
err
warning
(
'
No images with at this data field!'
);
warning
(
err
.
identifier
,
'%s\n
No images with at this data field!'
,
err
.
message
);
return
return
end
end
...
@@ -173,6 +173,9 @@ end
...
@@ -173,6 +173,9 @@ end
function
im
=
readKLBChunk
(
imD
,
outType
,
roi_xyz
,
filePerC
,
filePerT
,
prgs
)
function
im
=
readKLBChunk
(
imD
,
outType
,
roi_xyz
,
filePerC
,
filePerT
,
prgs
)
im
=
zeros
(
Utils
.
SwapXY_RC
(
roi_xyz
(
2
,:)
-
roi_xyz
(
1
,:))
+
1
,
outType
);
im
=
zeros
(
Utils
.
SwapXY_RC
(
roi_xyz
(
2
,:)
-
roi_xyz
(
1
,:))
+
1
,
outType
);
myCluster
=
parcluster
(
'local'
);
threads
=
myCluster
.
NumWorkers
;
if
(
filePerC
)
if
(
filePerC
)
if
(
filePerT
)
if
(
filePerT
)
% individual image per c and t
% individual image per c and t
...
@@ -180,7 +183,7 @@ function im = readKLBChunk(imD,outType,roi_xyz,filePerC,filePerT,prgs)
...
@@ -180,7 +183,7 @@ function im = readKLBChunk(imD,outType,roi_xyz,filePerC,filePerT,prgs)
for
t
=
roi_xyz
(
1
,
5
):
roi_xyz
(
2
,
5
)
for
t
=
roi_xyz
(
1
,
5
):
roi_xyz
(
2
,
5
)
for
c
=
roi_xyz
(
1
,
4
):
roi_xyz
(
2
,
4
)
for
c
=
roi_xyz
(
1
,
4
):
roi_xyz
(
2
,
4
)
fileName
=
sprintf
(
'%s_c%d_t%04d.klb'
,
imD
.
DatasetName
,
c
,
t
);
fileName
=
sprintf
(
'%s_c%d_t%04d.klb'
,
imD
.
DatasetName
,
c
,
t
);
im
(:,:,:,
c
,
t
)
=
MicroscopeData
.
KLB
.
readKLBroi
(
fullfile
(
imD
.
imageDir
,
fileName
),
Utils
.
SwapXY_RC
([[
roi_xyz
(
1
,
1
:
3
),
1
,
1
];
[
roi_xyz
(
2
,
1
:
3
),
1
,
1
]]));
im
(:,:,:,
c
,
t
)
=
MicroscopeData
.
KLB
.
readKLBroi
(
fullfile
(
imD
.
imageDir
,
fileName
),
Utils
.
SwapXY_RC
([[
roi_xyz
(
1
,
1
:
3
),
1
,
1
];
[
roi_xyz
(
2
,
1
:
3
),
1
,
1
]])
,
threads
);
i
=
i
+
1
;
i
=
i
+
1
;
if
(
~
isempty
(
prgs
))
if
(
~
isempty
(
prgs
))
prgs
.
PrintProgress
(
i
);
prgs
.
PrintProgress
(
i
);
...
@@ -192,7 +195,7 @@ function im = readKLBChunk(imD,outType,roi_xyz,filePerC,filePerT,prgs)
...
@@ -192,7 +195,7 @@ function im = readKLBChunk(imD,outType,roi_xyz,filePerC,filePerT,prgs)
i
=
0
;
i
=
0
;
for
c
=
roi_xyz
(
1
,
4
):
roi_xyz
(
2
,
4
)
for
c
=
roi_xyz
(
1
,
4
):
roi_xyz
(
2
,
4
)
fileName
=
sprintf
(
'%s_c%d.klb'
,
imD
.
DatasetName
,
c
);
fileName
=
sprintf
(
'%s_c%d.klb'
,
imD
.
DatasetName
,
c
);
im
(:,:,:,
c
,:)
=
MicroscopeData
.
KLB
.
readKLBroi
(
fullfile
(
imD
.
imageDir
,
fileName
),
Utils
.
SwapXY_RC
([[
roi_xyz
(
1
,
1
:
3
),
1
,
roi_xyz
(
1
,
5
)];
[
roi_xyz
(
2
,
1
:
3
),
1
,
roi_xyz
(
2
,
5
)]]));
im
(:,:,:,
c
,:)
=
MicroscopeData
.
KLB
.
readKLBroi
(
fullfile
(
imD
.
imageDir
,
fileName
),
Utils
.
SwapXY_RC
([[
roi_xyz
(
1
,
1
:
3
),
1
,
roi_xyz
(
1
,
5
)];
[
roi_xyz
(
2
,
1
:
3
),
1
,
roi_xyz
(
2
,
5
)]])
,
threads
);
i
=
i
+
1
;
i
=
i
+
1
;
if
(
~
isempty
(
prgs
))
if
(
~
isempty
(
prgs
))
prgs
.
PrintProgress
(
i
*
imD
.
NumberOfFrames
);
prgs
.
PrintProgress
(
i
*
imD
.
NumberOfFrames
);
...
@@ -204,7 +207,7 @@ function im = readKLBChunk(imD,outType,roi_xyz,filePerC,filePerT,prgs)
...
@@ -204,7 +207,7 @@ function im = readKLBChunk(imD,outType,roi_xyz,filePerC,filePerT,prgs)
i
=
0
;
i
=
0
;
for
t
=
roi_xyz
(
1
,
5
):
roi_xyz
(
2
,
5
)
for
t
=
roi_xyz
(
1
,
5
):
roi_xyz
(
2
,
5
)
fileName
=
sprintf
(
'%s_t%04d.klb'
,
imD
.
DatasetName
,
t
);
fileName
=
sprintf
(
'%s_t%04d.klb'
,
imD
.
DatasetName
,
t
);
im
(:,:,:,:,
t
)
=
MicroscopeData
.
KLB
.
readKLBroi
(
fullfile
(
imD
.
imageDir
,
fileName
),
Utils
.
SwapXY_RC
([[
roi_xyz
(
1
,
1
:
4
),
1
];
[
roi_xyz
(
2
,
1
:
4
),
1
]]));
im
(:,:,:,:,
t
)
=
MicroscopeData
.
KLB
.
readKLBroi
(
fullfile
(
imD
.
imageDir
,
fileName
),
Utils
.
SwapXY_RC
([[
roi_xyz
(
1
,
1
:
4
),
1
];
[
roi_xyz
(
2
,
1
:
4
),
1
]])
,
threads
);
i
=
i
+
1
;
i
=
i
+
1
;
if
(
~
isempty
(
prgs
))
if
(
~
isempty
(
prgs
))
prgs
.
PrintProgress
(
i
*
imD
.
NumberOfChannels
);
prgs
.
PrintProgress
(
i
*
imD
.
NumberOfChannels
);
...
@@ -212,6 +215,6 @@ function im = readKLBChunk(imD,outType,roi_xyz,filePerC,filePerT,prgs)
...
@@ -212,6 +215,6 @@ function im = readKLBChunk(imD,outType,roi_xyz,filePerC,filePerT,prgs)
end
end
else
else
% only one file
% only one file
im
=
MicroscopeData
.
KLB
.
readKLBroi
(
fullfile
(
imD
.
imageDir
,[
imD
.
DatasetName
'.klb'
]),
Utils
.
SwapXY_RC
(
roi_xyz
));
im
=
MicroscopeData
.
KLB
.
readKLBroi
(
fullfile
(
imD
.
imageDir
,[
imD
.
DatasetName
'.klb'
]),
Utils
.
SwapXY_RC
(
roi_xyz
)
,
threads
);
end
end
end
end
This diff is collapsed.
Click to expand it.
src/MATLAB/+MicroscopeData/WriterKLB.m
+
11
−
8
View file @
ab088a0f
...
@@ -133,32 +133,35 @@ function WriterKLB(im, varargin)
...
@@ -133,32 +133,35 @@ function WriterKLB(im, varargin)
blockMem
=
prod
(
blockSize_xyzct
)
*
bytes
;
blockMem
=
prod
(
blockSize_xyzct
)
*
bytes
;
blockSize_xyzct
(
5
)
=
max
(
1
,
floor
((
1024
^
2
)/
blockMem
));
% try to get close to 1MB block size
blockSize_xyzct
(
5
)
=
max
(
1
,
floor
((
1024
^
2
)/
blockMem
));
% try to get close to 1MB block size
myCluster
=
parcluster
(
'local'
);
threads
=
myCluster
.
NumWorkers
;
fileName
=
fullfile
(
outDir
,
args
.
imageData
.
DatasetName
);
fileName
=
fullfile
(
outDir
,
args
.
imageData
.
DatasetName
);
prgs
=
Utils
.
CmdlnProgress
(
args
.
imageData
.
NumberOfChannels
*
args
.
imageData
.
NumberOfFrames
,
true
);
prgs
=
Utils
.
CmdlnProgress
(
args
.
imageData
.
NumberOfChannels
*
args
.
imageData
.
NumberOfFrames
,
true
);
if
(
args
.
filePerT
)
if
(
args
.
filePerT
)
if
(
args
.
filePerC
)
if
(
args
.
filePerC
)
for
t
=
1
:
args
.
imageData
.
NumberOfFrames
for
t
=
1
:
args
.
imageData
.
NumberOfFrames
for
c
=
1
:
args
.
imageData
.
NumberOfChannels
for
c
=
1
:
args
.
chanList
fileNameCT
=
sprintf
(
'%s_c%d_t%04d'
,
fileName
,
c
,
t
);
fileNameCT
=
sprintf
(
'%s_c%d_t%04d'
,
fileName
,
args
.
chanList
(
c
)
,
t
);
MicroscopeData
.
KLB
.
writeKLBstack
(
im
(:,:,:,
c
,
t
),
[
fileNameCT
,
'.klb'
],
-
1
,
[
args
.
imageData
.
PixelPhysicalSize
,
1
,
1
],
blockSize_xyzct
);
MicroscopeData
.
KLB
.
writeKLBstack
(
im
(:,:,:,
c
,
t
),
[
fileNameCT
,
'.klb'
],
threads
,
[
args
.
imageData
.
PixelPhysicalSize
,
1
,
1
],
blockSize_xyzct
);
prgs
.
PrintProgress
(
c
+
(
t
-
1
)
*
args
.
imageData
.
NumberOfChannels
);
prgs
.
PrintProgress
(
c
+
(
t
-
1
)
*
args
.
imageData
.
NumberOfChannels
);
end
end
end
end
else
else
for
t
=
1
:
args
.
imageData
.
NumberOfFrames
for
t
=
1
:
args
.
imageData
.
NumberOfFrames
fileNameT
=
sprintf
(
'%s_t%04d'
,
fileName
,
t
);
fileNameT
=
sprintf
(
'%s_t%04d'
,
fileName
,
t
);
MicroscopeData
.
KLB
.
writeKLBstack
(
im
(:,:,:,:,
t
),
[
fileNameT
,
'.klb'
],
-
1
,
[
args
.
imageData
.
PixelPhysicalSize
,
1
,
1
],
blockSize_xyzct
);
MicroscopeData
.
KLB
.
writeKLBstack
(
im
(:,:,:,:,
t
),
[
fileNameT
,
'.klb'
],
threads
,
[
args
.
imageData
.
PixelPhysicalSize
,
1
,
1
],
blockSize_xyzct
);
prgs
.
PrintProgress
(
t
*
args
.
imageData
.
NumberOfChannels
);
prgs
.
PrintProgress
(
t
*
args
.
imageData
.
NumberOfChannels
);
end
end
end
end
elseif
(
args
.
filePerC
)
elseif
(
args
.
filePerC
)
for
c
=
1
:
args
.
imageData
.
NumberOfChannels
for
c
=
1
:
length
(
args
.
chanList
)
fileNameC
=
sprintf
(
'%s_c%d'
,
fileName
,
c
);
fileNameC
=
sprintf
(
'%s_c%d'
,
fileName
,
args
.
chanList
(
c
)
);
MicroscopeData
.
KLB
.
writeKLBstack
(
squeeze
(
im
(:,:,:,
c
,:)),
[
fileNameC
,
'.klb'
],
-
1
,
[
args
.
imageData
.
PixelPhysicalSize
,
1
,
1
],
blockSize_xyzct
);
MicroscopeData
.
KLB
.
writeKLBstack
(
squeeze
(
im
(:,:,:,
c
,:)),
[
fileNameC
,
'.klb'
],
threads
,
[
args
.
imageData
.
PixelPhysicalSize
,
1
,
1
],
blockSize_xyzct
);
prgs
.
PrintProgress
(
c
*
args
.
imageData
.
NumberOfFrames
);
prgs
.
PrintProgress
(
c
*
args
.
imageData
.
NumberOfFrames
);
end
end
else
else
MicroscopeData
.
KLB
.
writeKLBstack
(
im
,
[
fileName
,
'.klb'
],
-
1
,
[
args
.
imageData
.
PixelPhysicalSize
,
1
,
1
],
blockSize_xyzct
);
MicroscopeData
.
KLB
.
writeKLBstack
(
im
,
[
fileName
,
'.klb'
],
threads
,
[
args
.
imageData
.
PixelPhysicalSize
,
1
,
1
],
blockSize_xyzct
);
end
end
if
(
args
.
verbose
)
if
(
args
.
verbose
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment