From 8385827ce429717268572fce3ee26386e61dd448 Mon Sep 17 00:00:00 2001 From: "Shah, Sandip P." <68666105+sandip-shah@users.noreply.github.com> Date: Fri, 6 Sep 2024 15:34:50 -0700 Subject: [PATCH] Update mcd_file.py 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. --- readimc/mcd_file.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/readimc/mcd_file.py b/readimc/mcd_file.py index d49ed0b..6815e9a 100644 --- a/readimc/mcd_file.py +++ b/readimc/mcd_file.py @@ -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: " @@ -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: " @@ -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: " @@ -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: "