RAPID is a deep learning-based algorithm to convert a list of whole slide images into a full resolution three-dimensional reconstruction. These 3D reconstructions with their accompanying visualization allow for new insights in tumour growth and tissue microarchitecture. Furthermore, these 3D reconstructions can greatly accelerate multimodal AI development where multiple 3D volumes from different imaging modalities are used for a downstream task such as diagnosis. RAPID leverages several state-of-the-art deep-learning based keypoint detectors and matchers, such as LightGlue and DeDoDe, for robustness in various conditions. Stay tuned for our upcoming publication [in preparation] for more technical details of RAPID.
We have primarily tested RAPID on sparsely sampled prostatectomy specimens where slides were acquired every ~4 mm. The main strength of RAPID is that it was designed to be robust against arbitrary slice gaps, providing a valuable addition to other methods which can only handle serial sections with micron-scale slice gaps. Therefore, if your data has sub 4 mm slice gaps and is ordered along the desired reconstruction dimension, we expect that RAPID will be able to reconstruct it in 3D. Moreover, RAPID expects that each input slide has multiple resolution layers, also known as a pyramidal file, and preferably uses .mrxs or .tiff files. In addition, RAPID requires a tissue mask of said tissue. This tissue mask can be generated by your tissue segmentation algorithm of choice, otherwise RAPID will automatically generate masks for you using Otsu thresholding.
It is highly recommended to run RAPID as a Docker container, since RAPID uses some libraries that need to be built from source. The Docker container comes prepackaged with these libraries and any additional model weights, and should run out-of-the-box. We will soon provide a link to directly pull the pre-built container, but for now you can build the container yourself locally with the provided Dockerfile in /build.
docker build . --tag dnschouten/rapid:v0.1
Your input data should be prepared as follows, where you make a separate directory for each volume to be reconstructed. Ensure that the name of the tissue mask, if provided, is exactly the same as that of the image but with a "_mask" suffix.
data/
└── case_ID_001
| └── 001.tif
| ├── 001_mask.tif
| ├── 002.tif
| ├── 002_mask.tif
| └── etc.
After preparing the input data in the aforementioned format, you can run the RAPID container with:
docker run -it --gpus all -v /home/user:/home/user --network host dnschouten/rapid:v0.1
Inside the container you can clone the RAPID repo to get the latest version after which you can run the main.py script. The main.py script expects three main arguments: datadir which refers to the directory with your input data, savedir which refers to the location to save the results and mode which refers to the reconstruction mode ["affine", "deformable"] in which you want to run RAPID. You can use the -v /home/user:/home/user flag to attach any local storage with your data to the container.
If you don't have any data available, but are still curious to try RAPID, we will soon provide some sample data on Zenodo.
The source code of RAPID is licensed under the GNU Lesser General Public License (LGPL).