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
96d6e34f
Commit
96d6e34f
authored
4 months ago
by
Christopher Randolph Rhodes
Browse files
Options
Downloads
Patches
Plain Diff
Can test ROI set pipelines without ilastik dependency
parent
1b66fc12
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_ilastik/test_roiset_workflow.py
+3
-40
3 additions, 40 deletions
tests/test_ilastik/test_roiset_workflow.py
with
3 additions
and
40 deletions
tests/test_ilastik/test_roiset_workflow.py
+
3
−
40
View file @
96d6e34f
...
...
@@ -3,15 +3,9 @@ import unittest
import
numpy
as
np
from
model_server.base.accessors
import
generate_file_accessor
from
model_server.base.api
import
app
import
model_server.conf.testing
as
conf
from
model_server.base.pipelines.roiset_obmap
import
RoiSetObjectMapParams
,
roiset_object_map_pipeline
import
model_server.extensions.ilastik.models
as
ilm
from
model_server.extensions.ilastik.router
import
router
app
.
include_router
(
router
)
data
=
conf
.
meta
[
'
image_files
'
]
output_path
=
conf
.
meta
[
'
output_path
'
]
...
...
@@ -64,30 +58,6 @@ class BaseTestRoiSetMonoProducts(object):
'
deproject_channel
'
:
0
,
}
# def _get_models(self): # tests can either use model objects directly, or load in API via project file string
# fp_px = classifiers['px']['path'].__str__()
# fp_ob = classifiers['seg_to_obj']['path'].__str__()
# return {
# 'pixel_classifier_segmentation': {
# 'name': 'ilastik_px_mod',
# 'project_file': fp_px,
# 'model': ilm.IlastikPixelClassifierModel(
# {
# 'project_file': fp_px,
# 'px_class': 0,
# 'px_prob_threshold': 0.5,
# },
# ),
# },
# 'object_classifier': {
# 'name': 'ilastik_ob_mod',
# 'project_file': fp_ob,
# 'model': ilm.IlastikObjectClassifierFromSegmentationModel(
# {'project_file': fp_ob},
# )
# },
# }
def
_get_models
(
self
):
from
model_server.base.models
import
BinaryThresholdSegmentationModel
,
PermissiveInstanceSegmentationModel
return
{
...
...
@@ -139,7 +109,6 @@ class TestRoiSetWorkflow(BaseTestRoiSetMonoProducts, unittest.TestCase):
class
TestRoiSetWorkflowOverApi
(
conf
.
TestServerBaseClass
,
BaseTestRoiSetMonoProducts
):
# TODO: rename app
app_name
=
'
tests.test_ilastik.test_roiset_workflow:app
'
input_data
=
data
[
'
multichannel_zstack_raw
'
]
...
...
@@ -157,24 +126,18 @@ class TestRoiSetWorkflowOverApi(conf.TestServerBaseClass, BaseTestRoiSetMonoProd
return
self
.
assertPutSuccess
(
f
'
accessors/read_from_file/
{
fname
}
'
)
def
test_load_pixel_classifier
(
self
):
# mid = self.assertPutSuccess(
# 'ilastik/seg/load/',
# body={'project_file': self._get_models()['pixel_classifier_segmentation']['project_file']},
# )['model_id']
mid
=
self
.
assertPutSuccess
(
'
models/seg/binary_threshold/load/
'
,
body
=
{
'
tr
'
:
1e4
},
)[
'
model_id
'
]
# self.assertTrue(mid.startswith('IlastikPixelClassifierModel'))
self
.
assertTrue
(
mid
.
startswith
(
'
BinaryThresholdSegmentationModel
'
))
return
mid
def
test_load_object_classifier
(
self
):
mid
=
self
.
assertPutSuccess
(
'
ilastik/seg_to_obj/load/
'
,
body
=
{
'
project_file
'
:
self
.
_get_models
()[
'
object_classifier
'
][
'
project_file
'
]},
'
models/classify/permissive/load/
'
,
)[
'
model_id
'
]
self
.
assertTrue
(
mid
.
startswith
(
'
IlastikObjectClassifierFromSegmentationModel
'
))
self
.
assertTrue
(
mid
.
startswith
(
'
Permissive
'
))
return
mid
def
_object_map_workflow
(
self
,
ob_classifer_id
):
...
...
@@ -201,7 +164,7 @@ class TestRoiSetWorkflowOverApi(conf.TestServerBaseClass, BaseTestRoiSetMonoProd
obmod_id
=
self
.
test_load_object_classifier
()
res
=
self
.
_object_map_workflow
(
obmod_id
)
acc_obmap
=
self
.
get_accessor
(
res
[
'
output_accessor_id
'
])
self
.
assertTrue
(
np
.
all
(
acc_obmap
.
unique
()[
0
]
==
[
0
,
1
,
2
]))
self
.
assertTrue
(
np
.
all
(
acc_obmap
.
unique
()[
0
]
==
[
0
,
1
]))
# get object map via RoiSet API
roiset_id
=
res
[
'
roiset_id
'
]
...
...
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