Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
platy-browser-data
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
Container Registry
Model registry
Operate
Environments
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
Christian Tischer
platy-browser-data
Commits
305c6d65
Commit
305c6d65
authored
5 years ago
by
Constantin Pape
Browse files
Options
Downloads
Patches
Plain Diff
Update segmentation export
parent
cbe8a5ae
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
data/postprocess.json
+1
-1
1 addition, 1 deletion
data/postprocess.json
scripts/export/export_segmentation.py
+21
-12
21 additions, 12 deletions
scripts/export/export_segmentation.py
scripts/export/to_bdv.py
+2
-1
2 additions, 1 deletion
scripts/export/to_bdv.py
with
24 additions
and
14 deletions
data/postprocess.json
+
1
−
1
View file @
305c6d65
{
"sbem-6dpf-1-whole-segmented-cells-labels"
:
{
"boundary_path"
:
"/g/kreshuk/data/arendt/platyneris_v1/data.n5"
,
"boundary_key"
:
"volumes/affinities/s1"
,
"min_segment_size"
:
88604
,
"label_segmentation"
:
true
}}
{
"sbem-6dpf-1-whole-segmented-cells-labels"
:
{
"boundary_path"
:
"/g/kreshuk/data/arendt/platyneris_v1/data.n5"
,
"boundary_key"
:
"volumes/affinities/s1"
,
"max_segment_number"
:
32700
,
"label_segmentation"
:
false
}}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
scripts/export/export_segmentation.py
+
21
−
12
View file @
305c6d65
...
@@ -6,7 +6,7 @@ import z5py
...
@@ -6,7 +6,7 @@ import z5py
from
cluster_tools.downscaling
import
DownscalingWorkflow
from
cluster_tools.downscaling
import
DownscalingWorkflow
from
paintera_tools
import
serialize_from_commit
,
postprocess
from
paintera_tools
import
serialize_from_commit
,
postprocess
from
paintera_tools
import
set_default_shebang
as
set_ptools_shebang
from
paintera_tools
import
set_default_shebang
as
set_ptools_shebang
from
.to_bdv
import
to_bdv
from
.to_bdv
import
to_bdv
,
check_max_id
from
.map_segmentation_ids
import
map_segmentation_ids
from
.map_segmentation_ids
import
map_segmentation_ids
from
..default_config
import
write_default_global_config
,
get_default_shebang
from
..default_config
import
write_default_global_config
,
get_default_shebang
from
..files
import
get_postprocess_dict
from
..files
import
get_postprocess_dict
...
@@ -73,15 +73,20 @@ def export_segmentation(paintera_path, paintera_key, folder, new_folder, name, r
...
@@ -73,15 +73,20 @@ def export_segmentation(paintera_path, paintera_key, folder, new_folder, name, r
tmp_key
=
'
seg
'
tmp_key
=
'
seg
'
tmp_key0
=
os
.
path
.
join
(
tmp_key
,
'
s0
'
)
tmp_key0
=
os
.
path
.
join
(
tmp_key
,
'
s0
'
)
# set correct shebang for paintera tools
set_ptools_shebang
(
get_default_shebang
())
# run post-processing if specified for this segmentation name
# run post-processing if specified for this segmentation name
pp_dict
=
get_postprocess_dict
()
pp_dict
=
get_postprocess_dict
()
run_postprocessing
=
name
in
pp_dict
run_postprocessing
=
name
in
pp_dict
if
run_postprocessing
:
if
run_postprocessing
:
pp_config
=
pp_dict
[
name
]
pp_config
=
pp_dict
[
name
]
boundary_path
=
pp_config
[
'
boundary_path
'
]
boundary_path
=
pp_config
[
'
boundary_path
'
]
boundary_key
=
pp_config
[
'
boundary_key
'
]
boundary_key
=
pp_config
[
'
boundary_key
'
]
min_segment_size
=
pp_config
[
'
min_segment_size
'
]
min_segment_size
=
pp_config
.
get
(
'
min_segment_size
'
,
None
)
max_segment_number
=
pp_config
.
get
(
'
max_segment_number
'
,
None
)
label_segmentation
=
pp_config
[
'
label_segmentation
'
]
label_segmentation
=
pp_config
[
'
label_segmentation
'
]
tmp_postprocess
=
os
.
path
.
join
(
tmp_folder
,
'
postprocess_paintera
'
)
tmp_postprocess
=
os
.
path
.
join
(
tmp_folder
,
'
postprocess_paintera
'
)
postprocess
(
paintera_path
,
paintera_key
,
postprocess
(
paintera_path
,
paintera_key
,
...
@@ -89,15 +94,19 @@ def export_segmentation(paintera_path, paintera_key, folder, new_folder, name, r
...
@@ -89,15 +94,19 @@ def export_segmentation(paintera_path, paintera_key, folder, new_folder, name, r
tmp_folder
=
tmp_postprocess
,
tmp_folder
=
tmp_postprocess
,
target
=
target
,
max_jobs
=
max_jobs
,
target
=
target
,
max_jobs
=
max_jobs
,
n_threads
=
16
,
size_threshold
=
min_segment_size
,
n_threads
=
16
,
size_threshold
=
min_segment_size
,
label
=
label_segmentation
)
target_number
=
max_segment_number
,
label
=
label_segmentation
,
# set correct shebang for paintera tools
output_path
=
tmp_path
,
output_key
=
tmp_key0
)
set_ptools_shebang
(
get_default_shebang
())
else
:
# NOTE map_to_background is needed for cilia, nee some way to enable it automatically
# NOTE map_to_background is needed for cilia, need some way to enable it automatically
# export segmentation from paintera commit for all scales
# export segmentation from paintera commit for all scales
serialize_from_commit
(
paintera_path
,
paintera_key
,
tmp_path
,
tmp_key0
,
tmp_folder
,
serialize_from_commit
(
paintera_path
,
paintera_key
,
tmp_path
,
tmp_key0
,
tmp_folder
,
max_jobs
,
target
,
relabel_output
=
True
)
# , map_to_background=[1])
max_jobs
,
target
,
relabel_output
=
True
)
# , map_to_background=[1])
# check for overflow
print
(
"
Check max-id @
"
,
tmp_path
,
tmp_key0
)
check_max_id
(
tmp_path
,
tmp_key0
)
# downscale the segemntation
# downscale the segemntation
scale_factors
=
get_scale_factors
(
paintera_path
,
paintera_key
)
scale_factors
=
get_scale_factors
(
paintera_path
,
paintera_key
)
...
...
This diff is collapsed.
Click to expand it.
scripts/export/to_bdv.py
+
2
−
1
View file @
305c6d65
...
@@ -2,6 +2,7 @@ import os
...
@@ -2,6 +2,7 @@ import os
import
json
import
json
import
luigi
import
luigi
import
numpy
as
np
import
h5py
import
h5py
import
z5py
import
z5py
from
cluster_tools.downscaling
import
PainteraToBdvWorkflow
from
cluster_tools.downscaling
import
PainteraToBdvWorkflow
...
@@ -12,7 +13,7 @@ def check_max_id(path, key):
...
@@ -12,7 +13,7 @@ def check_max_id(path, key):
with
z5py
.
File
(
path
)
as
f
:
with
z5py
.
File
(
path
)
as
f
:
attrs
=
f
[
key
].
attrs
attrs
=
f
[
key
].
attrs
max_id
=
attrs
[
'
maxId
'
]
max_id
=
attrs
[
'
maxId
'
]
if
max_id
>
32000
:
if
max_id
>
np
.
iinfo
(
'
int16
'
).
max
:
print
(
"
Max-id:
"
,
max_id
,
"
does not fit int16
"
)
print
(
"
Max-id:
"
,
max_id
,
"
does not fit int16
"
)
raise
RuntimeError
(
"
Uint16 overflow
"
)
raise
RuntimeError
(
"
Uint16 overflow
"
)
else
:
else
:
...
...
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