Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/torchio/data/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ def __init__(
self[STEM] = '' if self.path is None else get_stem(self.path)
self[TYPE] = type

self.update_attributes()

def __repr__(self):
properties = []
properties.extend(
Expand Down Expand Up @@ -233,6 +235,10 @@ def __copy__(self):
)
return new_image

def update_attributes(self) -> None:
# This allows to get images using attribute notation, e.g. image.modality
self.__dict__.update(self)

@staticmethod
def _check_data_loader() -> None:
if torch.__version__ >= '2.3' and in_torch_loader():
Expand Down
Loading