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.
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.