Skip to content

Commit

Permalink
remove reference to TF.get_dimensions for compatibility (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
alisterburt authored Feb 22, 2023
1 parent e045b28 commit 9dfcbe0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/fidder/predict/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from typing import Optional, Tuple

import torch
import torchvision.transforms.functional as TF
from einops import rearrange
from pytorch_lightning import Trainer

Expand Down Expand Up @@ -38,7 +37,7 @@ def predict_fiducial_mask(
elif image.ndim == 3:
image = rearrange(image, "b h w -> b 1 h w")
image = torch.as_tensor(image, dtype=torch.float)
_, h, w = TF.get_dimensions(image)
h, w = image.shape[-2:]
downscale_factor = calculate_resampling_factor(
source=pixel_spacing, target=TRAINING_PIXEL_SIZE
)
Expand Down
4 changes: 2 additions & 2 deletions src/fidder/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def rescale_2d_bicubic(
`(b, c, h, w)` array of rescaled image(s).
"""
if factor is not None:
_, h, w = TF.get_dimensions(image)
h, w = image.shape[-2:]
size = int(factor * min(h, w))
rescaled_image = TF.resize(
image, size=size, interpolation=TF.InterpolationMode.BICUBIC
Expand Down Expand Up @@ -63,7 +63,7 @@ def rescale_2d_nearest(
`(b, c, h, w)` array of rescaled image(s).
"""
if factor is not None:
_, h, w = TF.get_dimensions(image)
h, w = image.shape[-2:]
size = int(factor * min(h, w))
rescaled_image = TF.resize(
image, size=size, interpolation=TF.InterpolationMode.NEAREST
Expand Down

0 comments on commit 9dfcbe0

Please sign in to comment.