Coverage for src / autoencodix / data / _imgdataclass.py: 100%
11 statements
« prev ^ index » next coverage.py v7.14.0, created at 2026-05-21 10:09 +0200
« prev ^ index » next coverage.py v7.14.0, created at 2026-05-21 10:09 +0200
1import numpy as np
2import pandas as pd
3from dataclasses import dataclass
4from typing import Union
7@dataclass
8class ImgData:
9 """Stores image data along with its associated metadata.
11 Attributes:
12 img : The image data as a NumPy array.
13 sample_id: A unique identifier for the image sample.
14 annotation: A DataFrame containing annotations or metadata related to the image.
15 """
17 img: np.ndarray
18 sample_id: str
19 annotation: Union[pd.Series, pd.DataFrame]
21 def __repr__(self):
22 return (
23 f"ImgData(\n"
24 f" sample_id={self.sample_id!r},\n"
25 f" img_shape={self.img.shape},\n"
26 f" annotation_shape={self.annotation.shape}\n"
27 f" . img: actual image data is not shown for brevity, use img attribute to access it"
28 f")"
29 )