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
571657a4
Commit
571657a4
authored
1 year ago
by
Christopher Randolph Rhodes
Browse files
Options
Downloads
Patches
Plain Diff
Example script with 3D ilastik model
parent
f36da7c8
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
examples/ilastik3d.py
+79
-0
79 additions, 0 deletions
examples/ilastik3d.py
with
79 additions
and
0 deletions
examples/ilastik3d.py
0 → 100644
+
79
−
0
View file @
571657a4
from
multiprocessing
import
Process
from
pathlib
import
Path
import
requests
from
shutil
import
copyfile
import
uvicorn
host
=
'
127.0.0.1
'
port
=
5001
px3d_ilp
=
'
3d_model/px3d.ilp
'
ob3d_ilp
=
'
3d_model/ob3d.ilp
'
czi_root
=
Path
(
'
z:/rhodes/projects/proj0004-marine-photoactivation/data/exp0036
'
)
czis
=
[
'
A01-selection-test01.czi
'
,
'
B01-selection-test01.czi
'
]
channel
=
4
if
__name__
==
'
__main__
'
:
server_process
=
Process
(
target
=
uvicorn
.
run
,
args
=
(
'
api:app
'
,),
kwargs
=
{
'
host
'
:
host
,
'
port
'
:
port
,
'
log_level
'
:
'
debug
'
},
daemon
=
True
)
uri
=
f
'
http://
{
host
}
:
{
port
}
/
'
server_process
.
start
()
resp_paths
=
requests
.
get
(
uri
+
'
paths
'
)
paths
=
resp_paths
.
json
()
# load ilastik pixel model
resp_load_px
=
requests
.
put
(
uri
+
'
models/ilastik/pixel_classification/load/
'
,
params
=
{
'
project_file
'
:
px3d_ilp
},
)
assert
resp_load_px
.
status_code
==
200
model_id_px
=
resp_load_px
.
json
()[
'
model_id
'
]
# load ilastik object model
resp_load_ob
=
requests
.
put
(
uri
+
'
models/ilastik/object_classification/load/
'
,
params
=
{
'
project_file
'
:
ob3d_ilp
},
)
assert
resp_load_ob
.
status_code
==
200
model_id_ob
=
resp_load_ob
.
json
()[
'
model_id
'
]
# copy files from network storage to processing directory
for
ff
in
czis
:
infile
=
Path
(
czi_root
)
/
ff
outfile
=
Path
(
paths
[
'
inbound_images
'
])
/
ff
copyfile
(
infile
,
outfile
)
# infer pixel maps
resp_infer_px
=
requests
.
put
(
uri
+
f
'
infer/from_image_file
'
,
params
=
{
'
model_id
'
:
model_id_px
,
'
input_filename
'
:
ff
,
'
channel
'
:
channel
,
},
)
assert
resp_infer_px
==
200
# infer object maps
resp_infer_ob
=
requests
.
put
(
uri
+
f
'
infer/from_image_file
'
,
params
=
{
'
model_id
'
:
model_id_ob
,
'
input_filename
'
:
ff
,
'
channel
'
:
channel
,
},
)
assert
resp_infer_px
==
200
resp_models
=
requests
.
get
(
uri
+
'
models
'
)
server_process
.
terminate
()
\ 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