Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
DITB
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DISCO Beamline
DITB
Commits
ed678c1a
Commit
ed678c1a
authored
Jun 25, 2024
by
Hugo chauvet
Browse files
Options
Downloads
Patches
Plain Diff
add option to change the fuse function for create mosaic
parent
828d275e
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
ditb/stitching/tiles.py
+9
-5
9 additions, 5 deletions
ditb/stitching/tiles.py
pyproject.toml
+1
-1
1 addition, 1 deletion
pyproject.toml
with
10 additions
and
6 deletions
ditb/stitching/tiles.py
+
9
−
5
View file @
ed678c1a
...
...
@@ -149,6 +149,7 @@ def fuse_func(
load_tile_func
=
None
,
block_info
=
None
,
data_dtype
=
np
.
uint16
,
fuse_math_fun
=
np
.
max
)
->
np
.
ndarray
:
"""
Fuses the tiles that intersect the current chunk of a dask array using maximum projection.
...
...
@@ -187,7 +188,7 @@ def fuse_func(
# note that the dtype comversion here happens without scaling
# may want to use one of the skimage.img_as_* functions instead
stack
=
np
.
stack
([
fused
,
tile_shifted
])
fused
=
np
.
max
(
stack
,
axis
=
0
)
fused
=
fuse_math_fun
(
stack
,
axis
=
0
)
fused
[
fused
==
bad_value
]
=
0
return
fused
...
...
@@ -269,7 +270,7 @@ def tiles_as_shapely(metadata: dict, selected_tiles: [list, int] = -1,
def
create_mosaic
(
zarr_file
:
str
,
roi
:
int
=
-
1
,
channels
:
[
list
,
int
]
=
-
1
,
mosaic_chunk_size
:
[
int
,
int
]
=
(
1024
,
1024
),
output_file
:
str
=
None
,
nz
:
int
=
-
1
,
scale_z
:
bool
=
True
,
data_dtype
=
np
.
uint16
,
return_dask_array
=
False
):
return_dask_array
=
False
,
fuse_math_fun
=
np
.
max
):
"""
Stitch tiles together to create a stiched large image saved with as pyramid ome-zarr
...
...
@@ -290,7 +291,8 @@ def create_mosaic(zarr_file: str, roi: int = -1, channels: [list, int] = -1, mos
_fuse_func
=
partial
(
fuse_func
,
load_tile_func
=
mmzarr_load_one_tile
,
data_dtype
=
data_dtype
)
data_dtype
=
data_dtype
,
fuse_math_fun
=
fuse_math_fun
)
if
roi
==
-
1
:
roi
=
[
int
(
r
.
replace
(
'
roi
'
,
''
))
for
r
in
roi_tiles
]
...
...
@@ -410,9 +412,8 @@ def create_mosaic(zarr_file: str, roi: int = -1, channels: [list, int] = -1, mos
# Compute and save the mosaic inside a Roi:XX parent group
roi_group
=
root_group
.
create_group
(
f
'
Roi
{
r
}
'
)
dask_out
=
dask
.
array
.
stack
(
t_mosaic
)
with
ProgressBar
():
writer
.
write_image
(
dask
_out
,
roi_group
,
writer
.
write_image
(
dask
.
array
.
stack
(
t_mosaic
)
,
roi_group
,
scaler
=
scaler
,
axes
=
'
tczyx
'
,
coordinate_transformations
=
scale_omezarr
)
...
...
@@ -426,4 +427,7 @@ def create_mosaic(zarr_file: str, roi: int = -1, channels: [list, int] = -1, mos
# roi_group['0']
if
return_dask_array
:
with
ProgressBar
():
dask_out
=
dask
.
array
.
stack
(
t_mosaic
)
return
dask_out
\ No newline at end of file
This diff is collapsed.
Click to expand it.
pyproject.toml
+
1
−
1
View file @
ed678c1a
...
...
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name
=
"DITB"
version
=
"20240525rc
4
"
version
=
"20240525rc
5
"
readme
=
"README.md"
requires-python
=
">
=
3.11
"
authors
=
[
{
name
=
"Hugo Chauvet"
,
email
=
"hugo.chauvet@synchrotron-soleil.fr"
}
]
...
...
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