Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Methods to stitch a position grid #137

Merged
merged 41 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
c09fd09
add image stitcher
ieivanov Mar 19, 2024
8b85cfb
update stitching scripts
ieivanov Mar 25, 2024
1e84030
select channel to stich and save as zarr
ieivanov Mar 25, 2024
f1055b1
refactor zarr stitching
ieivanov Mar 27, 2024
aa181ec
add cli
ieivanov Mar 27, 2024
b8b6085
debug and switch to ndi.shift
ieivanov Mar 28, 2024
2b525ad
refactor stitching into module
ieivanov Mar 28, 2024
6af6ee4
refactor stitch cli and add slurmkit option
ieivanov Mar 28, 2024
170d4fc
minor updates
ieivanov Mar 28, 2024
9ef5326
debug timelapse stitching
ieivanov Mar 28, 2024
9b94e8d
stitch after shifting with slurm
ieivanov Mar 28, 2024
16edcb5
refactor `stitch_shifted_store`
ieivanov Mar 28, 2024
97c322b
add config-based stitching
ieivanov Apr 2, 2024
6b7610a
fix example stitch settings bug
ieivanov Apr 28, 2024
019b2bd
v2 shift estimation
ieivanov Apr 29, 2024
d65b2d6
write config file
ieivanov Apr 29, 2024
6f257b3
move write config function
ieivanov Apr 29, 2024
e779a18
better image shift calculation
ieivanov May 1, 2024
26eb65f
change pre/post processing nomenclature
ieivanov May 1, 2024
58f6c13
v2 stitching
ieivanov May 1, 2024
07ca3ab
estimate stitch of multiple wells
ieivanov May 13, 2024
cc6bcd7
better path names
ieivanov Jul 15, 2024
05b8907
Merge branch 'main' into stitch_images_v2
ieivanov Jul 15, 2024
60cb866
patching the error in our function that parallelizes over t and c.
edyoshikun Jul 16, 2024
a2399ab
Merge remote-tracking branch 'origin/fix_tc_parallel' into stitch_ima…
ieivanov Jul 16, 2024
e9dede3
multiwell stitching with slurm
ieivanov Jul 16, 2024
2d31c61
improvements and bugfixes
ieivanov Jul 17, 2024
4c1112e
remove old scripts
ieivanov Jul 17, 2024
75dc92a
cleanup function names
ieivanov Jul 17, 2024
1cfd771
update output store chunking
ieivanov Jul 17, 2024
b9a74c4
refactor and improve documentation
ieivanov Jul 17, 2024
502e138
refactor estimate functions into analysis/stitch.py
ieivanov Jul 17, 2024
0e78272
switch estimate_stitch to use input_position_dirpaths
ieivanov Jul 17, 2024
e22e19c
expand documentation
ieivanov Jul 17, 2024
5364a53
update example config file
ieivanov Jul 17, 2024
828bf00
add robustness for col shifts
ieivanov Jul 18, 2024
1f69267
switch to absolute stage error limits
ieivanov Jul 18, 2024
ff80d79
more docs
ieivanov Jul 18, 2024
be8ba08
increase preprocess_and_shift time limit
ieivanov Jul 18, 2024
b3f2cca
change default temp path
ieivanov Jul 22, 2024
1fe43ce
raise warning is SLURM not available, function should still run
ieivanov Jul 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions mantis/analysis/AnalysisSettings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import warnings

from typing import Literal, Optional, Union

import numpy as np
Expand All @@ -10,6 +12,11 @@ class MyBaseModel(BaseModel, extra=Extra.forbid):
pass


class ProcessingSettings(MyBaseModel):
fliplr: Optional[bool] = False
flipud: Optional[bool] = False


class DeskewSettings(MyBaseModel):
pixel_size_um: PositiveFloat
ls_angle_deg: PositiveFloat
Expand Down Expand Up @@ -87,3 +94,27 @@ def check_affine_transform_list(cls, v):
raise ValueError("Each element in affine_transform_list must be a 4x4 ndarray")

return v


class StitchSettings(MyBaseModel):
channels: Optional[list[str]] = None
preprocessing: Optional[ProcessingSettings] = None
postprocessing: Optional[ProcessingSettings] = None
column_translation: Optional[list[float, float]] = None
row_translation: Optional[list[float, float]] = None
total_translation: Optional[dict[str, list[float, float]]] = None

def __init__(self, **data):
if data.get("total_translation") is None:
if any(
(data.get("column_translation") is None, data.get("row_translation") is None)
):
raise ValueError(
"If total_translation is not provided, both column_translation and row_translation must be provided"
)
else:
warnings.warn(
"column_translation and row_translation are deprecated. Use total_translation instead.",
DeprecationWarning,
)
super().__init__(**data)
28 changes: 28 additions & 0 deletions mantis/analysis/settings/example_stitch_settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
channels: [Phase3D] # may be null in which case all channels will be stitched
preprocessing:
fliplr: true
flipud: false
postprocessing:
fliplr: false
flipud: true
total_translation: # translation distance in (x, y) in pixels for each image
0/2/000000:
- 0.0
- 39.7
0/2/000001:
- 883.75
- 39.7
0/2/001000:
- 1.8
- 920.5
0/2/001001:
- 885.55
- 920.7
# Instead of computing a total (x, y) shift for each image using estimate-stitch
# you can also supply column_translation and row_translation as (x, y) lists
# that will be applied to all images. column_translation and row_translation
# should be approximately (950, 0) and (0, 950) for 1000x1000 images with 5% overlap.
# This method of stitching images is being deprecated as the stage often does not
# make reproducible movements.
column_translation:
row_translation:
Loading
Loading