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 Sep 5, 2024
1 parent 31f6522 commit 57ba081
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions readimc/mcd_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,9 @@ def read_acquisition(
img[:, ys, xs] = np.transpose(data[:, 3:])
return img

def read_slide(self, slide: Slide, raw: bool = False) -> Union[np.ndarray, bytes, None]:
def read_slide(
self, slide: Slide, raw: bool = False
) -> Union[np.ndarray, bytes, None]:
"""Reads and decodes a slide image as numpy array using the ``imageio``
package.
Expand Down Expand Up @@ -214,7 +216,9 @@ def read_slide(self, slide: Slide, raw: bool = False) -> Union[np.ndarray, bytes
f"cannot read image for slide {slide.id}"
) from e

def read_panorama(self, panorama: Panorama, raw: bool = False) -> Union[np.ndarray, bytes, None]:
def read_panorama(
self, panorama: Panorama, raw: bool = False
) -> Union[np.ndarray, bytes, None]:
"""Reads and decodes a panorama image as numpy array using the
``imageio`` package.
Expand Down Expand Up @@ -248,8 +252,7 @@ def read_panorama(self, panorama: Panorama, raw: bool = False) -> Union[np.ndarr
) from e

def read_before_ablation_image(
self, acquisition: Acquisition,
raw: bool = False
self, acquisition: Acquisition, raw: bool = False
) -> Union[np.ndarray, bytes, None]:
"""Reads and decodes a before-ablation image as numpy array using the
``imageio`` package.
Expand Down Expand Up @@ -361,15 +364,17 @@ def _read_schema_xml(
data = mm.read(end_index + len(end_sub_encoded) - start_index)
return data.decode(encoding=encoding)

def _read_image(self, data_offset: int, data_size: int, raw: bool = False) -> Union[np.ndarray, bytes]:
def _read_image(
self, data_offset: int, data_size: int, raw: bool = False
) -> Union[np.ndarray, bytes]:
if self._fh is None:
raise IOError(f"MCD file '{self.path.name}' has not been opened")
self._fh.seek(data_offset)
data = self._fh.read(data_size)
if raw:
return data
return data
else:
return imread(data)
return imread(data)

def __repr__(self) -> str:
return str(self._path)

0 comments on commit 57ba081

Please sign in to comment.