Skip to content

Error creating inference dataset from DICOM directory #8

@MtK999

Description

@MtK999

In pathopatch.patch_extraction.dataset.py, the _set_hardware function checks the format of the input data for the inference dataset in order to select the appropriate slide loading backend. This includes handling the case where the wsi_file is a directory containing DICOM files. In such cases, one of the DICOM files must be opened with OpenSlide.

In line 294, wsi_file is correctly reassigned to the first DICOM file in the directory. However, this updated variable is neither returned nor used afterward. The _set_hardware function only performs a test load of the slide to determine the appropriate slide loader.

The actual slide loading for further processing happens later, in lines 415–416, where the selected slide loader is used to load str(self.config.wsi_path). If wsi_path points to a DICOM directory, this results in attempting to load the directory itself rather than the first DICOM file, which causes the operation to fail.

In contrast, this is correctly implemented for the offline dataset. There, _set_hardware also updates wsi_file to the first DICOM file (line 443), but importantly, the modified wsi_file is returned at the end of the function (line 524). Subsequently, in lines 886–887, the slide is loaded using this updated wsi_file, ensuring correct behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions