We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9d1b3b2 commit 1b666c5Copy full SHA for 1b666c5
1 file changed
src/torchio/data/image.py
@@ -181,6 +181,8 @@ def __init__(
181
self[STEM] = '' if self.path is None else get_stem(self.path)
182
self[TYPE] = type
183
184
+ self.update_attributes()
185
+
186
def __repr__(self):
187
properties = []
188
properties.extend(
@@ -233,6 +235,10 @@ def __copy__(self):
233
235
)
234
236
return new_image
237
238
+ def update_attributes(self) -> None:
239
+ # This allows to get images using attribute notation, e.g. image.modality
240
+ self.__dict__.update(self)
241
242
@staticmethod
243
def _check_data_loader() -> None:
244
if torch.__version__ >= '2.3' and in_torch_loader():
0 commit comments