Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
model_server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christopher Randolph Rhodes
model_server
Commits
a3edc324
Commit
a3edc324
authored
1 year ago
by
Christopher Randolph Rhodes
Browse files
Options
Downloads
Patches
Plain Diff
Correct error when trying to extract a single channel from a PatchStack
parent
518ac1b2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!16
Completed (de)serialization of RoiSet
,
!12
Correct error when trying to extract a single channel from a PatchStack
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
model_server/base/accessors.py
+7
-0
7 additions, 0 deletions
model_server/base/accessors.py
tests/test_accessors.py
+15
-0
15 additions, 0 deletions
tests/test_accessors.py
with
22 additions
and
0 deletions
model_server/base/accessors.py
+
7
−
0
View file @
a3edc324
...
@@ -308,6 +308,13 @@ class PatchStack(InMemoryDataAccessor):
...
@@ -308,6 +308,13 @@ class PatchStack(InMemoryDataAccessor):
else
:
else
:
tifffile
.
imwrite
(
fpath
,
tzcyx
,
imagej
=
True
)
tifffile
.
imwrite
(
fpath
,
tzcyx
,
imagej
=
True
)
def
get_one_channel_data
(
self
,
channel
:
int
,
mip
:
bool
=
False
):
c
=
int
(
channel
)
if
mip
:
return
PatchStack
(
self
.
pyxcz
[:,
:,
:,
c
:(
c
+
1
),
:].
max
(
axis
=-
1
,
keepdims
=
True
))
else
:
return
PatchStack
(
self
.
pyxcz
[:,
:,
:,
c
:(
c
+
1
),
:])
@property
@property
def
shape_dict
(
self
):
def
shape_dict
(
self
):
return
dict
(
zip
((
'
P
'
,
'
Y
'
,
'
X
'
,
'
C
'
,
'
Z
'
),
self
.
data
.
shape
))
return
dict
(
zip
((
'
P
'
,
'
Y
'
,
'
X
'
,
'
C
'
,
'
Z
'
),
self
.
data
.
shape
))
...
...
This diff is collapsed.
Click to expand it.
tests/test_accessors.py
+
15
−
0
View file @
a3edc324
...
@@ -200,6 +200,21 @@ class TestPatchStackAccessor(unittest.TestCase):
...
@@ -200,6 +200,21 @@ class TestPatchStackAccessor(unittest.TestCase):
self
.
assertEqual
(
acc
.
hw
,
(
h
,
w
))
self
.
assertEqual
(
acc
.
hw
,
(
h
,
w
))
return
acc
return
acc
def
test_get_one_channel
(
self
):
acc
=
self
.
test_pczyx
()
mono
=
acc
.
get_one_channel_data
(
channel
=
1
)
for
a
in
'
PXYZ
'
:
self
.
assertEqual
(
mono
.
shape_dict
[
a
],
acc
.
shape_dict
[
a
])
self
.
assertEqual
(
mono
.
shape_dict
[
'
C
'
],
1
)
def
test_get_one_channel_mip
(
self
):
acc
=
self
.
test_pczyx
()
mono_mip
=
acc
.
get_one_channel_data
(
channel
=
1
,
mip
=
True
)
for
a
in
'
PXY
'
:
self
.
assertEqual
(
mono_mip
.
shape_dict
[
a
],
acc
.
shape_dict
[
a
])
for
a
in
'
CZ
'
:
self
.
assertEqual
(
mono_mip
.
shape_dict
[
a
],
1
)
def
test_export_pczyx_patch_hyperstack
(
self
):
def
test_export_pczyx_patch_hyperstack
(
self
):
acc
=
self
.
test_pczyx
()
acc
=
self
.
test_pczyx
()
fp
=
output_path
/
'
patch_hyperstack.tif
'
fp
=
output_path
/
'
patch_hyperstack.tif
'
...
...
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