Skip to content

Commit

Permalink
[Dicom] Added new show
Browse files Browse the repository at this point in the history
  • Loading branch information
YanSte committed Sep 7, 2023
1 parent da88fa8 commit efb5791
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/skit/dicom.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,13 @@ def load_all_scans(
# Show
# -------- #

def _show_scan(self, scan_category, images, color_map):
if self.image_format == ImageFormat.WHDC:
images = ImageFormat.swap_dimensions(images, ImageFormat.DWHC)

show_text("h4", scan_category)
show_images(images, color_map=color_map)

def show(self, row, scan_category, color_map='gray'):
"""
Displays the images for a given row and scan category.
Expand All @@ -323,11 +330,8 @@ def show(self, row, scan_category, color_map='gray'):
"""
images = self.load_scan(row, scan_category)
if self.image_format == ImageFormat.WHDC:
images = ImageFormat.swap_dimensions(images, ImageFormat.DWHC)
self._show_scan(scan_category, images, color_map)

show_text("h4", scan_category)
show_images(images, color_map=color_map)

def show_all(self, row, color_map='gray'):
"""
Expand All @@ -341,8 +345,9 @@ def show_all(self, row, color_map='gray'):
The color map to use for displaying the images.
"""
for scan_category in self.scan_categories:
self.show(row, scan_category, color_map)
loaders_images = self.load_all_scans(row)
for scan_category, images in loaders_images.items():
self._show_scan(scan_category, images, color_map)

# Overriding the summary method
def summary(self, train_dataset=None):
Expand Down

0 comments on commit efb5791

Please sign in to comment.