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 clone
or unzip thesvs_to_tif.zip
file 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.yml
file, which contains the necessary packages. Run the following command:conda env create -f environment.yml
-
Copy the OpenSlide Folder
From theElif_final
folder, copy theopenslide
folder to the C drive. After copying, copy the path of thebin
folder inside theopenslide
folder. The path may look something like this:C:\Openslide\bin
Open the
svs2tif.py
file 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.py
file 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