Skip to content

Commit f85c6a6

Browse files
authored
Merge branch 'develop' into dev-define-engines-abc
2 parents 3d04400 + 964c846 commit f85c6a6

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

.github/workflows/python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
sudo apt update
3131
sudo apt-get install -y libopenslide-dev openslide-tools libopenjp2-7 libopenjp2-tools
3232
python -m pip install --upgrade pip
33-
python -m pip install ruff==0.5.1 pytest pytest-cov pytest-runner
33+
python -m pip install ruff==0.5.2 pytest pytest-cov pytest-runner
3434
pip install -r requirements/requirements.txt
3535
- name: Cache tiatoolbox static assets
3636
uses: actions/cache@v3

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ repos:
6060
- id: rst-inline-touching-normal # Detect mistake of inline code touching normal text in rst.
6161
- repo: https://github.com/astral-sh/ruff-pre-commit
6262
# Ruff version.
63-
rev: v0.5.1
63+
rev: v0.5.2
6464
hooks:
6565
- id: ruff
6666
args: [--fix, --exit-non-zero-on-fix]

requirements/requirements_dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pytest>=7.2.0
1111
pytest-cov>=4.0.0
1212
pytest-runner>=6.0
1313
pytest-xdist[psutil]
14-
ruff==0.5.1 # This will be updated by pre-commit bot to latest version
14+
ruff==0.5.2 # This will be updated by pre-commit bot to latest version
1515
toml>=0.10.2
1616
twine>=4.0.1
1717
wheel>=0.37.1

tiatoolbox/tools/registration/wsi_registration.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ class DFBRFeatureExtractor(torch.nn.Module):
332332
333333
"""
334334

335-
def __init__(self: torch.nn.Module) -> None:
335+
def __init__(self: DFBRFeatureExtractor) -> None:
336336
"""Initialize :class:`DFBRFeatureExtractor`."""
337337
super().__init__()
338338
output_layers_id: list[str] = ["16", "23", "30"]
@@ -434,8 +434,8 @@ class DFBRegister:
434434
def __init__(self: DFBRegister, patch_size: tuple[int, int] = (224, 224)) -> None:
435435
"""Initialize :class:`DFBRegister`."""
436436
self.patch_size = patch_size
437-
self.x_scale: list[float] = []
438-
self.y_scale: list[float] = []
437+
self.x_scale: np.ndarray
438+
self.y_scale: np.ndarray
439439
self.feature_extractor = DFBRFeatureExtractor()
440440

441441
# Make this function private when full pipeline is implemented.
@@ -796,7 +796,7 @@ def find_points_inside_boundary(mask: np.ndarray, points: np.ndarray) -> np.ndar
796796
return PatchExtractor.filter_coordinates(
797797
mask_reader,
798798
bbox_coord,
799-
mask.shape[::-1],
799+
(mask.shape[1], mask.shape[0]),
800800
)
801801

802802
def filtering_matching_points(
@@ -1521,21 +1521,21 @@ def get_patch_dimensions(
15211521
"""
15221522
width, height = size[0], size[1]
15231523

1524-
x = [
1524+
x_info = [
15251525
np.linspace(1, width, width, endpoint=True),
15261526
np.ones(height) * width,
15271527
np.linspace(1, width, width, endpoint=True),
15281528
np.ones(height),
15291529
]
1530-
x = np.array(list(itertools.chain.from_iterable(x)))
1530+
x = np.array(list(itertools.chain.from_iterable(x_info)))
15311531

1532-
y = [
1532+
y_info = [
15331533
np.ones(width),
15341534
np.linspace(1, height, height, endpoint=True),
15351535
np.ones(width) * height,
15361536
np.linspace(1, height, height, endpoint=True),
15371537
]
1538-
y = np.array(list(itertools.chain.from_iterable(y)))
1538+
y = np.array(list(itertools.chain.from_iterable(y_info)))
15391539

15401540
points = np.array([x, y]).transpose()
15411541
transform = transform * [[1, 1, 0], [1, 1, 0], [1, 1, 1]] # remove translation

tiatoolbox/utils/metrics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,5 @@ def dice(gt_mask: np.ndarray, pred_mask: np.ndarray) -> float:
103103
pred_mask = pred_mask.astype(np.bool_)
104104
sum_masks = gt_mask.sum() + pred_mask.sum()
105105
if sum_masks == 0:
106-
return np.NAN
106+
return np.nan
107107
return 2 * np.logical_and(gt_mask, pred_mask).sum() / sum_masks

0 commit comments

Comments
 (0)