A useful python based tool to convert .svs to .tif file. Currently there is an issue with the Bioformats importer in FIJI as a result it is not possible to convert the .svs file to .tif file. This tools utilizes the openslide package to do the conversion and the good part is thqt there is no compression during the conversion so no data loss issue.
-
Clone the repo or download the zip file
Use the commandgit cloneto clone the necessary files to a directory of your choice. Then, open the Anaconda prompt and navigate to that directory using the following command:cd path/to/your/folder -
Create the Virtual Environment
Create a virtual environment using the provided.ymlfile, which contains the necessary packages. Run the following command:conda env create -f environment.yml
-
Copy the OpenSlide Folder
From this link: https://openslide.org/download/ download the latest binaries, unzip it and copy theopenslidefolder to the a destibation of your choice (preferrably C drive). After copying, copy the path of thebinfolder inside theopenslidefolder. The path may look something like this:C:\Openslide\binOpen the
svs2tif.pyfile in any code editor (e.g., VS Code, Spyder, Atom, Notepad++). Change the file path of the OpenSlide DLL directory in the following line:# Add the directory containing the OpenSlide DLLs to the PATH os.add_dll_directory(r'C:\Openslide\bin')
IMPORTANT: Make sure you save the
svs2tif.pyfile after making this change. -
Activate Your Environment
Open the Anaconda prompt and activate your environment with the following command:conda activate svs2tif
Tip: To check the list of environments, use:
conda env list
To deactivate your environment, simply type:
deactivate
-
Run the Script
To run the script from the command line, navigate to the same directory as your Python script after activating the environment, and use the following command:python svs2tif.py --input folder/path/to/input --output folder/path/to/output