Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 5, 2024
1 parent 354dbf3 commit f306a9e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
8 changes: 2 additions & 6 deletions src/torchio/data/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -923,14 +923,12 @@ def count_labels(self) -> Dict[int, int]:


class LazyImage(Image):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

def load(self):

if self._is_multipath():
message = (f'No multiple paths for LazyImage')
message = f'No multiple paths for LazyImage'
RuntimeError(message)

tensor, affine = self.read_and_check(self.path)
Expand All @@ -943,7 +941,6 @@ def _parse_tensor(
tensor: Optional[TypeData],
none_ok: bool = True,
) -> Optional[torch.Tensor]:

if tensor is None:
if none_ok:
return None
Expand Down Expand Up @@ -986,11 +983,10 @@ def __repr__(self):


class LazyScalarImage(LazyImage, ScalarImage):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

class LazyLabelMap(LazyImage, LabelMap):

class LazyLabelMap(LazyImage, LabelMap):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
2 changes: 1 addition & 1 deletion src/torchio/transforms/preprocessing/spatial/crop.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def apply_transform(self, sample) -> Subject:
new_affine[:3, 3] = new_origin
i0, j0, k0 = index_ini
i1, j1, k1 = index_fin
if isinstance(image.data,torch.Tensor):
if isinstance(image.data, torch.Tensor):
image.set_data(image.data[:, i0:i1, j0:j1, k0:k1].clone())
else:
image.set_data(torch.as_tensor(image.data[:, i0:i1, j0:j1, k0:k1]))
Expand Down

0 comments on commit f306a9e

Please sign in to comment.