diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index 946ee9f..7196b4a 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -16,7 +16,7 @@ jobs: id: metadata uses: dependabot/fetch-metadata@v1.1.1 with: - github-token: '${{ secrets.GITHUB_TOKEN }}' + github-token: "${{ secrets.GITHUB_TOKEN }}" - name: Enable auto-merge for Dependabot PRs if: ${{ steps.metadata.outputs.update-type == 'version-update:semver-patch' }} run: gh pr merge --auto --merge "$PR_URL" diff --git a/pyproject.toml b/pyproject.toml index c85bc93..f10bdf1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "m2stitch" -version = "0.2.1" +version = "0.2.2" description = "M2Stitch" authors = ["Yohsuke Fukai "] license = "MIT" diff --git a/src/m2stitch/_constrained_refinement.py b/src/m2stitch/_constrained_refinement.py index de2dacc..1f6e72c 100644 --- a/src/m2stitch/_constrained_refinement.py +++ b/src/m2stitch/_constrained_refinement.py @@ -90,6 +90,7 @@ def refine_translations(images: NumArray, grid: pd.DataFrame, r: Float) -> pd.Da continue image1 = images[i1] image2 = images[i2] + W, H = image1.shape def overlap_ncc(params): x, y = params @@ -102,8 +103,8 @@ def overlap_ncc(params): int(g[f"{direction}_y_second"]), ] limits = [ - [init_values[0] - r, init_values[0] + r], - [init_values[1] - r, init_values[1] + r], + [max(-W + 1, init_values[0] - r), min(W - 1, init_values[0] + r)], + [max(-H + 1, init_values[1] - r), min(H - 1, init_values[1] + r)], ] values, ncc_value = find_local_max_integer_constrained( overlap_ncc, np.array(init_values), np.array(limits)