diff --git a/.gitignore b/.gitignore index 742af0463..1da8c99f9 100644 --- a/.gitignore +++ b/.gitignore @@ -31,8 +31,9 @@ env3 venv venv3 -# temporary test data +# test data **/test_data/* .helpers/dock_test_data/* .helpers/dock_test_add/* +tests/images diff --git a/eitprocessing/datahandling/eitdata.py b/eitprocessing/datahandling/eitdata.py index 916e8ac2b..be0eee4ff 100644 --- a/eitprocessing/datahandling/eitdata.py +++ b/eitprocessing/datahandling/eitdata.py @@ -7,6 +7,7 @@ import numpy as np from strenum import LowercaseStrEnum +from tifffile import imwrite from typing_extensions import Self from eitprocessing.datahandling.mixins.equality import Equivalence @@ -117,6 +118,21 @@ def _sliced_copy( def __len__(self): return self.pixel_impedance.shape[0] + def export_pixel_data( + self, + fname: str | Path, + ) -> None: + """Save pixel impedance data as 3D tiff stack. + + Args: + fname: Output file name. + """ + # TODO: add metadata (at the very least time) + # TODO: add standardization for output paths + # TODO: allow different file formats?? + # output_path = Path((self.path[0]).parent() / fname) if isinstance(fname, str) else fname #noqa: ERA001 + imwrite(fname, self.pixel_impedance) + @property def global_baseline(self) -> np.ndarray: """Return the global baseline, i.e. the minimum pixel impedance across all pixels."""