## 2 Materials and Methods
### Three-Dimensional Histological Reconstruction  
To establish a structural ground truth for the histology reconstruction, the corresponding microCT volume was sliced in silico in the same plane as the real sample. To ensure the convergence of the histological reconstruction process, torn, damaged, or otherwise visually distorted slides were discarded. The reconstruction process has two main steps: pre-alignment using data from the histology reconstruction and fine alignment with the help of the microCT volume. The MIRAX slide scanning process produces high-resolution images with variable dimensions, typically measuring 100,000 \(\times\) 200,000 pixels with a pixel ratio of 0.121267 \(\upmu\)m. To prepare these slides for further analysis, a pre-processing step was performed using the OpenSlide [46] and OpenCV [47] software libraries. The pre-processing pipeline involves the detection of the region of interest (ROI), which is critical for possible downstream morphometry analysis. The pipeline starts with gray-scale conversion and Canny edge detection, with the parameters 'threshold1 = 100' and 'threshold2 = 255'. An adaptive thresholding algorithm with the parameters'maxValue = 255, adaptiveMethod = 1, thresholdType = 1, blockSize = 11, and C = 2' is then applied. The resulting binary image is subjected to 15 iterations of dilation and erosion to reduce noise and ensure smoother contours. Contour detection is then used to identify the boundaries of the ROI. The bounding rectangle for each contour is calculated, and the largest of these is considered to contain the contour of the biopsy. The biopsy's contour is then fitted with the minimum area (\"rotated\") rectangle, as well as a concave polygon to determine the ROI for morphometric analysis. ROI detection is performed on the highest zoom level (lowest resolution) to achieve optimal performance. The rotated rectangle and concave polygons obtained at this stage are then scaled to the desired zoom level using bicubic scaling followed by simple thresholding ('threshold = 128') to remove artifacts and produce binary images. The angle of the rotated rectangle is used to calculate the rotation required for coarse pre-alignment. The resulting images are exported at a resolution of 3000 \(\times\) 7000, which corresponds to an 8.0\(\times\) downsample from the lowest zoom level of the original slide, with a pixel ratio of 0.970136 \(\upmu\)m. The downsampling factor can be decreased or eliminated, but this would result in a significant increase in computation time for downstream tasks. Each slice is fitted with a minimal area covering the rectangle, which when rotated upright is responsible for the coarse alignment of the slice rotations. This is followed by a stepwise affine transformation described by [PERSON] et al. [48]. The process begins at one end of the stack of slices and iteratively transforms the entire stack to match the other end of the slices. Within this iterative transformation, the reference slices were chosen based on the number of keypoints detected by the deep feature matching algorithm, detector-free local feature matching with transformers (LoFTR) [44]. LoFTR uses a convolutional neural network (CNN) backbone to compute feature descriptors for the images, which are then probed for matches using a transformer model. Once the reference slice is identified, the optimal affine transformation, which minimizes the cross-entropy between the images is calculated by first finding the optimal translation, followed by the optimal rotation and then finally the optimal scaling. By separating the different elements of the affine transformation, a more stable result can be achieved, and false optima can be avoided. The final alignment matches each histology slide with one of the in-silico microCT slices. The reference slices within the microCT volume are found by calculating the number of matching LoFTR keypoints for each in-silico microCT slice for a given histology slide.