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
c3a620f0
Commit
c3a620f0
authored
1 year ago
by
Christopher Randolph Rhodes
Browse files
Options
Downloads
Patches
Plain Diff
Auto-increment folder number from highest number in root folder, tolerant of deleted intermediaries
parent
c4884883
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
extensions/chaeo/examples/batch_run_patches.py
+10
-5
10 additions, 5 deletions
extensions/chaeo/examples/batch_run_patches.py
extensions/chaeo/examples/export_patch_focus_metrics.py
+20
-3
20 additions, 3 deletions
extensions/chaeo/examples/export_patch_focus_metrics.py
with
30 additions
and
8 deletions
extensions/chaeo/examples/batch_run_patches.py
+
10
−
5
View file @
c3a620f0
...
...
@@ -16,9 +16,13 @@ if __name__ == '__main__':
'
c:/Users/rhodes/projects/proj0011-plankton-seg/exp0009/output
'
)
yyyymmdd
=
strftime
(
'
%Y%m%d
'
,
localtime
())
idx
=
0
while
Path
(
where_output_root
/
f
'
batch-output-
{
yyyymmdd
}
-
{
idx
:
04
d
}
'
).
exists
():
idx
+=
1
for
ff
in
Path
(
where_output_root
).
iterdir
():
ma
=
re
.
match
(
f
'
batch-output-
{
yyyymmdd
}
-([\d]+)
'
,
ff
.
name
)
if
ma
:
idx
=
max
(
idx
,
int
(
ma
.
groups
()[
0
])
+
1
)
where_output
=
Path
(
where_output_root
/
f
'
batch-output-
{
yyyymmdd
}
-
{
idx
:
04
d
}
'
)
...
...
@@ -26,14 +30,15 @@ if __name__ == '__main__':
csv_args
=
{
'
mode
'
:
'
w
'
,
'
header
'
:
True
}
# when creating file
px_ilp
=
Path
.
home
()
/
'
model-server
'
/
'
ilastik
'
/
'
AF405-bodies_boundaries.ilp
'
#
TODO: try/catch blocks and error handling around workflow calls
#
TODO: pack JSON-serializable workflow inputs
#TODO: try/catch blocks and error handling around workflow calls
#TODO: pack JSON-serializable workflow inputs
for
ff
in
where_czi
.
iterdir
():
pattern
=
'
Selection--W([\d]+)--P([\d]+)-T([\d]+)
'
ma
=
re
.
match
(
pattern
,
ff
.
stem
)
print
(
ff
)
if
not
ff
.
suffix
.
upper
()
==
'
.CZI
'
:
if
not
ff
.
suffix
.
upper
()
==
'
.CZI
'
:
continue
if
int
(
ma
.
groups
()[
1
])
>
10
:
# skip second half of set
continue
...
...
This diff is collapsed.
Click to expand it.
extensions/chaeo/examples/export_patch_focus_metrics.py
+
20
−
3
View file @
c3a620f0
...
...
@@ -3,10 +3,12 @@ import re
from
time
import
localtime
,
strftime
from
typing
import
Dict
import
numpy
as
np
import
pandas
as
pd
from
skimage.filters
import
gaussian
,
sobel
from
extensions.ilastik.models
import
IlastikPixelClassifierModel
from
extensions.chaeo.products
import
export_3d_patches_with_focus_metrics
from
extensions.chaeo.products
import
export_3d_patches_with_focus_metrics
,
export_patches_from_zstack
from
extensions.chaeo.zmask
import
build_zmask_from_object_mask
from
model_server.accessors
import
generate_file_accessor
,
InMemoryDataAccessor
,
write_accessor_data_to_file
from
model_server.workflows
import
Timer
...
...
@@ -64,12 +66,24 @@ def export_patch_focus_metrics_from_multichannel_zstack(
stack
.
get_one_channel_data
(
patches_channel
),
zmask_meta
,
prefix
=
fstem
,
draw_bounding_box
=
False
,
rescale_clip
=
0.0
,
make_3d
=
True
,
annotate_focus_metric
=
annotate_focus_metric
,
)
ti
.
click
(
'
export_patches
'
)
ti
.
click
(
'
export_3d_patches
'
)
files
=
export_patches_from_zstack
(
Path
(
where_output
)
/
'
2d_patches
'
,
stack
.
get_one_channel_data
(
patches_channel
),
zmask_meta
,
prefix
=
fstem
,
draw_bounding_box
=
True
,
rescale_clip
=
0.0
,
# focus_metric=lambda x: np.max(sobel(x)),
focus_metric
=
'
max_sobel
'
,
make_3d
=
False
,
)
ti
.
click
(
'
export_2d_patches
'
)
return
{
'
pixel_model_id
'
:
px_model
.
model_id
,
...
...
@@ -101,6 +115,9 @@ if __name__ == '__main__':
px_ilp
=
Path
.
home
()
/
'
model-server
'
/
'
ilastik
'
/
'
AF405-bodies_boundaries.ilp
'
for
ff
in
where_czi
.
iterdir
():
if
ff
.
stem
!=
'
Selection--W0000--P0009-T0001
'
:
continue
pattern
=
'
Selection--W([\d]+)--P([\d]+)-T([\d]+)
'
ma
=
re
.
match
(
pattern
,
ff
.
stem
)
...
...
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