Update comment
This commit is contained in:
parent
96d67672d9
commit
1bb2a125bc
2 changed files with 12 additions and 11 deletions
|
|
@ -261,16 +261,16 @@ class RectGridWorkflow(
|
||||||
|
|
||||||
def _get_stitching_settings_model(self) -> StitchingSettings:
|
def _get_stitching_settings_model(self) -> StitchingSettings:
|
||||||
"""Return a stitching settings model based on current settings."""
|
"""Return a stitching settings model based on current settings."""
|
||||||
|
# Use the save resolution and target stitch resolution to choose a unit fraction,
|
||||||
|
# which makes correlating faster
|
||||||
width, height = self.save_resolution
|
width, height = self.save_resolution
|
||||||
|
|
||||||
# Target area in pixels
|
# Target area in pixels
|
||||||
target_area = TARGET_STITCHING_DIMENSION**2
|
target_area = TARGET_STITCHING_DIMENSION**2
|
||||||
|
|
||||||
# Find N so that (width/N) * (height/N) ~ target_area
|
# Find N so that (width/N) * (height/N) ~ target_area
|
||||||
# N^2 ~ (width * height) / target_area
|
# N^2 ~ (width * height) / target_area
|
||||||
downsample_factor = max(1, round((width * height / target_area) ** 0.5))
|
downsample_factor = max(1, round((width * height / target_area) ** 0.5))
|
||||||
|
|
||||||
correlation_resize = 1 / downsample_factor
|
correlation_resize = 1 / downsample_factor
|
||||||
|
|
||||||
return StitchingSettings(
|
return StitchingSettings(
|
||||||
overlap=self.overlap,
|
overlap=self.overlap,
|
||||||
correlation_resize=correlation_resize,
|
correlation_resize=correlation_resize,
|
||||||
|
|
|
||||||
|
|
@ -434,14 +434,15 @@ def test_histo_workflow_settings_ui(histo_workflow, mocker):
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
("save_res,expected_resize",)[
|
("save_res", "expected_resize"),
|
||||||
((1400, 1400), 1 / 2), # width=1400 -> N=2
|
[
|
||||||
((1640, 1232), 1 / 2), # width=1640 -> round(1640/750)=2
|
((1400, 1400), 1 / 2),
|
||||||
((760, 750), 1 / 1), # width=760 -> N=1
|
((1640, 1232), 1 / 2),
|
||||||
((1499, 1000), 1 / 2), # width ~1500 -> N=2
|
((760, 750), 1 / 1),
|
||||||
((2250, 1800), 1 / 3), # width=2250 -> N=3
|
((1499, 1000), 1 / 2),
|
||||||
((700, 700), 1 / 1), # width < 750 -> N=1
|
((2250, 1800), 1 / 3),
|
||||||
]
|
((700, 700), 1 / 1),
|
||||||
|
],
|
||||||
)
|
)
|
||||||
def test_correlation_resize(histo_workflow, save_res, expected_resize):
|
def test_correlation_resize(histo_workflow, save_res, expected_resize):
|
||||||
"""Test that scan_workflows chooses a suitable correlation_resize factor.
|
"""Test that scan_workflows chooses a suitable correlation_resize factor.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue