Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SVLT
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
ALMF
SVLT
Commits
eaa62b6f
Commit
eaa62b6f
authored
3 months ago
by
Christopher Randolph Rhodes
Browse files
Options
Downloads
Patches
Plain Diff
Patch masks become TIFs when they are 3d
parent
009e4b30
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
model_server/base/roiset.py
+10
-5
10 additions, 5 deletions
model_server/base/roiset.py
tests/base/test_roiset.py
+1
-2
1 addition, 2 deletions
tests/base/test_roiset.py
with
11 additions
and
7 deletions
model_server/base/roiset.py
+
10
−
5
View file @
eaa62b6f
...
...
@@ -796,8 +796,11 @@ class RoiSet(object):
patches_df
=
self
.
get_patch_masks
(
pad_to
=
pad_to
,
expanded
=
expanded
).
copy
()
def
_export_patch_mask
(
roi
):
patch
=
InMemoryDataAccessor
(
roi
.
patch_mask
)
ext
=
'
png
'
patch
=
InMemoryDataAccessor
.
from_mono
(
roi
.
patch_mask
)
if
patch
.
nz
==
1
:
ext
=
'
png
'
else
:
ext
=
'
tif
'
fname
=
f
'
{
prefix
}
-la
{
roi
.
label
:
04
d
}
-zi
{
roi
.
zi
:
04
d
}
.
{
ext
}
'
write_accessor_data_to_file
(
where
/
fname
,
patch
)
return
fname
...
...
@@ -835,16 +838,18 @@ class RoiSet(object):
if
pad_to
:
patch
=
pad
(
patch
,
pad_to
)
if
is_3d
:
return
np
.
expand_dims
(
patch
,
3
)
return
patch
else
:
return
np
.
expand_dims
(
patch
,
(
2
,
3
)
)
return
np
.
expand_dims
(
patch
,
2
)
dfe
=
self
.
_df
.
copy
()
dfe
[
'
patch_mask
'
]
=
dfe
.
apply
(
_make_patch_mask
,
axis
=
1
)
return
dfe
def
get_patch_masks_acc
(
self
,
**
kwargs
)
->
PatchStack
:
return
PatchStack
(
list
(
self
.
get_patch_masks
(
**
kwargs
).
patch_mask
))
se_pm
=
self
.
get_patch_masks
(
**
kwargs
).
patch_mask
se_ext
=
se_pm
.
apply
(
lambda
x
:
np
.
expand_dims
(
x
,
2
))
return
PatchStack
(
list
(
se_ext
))
def
get_patches
(
self
,
...
...
This diff is collapsed.
Click to expand it.
tests/base/test_roiset.py
+
1
−
2
View file @
eaa62b6f
...
...
@@ -242,8 +242,7 @@ class TestRoiSetMonoProducts(BaseTestRoiSetMonoProducts, unittest.TestCase):
roiset
=
self
.
_make_roi_set
()
df_patch_masks
=
roiset
.
get_patch_masks
()
for
roi
in
df_patch_masks
.
itertuples
():
h
,
w
,
nc
,
nz
=
roi
.
patch_mask
.
shape
self
.
assertEqual
(
nc
,
1
)
h
,
w
,
nz
=
roi
.
patch_mask
.
shape
self
.
assertEqual
(
nz
,
1
)
self
.
assertEqual
(
h
,
roi
.
h
)
self
.
assertEqual
(
w
,
roi
.
w
)
...
...
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