Pythostitcher is a tool inspired by AutoStitcher to stitch histopathology images into an artifical whole mount image. These artificial whole-mounts are indispensable for multimodal imaging research, since they greatly improve the ability to relate histopathology information to pre-operative imaging. PythoStitcher works fully automatically and is able to generate very high resolution (0.25 µm/pixel) whole-mounts. For a detailed description check out the official PythoStitcher publication in Nature Scientific Reports.
If your data consists of either halves or quadrants of a certain type of tissue (i.e. a prostate), PythoStitcher should be able to reconstruct the artificial whole-mount for you. PythoStitcher expects that your data has multiple resolution layers, also known as a pyramidal file, and preferably uses .mrxs or .tiff files. In addition, PythoStitcher requires a tissue mask of said tissue. This tissue mask can be generated by your tissue segmentation algorithm of choice; in the provided sample data we make use of the algorithm from Bándi et al.
It is highly recommended to run PythoStitcher as a Docker container, since PythoStitcher uses some libraries that need to be built from source. The Docker container comes prepackaged with these libraries, as well as with model weights of the involved CNNs, and should run out-of-the-box. You can pull the container with the following command or alternatively build it yourself locally with the provided Dockerfile in /build.
docker pull ghcr.io/computationalpathologygroup/pythostitcher:latest
Your input data should be prepared as follows, where you make a separate raw_images and raw_masks directory for your high resolution image and tissue mask files, respectively. Ensure that the name of the tissue mask is exactly the same as that of the image. If you want to enforce the location of each fragment in the final reconstruction, you can include a force_config.txt file. See the example_force_config.txt file on how to format this. If you leave out this file, PythoStitcher will automatically determine the optimal configuration of the tissue fragments.
data/
└── patient_ID
| └── raw_images
| ├── image1
| └── image2
| └── raw_masks
| ├── image1
| └── image2
│ └── force_config.txt [OPTIONAL]
After preparing the input data in the aforementioned format, you can run PythoStitcher through the command line using:
docker run -v /home/user:/home/user ghcr.io/computationalpathologygroup/pythostitcher --datadir "/home/user/data/patient_x" --savedir "/home/user/results" --resolution x
where datadir refers to the directory with your input data, savedir refers to the location to save the result and resolution refers to the resolution in µm/pixel at which you want to save the final reconstruction. The -v /home/user:/home/user flag is used to create a volume such that the container can access your local data directory. This can be any directory, as long as it is a parent directory for both the data and result directories. To obtain the result for the prostatectomy case with four fragments (figure at the top) you would run:
docker run -v /home/user:/home/user ghcr.io/computationalpathologygroup/pythostitcher --datadir "/home/user/data/prostate_4" --savedir "/home/user/results" --resolution 0.25
If you don't have any data available, but are still curious to try PythoStitcher, you can make use of our sample data available from . The sample data includes multiple prostatectomy cases with different sectioning approaches, please see the Zenodo record for more details.
The development of PythoStitcher would not have been possible without the open-sourcing of JigsawNet, ASAP and PyVips.
The source code of Pythostitcher is licensed under the GNU Lesser General Public License (LGPL). The provided sample data is licensed under the CC Attribution 4.0 International license. Please take these licenses into account when using PythoStitcher.