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
ffbc837d
Commit
ffbc837d
authored
1 year ago
by
Christopher Randolph Rhodes
Browse files
Options
Downloads
Patches
Plain Diff
Prototyped object classifier with segmentation
parent
5dc646d9
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
extensions/ilastik/models.py
+32
-0
32 additions, 0 deletions
extensions/ilastik/models.py
extensions/ilastik/tests/test_ilastik.py
+2
-0
2 additions, 0 deletions
extensions/ilastik/tests/test_ilastik.py
with
34 additions
and
0 deletions
extensions/ilastik/models.py
+
32
−
0
View file @
ffbc837d
...
...
@@ -106,3 +106,35 @@ class IlastikObjectClassifierFromPixelPredictionsModel(IlastikImageToImageModel)
[
0
,
1
,
2
,
3
]
)
return
InMemoryDataAccessor
(
data
=
yxcz
),
{
'
success
'
:
True
}
class
IlastikObjectClassifierFromSegmentationModel
(
IlastikImageToImageModel
):
model_id
=
'
ilastik_object_classification_from_segmentation
'
@staticmethod
def
get_workflow
():
from
ilastik.workflows.objectClassification.objectClassificationWorkflow
import
ObjectClassificationWorkflowBinary
return
ObjectClassificationWorkflowBinary
def
infer
(
self
,
input_img
:
GenericImageDataAccessor
,
segmentation_img
:
GenericImageDataAccessor
)
->
(
np
.
ndarray
,
dict
):
assert
segmentation_img
.
is_mask
()
tagged_input_data
=
vigra
.
taggedView
(
input_img
.
data
,
'
yxcz
'
)
tagged_seg_data
=
vigra
.
taggedView
(
segmentation_img
.
data
,
'
yxcz
'
)
dsi
=
[
{
'
Raw Data
'
:
self
.
PreloadedArrayDatasetInfo
(
preloaded_array
=
tagged_input_data
),
'
Segmentation Image
'
:
self
.
PreloadedArrayDatasetInfo
(
preloaded_array
=
tagged_seg_data
),
}
]
obmaps
=
self
.
shell
.
workflow
.
batchProcessingApplet
.
run_export
(
dsi
,
export_to_array
=
True
)
# [z x h x w x n]
assert
(
len
(
obmaps
)
==
1
,
'
ilastik generated more than one object map
'
)
yxcz
=
np
.
moveaxis
(
obmaps
[
0
],
[
1
,
2
,
3
,
0
],
[
0
,
1
,
2
,
3
]
)
return
InMemoryDataAccessor
(
data
=
yxcz
),
{
'
success
'
:
True
}
This diff is collapsed.
Click to expand it.
extensions/ilastik/tests/test_ilastik.py
+
2
−
0
View file @
ffbc837d
...
...
@@ -199,3 +199,5 @@ class TestIlastikOverApi(TestServerBaseClass):
}
)
self
.
assertEqual
(
resp_infer
.
status_code
,
200
,
resp_infer
.
content
.
decode
())
# TODO: test IlastikObjectClassifierFromSegmentationModel when a test model is complete
\ No newline at end of file
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