Skip to content

dimi-lab/DicomToSVS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DicomToSVS: Whole Slide Image Conversion Workflow πŸ”¬

This repository contains the tools and scripts necessary to convert DICOM Whole Slide Images (WSI), which may be composed of multiple files, into a single, standardized SVS file format.


πŸ’» Script Mapping

To clearly associate the workflow steps with the corresponding code files, please refer to the table below:

Step Description Script
Step 1 DICOM File Compressor: Aggregation and Packaging data_compress.ipynb
Step 2 ZIP to SVS Converter: Format Transformation DICOM_to_SVS.ipynb

πŸš€ Workflow Steps

Step 1: DICOM File Compressor

Script: data_compress.ipynb

This script aggregates all the individual DICOM files (*.dcm) that constitute a single Whole Slide Image (WSI) across different resolutions, compressing them into one ZIP archive.

Input Configuration

Adjust the paths below in your Python script (data_compress.ipynb) to define the source files and the output location.

# Set the desired output directory for the single ZIP file
output_dir = '/path/to/your/output/folder'

# Set the desired unique identifier for the slide. This will be the name of the output ZIP file.
slide_id = 'YOUR_CUSTOM_ID'

# Replace these paths with the complete list of ALL DICOM file paths 
# that belong to this specific Whole Slide Image (WSI).
file_list = [
    "/path/to/your/wsi_1/file1.dcm",
    "/path/to/your/wsi_1/file2.dcm",
    # ... add all other .dcm paths for this WSI here
]

Output

A single compressed ZIP file, created in the specified output_dir.

/path/to/your/output/folder/[slide_id].zip

Step 2: ZIP to SVS Converter

Script: DICOM_to_SVS.ipynb

This step utilizes a conversion function to decompress the archive generated in Step 1 and transform the contained DICOM files into the SVS format.

Input Function Call

# Convert the DICOM ZIP file to the SVS format
from_DICOM_to_SVS(
    path_to_folder='/path/to/DICOMtoSVS/test',  # Directory containing the input files
    is_zipped=True,                                        # Flag indicating if the input is a zipped file
    label=True,                                            # Include the Label image
    macro=True,                                            # Include the Macro image
    anonymize=False,                                       # Retain original patient information
    add_DICOM_tags=True                                    # Embed DICOM tags into the SVS file
)

Output

The converted SVS file will be placed in a corresponding output directory (e.g., test_output if the input directory was test).

/path/to/test_output/*.svs

3. Reference and Acknowledgements πŸ™

This tool and workflow were developed based on the previous work provided by the following repository:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published