Skip to content

Commit

Permalink
Update mcd_file.py
Browse files Browse the repository at this point in the history
Reading ablation images, slide image, and panorama image returns an extra byte from the DotNet Binary Serialization record.  Modified the code so that the extra byte is not returned.
  • Loading branch information
sandip-shah authored Sep 6, 2024
1 parent ccc08a4 commit 8385827
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions readimc/mcd_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ def read_slide(self, slide: Slide) -> Optional[np.ndarray]:
if data_start_offset == data_end_offset == 0:
return None
data_start_offset += 161
data_end_offset -= 1
if data_start_offset >= data_end_offset:
raise IOError(
f"MCD file '{self.path.name}' corrupted: "
Expand Down Expand Up @@ -230,6 +231,7 @@ def read_panorama(self, panorama: Panorama) -> np.ndarray:
f"cannot locate image data for panorama {panorama.id}"
) from e
data_start_offset += 161
data_end_offset -= 1
if data_start_offset >= data_end_offset:
raise IOError(
f"MCD file '{self.path.name}' corrupted: "
Expand Down Expand Up @@ -270,6 +272,7 @@ def read_before_ablation_image(
if data_start_offset == data_end_offset == 0:
return None
data_start_offset += 161
data_end_offset -= 1
if data_start_offset >= data_end_offset:
raise IOError(
f"MCD file '{self.path.name}' corrupted: "
Expand Down Expand Up @@ -312,6 +315,7 @@ def read_after_ablation_image(
if data_start_offset == data_end_offset == 0:
return None
data_start_offset += 161
data_end_offset -= 1
if data_start_offset >= data_end_offset:
raise IOError(
f"MCD file '{self.path.name}' corrupted: "
Expand Down

0 comments on commit 8385827

Please sign in to comment.