-
Notifications
You must be signed in to change notification settings - Fork 102
🐛 Fix DICOM Reading (Issue #933) #934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0b12a9b
5615512
f8b68dc
9bf5951
5df8121
e4982da
e93cf31
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -725,7 +725,16 @@ def populate_slide_list(slide_folder: Path, search_txt: str | None = None) -> No | |
| """Populate the slide list with the available slides.""" | ||
| file_list = [] | ||
| len_slidepath = len(slide_folder.parts) | ||
| for ext in ["*.svs", "*ndpi", "*.tiff", "*.mrxs", "*.jpg", "*.png", "*.tif"]: | ||
| for ext in [ | ||
| "*.svs", | ||
| "*ndpi", | ||
| "*.tiff", | ||
| "*.mrxs", | ||
| "*.jpg", | ||
| "*.png", | ||
| "*.tif", | ||
| "*.dcm", | ||
| ]: | ||
| file_list.extend(list(Path(slide_folder).glob(str(Path("*") / ext)))) | ||
| file_list.extend(list(Path(slide_folder).glob(ext))) | ||
| if search_txt is None: | ||
|
|
@@ -2086,7 +2095,16 @@ def setup_doc(self: DocConfig, base_doc: Document) -> tuple[Row, Tabs]: | |
|
|
||
| # Set initial slide to first one in base folder | ||
| slide_list = [] | ||
| for ext in ["*.svs", "*ndpi", "*.tiff", "*.tif", "*.mrxs", "*.png", "*.jpg"]: | ||
| for ext in [ | ||
| "*.svs", | ||
| "*ndpi", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should this be |
||
| "*.tiff", | ||
| "*.tif", | ||
| "*.mrxs", | ||
| "*.png", | ||
| "*.jpg", | ||
| "*.dcm", | ||
| ]: | ||
| slide_list.extend(list(doc_config["slide_folder"].glob(ext))) | ||
| slide_list.extend( | ||
| list(doc_config["slide_folder"].glob(str(Path("*") / ext))), | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4595,6 +4595,7 @@ def _info(self: DICOMWSIReader) -> WSIMeta: | |
| mpp=mpp, | ||
| level_count=len(level_dimensions), | ||
| vendor=dataset.Manufacturer, | ||
| file_path=self.input_path, | ||
| ) | ||
|
|
||
| def read_rect( | ||
|
|
@@ -4826,8 +4827,19 @@ def read_rect( | |
| _, constrained_read_size = utils.transforms.bounds2locsize( | ||
| constrained_read_bounds, | ||
| ) | ||
|
|
||
| # if out of bounds, return empty image consistent with openslide | ||
| if np.any(np.array(constrained_read_size) <= 0): | ||
|
||
| return ( | ||
| np.ones( | ||
| shape=(int(size[1]), int(size[0]), 3), | ||
| dtype=np.uint8, | ||
| ) | ||
| * 255 | ||
| ) | ||
|
|
||
| dicom_level = wsi.levels[read_level].level | ||
| im_region = wsi.read_region(location, dicom_level, constrained_read_size) | ||
| im_region = wsi.read_region(level_location, dicom_level, constrained_read_size) | ||
| im_region = np.array(im_region) | ||
|
|
||
| # Apply padding outside the slide area | ||
|
|
@@ -5003,7 +5015,6 @@ class docstrings for more information. | |
| wsi = self.wsi | ||
|
|
||
| # Read at optimal level and corrected read size | ||
| location_at_baseline = bounds_at_baseline[:2] | ||
| level_location, size_at_read_level = utils.transforms.bounds2locsize( | ||
| bounds_at_read_level, | ||
| ) | ||
|
|
@@ -5016,7 +5027,7 @@ class docstrings for more information. | |
| _, read_size = utils.transforms.bounds2locsize(read_bounds) | ||
| dicom_level = wsi.levels[read_level].level | ||
| im_region = wsi.read_region( | ||
| location=location_at_baseline, | ||
| location=level_location, | ||
| level=dicom_level, | ||
| size=read_size, | ||
| ) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.