Deconwolf enables high-performance deconvolution of wide�eld �uorescence microscopy images

Microscopy-based spatially resolved omic methods are transforming biology and medicine. Currently, these methods rely on high magni�cation objectives and cannot resolve crowded molecular targets, which limits the amount of biological information that can be extracted from a sample. To overcome these limitations, we developed Deconwolf (DW), an open-source software enabling high-performance deconvolution of wide�eld �uorescence microscopy image stacks and large tissue scans on a laptop computer. DW signi�cantly outperformed two popular deconvolution tools on images generated by standard immuno�uorescence as well as on images of crowded diffraction limited �uorescence dots generated by single-molecule �uorescence in situ hybridization (smFISH) and high-denition DNA FISH. In addition, wide�eld imaging followed by DW produced images comparable, if not superior in quality to confocal microscopy, but more than 200 times faster. Application of DW to smFISH images enabled accurate quanti�cation of Ki-67 gene transcripts across a tumor microarray tissue core imaged with a 20x air objective. Finally, we applied DW to deconvolve images generated by in situ spatial transcriptomics (ISST) and in situ genomics by OligoFISSEQ. In ISST, DW increased the number of transcripts identi�ed more than three times, while its application to OligoFISSEQ images drastically improved the e�ciency of chromosome tracing without the need for signal interpolation. We conclude that DW greatly facilitates the use of deconvolution in many bioimaging applications and paves the way to the application of microscopy-based spatially resolved omic technologies in diagnostics.


Introduction
In uorescence microscopy, deconvolution is an image processing approach that can be used to enhance the sharpness and contrast of an image by reversing the optical distortions that occur when light traverses a wide eld or confocal microscope 1 .Although several deconvolution tools are available, their widespread adoption has been limited by high licensing costs (for commercial software) and/or by the lack of e cient tools that can process large image datasets, such as those generated by whole-slide imaging microscopes, ideally on a laptop computer.For example, Huygens (Scienti c Volume Imaging, http://svi.nl) is a proprietary deconvolution software that has high licensing fees and requires considerable hands-on expertise to be effectively used.DeconvolutionLab2 2 is another popular deconvolution software that is freely available and was shown to outperform Huygens in some cases 3 .However, DeconvolutionLab2 is limited to images that t into the random-access memory of a computer and can therefore not be effectively used to process multiple image stacks or large tissue scans on a laptop computer.Recently, a novel deconvolution tool leveraging graphics processing units and convolutional neural networks was shown to considerably speed up the classic Richardson-Lucy deconvolution method 4,5 , enabling the deconvolution of whole-embryo and cleared-tissue images 6 .However, this approach is resource demanding (including multiple dependencies on proprietary software) and requires a substantial amount of expertise to be implemented.Thus, there is a clear need for openaccess, easy-to-operate, and computationally e cient tools for uorescence microscopy image deconvolution that can be readily implemented outside of bioimaging facilities and easily adopted by labs that are not specialized in image processing, including many pathology labs.
An important emerging application of deconvolution tools is in the booming eld of spatial biology.
Fluorescence microscopy-based spatial omic methods-such as in situ sequencing (ISS) 7 , sequential uorescence in situ hybridization (seqFISH) 8 , uorescent in situ RNA sequencing (FISSEQ) 9 , multiplexed error-robust uorescence in situ hybridization (MERFISH) 10 , optical reconstruction of chromatin architecture (ORCA) 11 , Hi-M 12 , OligoFISSEQ 13 , DNA multiplexed error-robust uorescence in situ hybridization (DNA MERFISH) 14 , multiplexed imaging of nucleome architectures (MINA) 15,16 , in situ spatial transcriptomics (ISST) 17 , expansion sequencing (ExSeq) 18 , DNA seqFISH +19 , and in situ genome sequencing (IGS) 20 -enable high-throughput detection of DNA loci, transcripts and proteins potentially in millions of cells in their tissue context, providing unique insights into the spatial organization of tissues and organs at the molecular and cellular level.However, these methods still suffer from two major limitations.Firstly, the high numerical aperture (NA) present only in high optical magni cation (60x or 100x) objectives is required to resolve and precisely localize the (near-)diffraction limited, dotted uorescent signals that these techniques typically produce.This signi cantly restricts the area of a given sample (such as a tissue section) that can be effectively imaged and, therefore, the amount of spatial information that can be extracted from it.Secondly, when the molecules to be visualized are crowdedsuch as in the case of transcripts of highly expressed genes-it becomes di cult to resolve them in space, even using high NA objectives.This can be particularly challenging when the imaged targets, such as transcripts or short chromosomal segments, are to be counted.One approach to counteract this problem is to use expansion microscopy 21 with or without super-resolution microscopy 22 .However, expansion and super-resolution microscopy methods cannot be easily scaled up and are challenging especially in the case of pathology samples.Another way to tackle these issues is through deconvolution.However, even though existing deconvolution tools are routinely used to process (near-) diffraction limited uorescence signals generated by microscopy-based spatially resolved omic methods, the same tools have not proven to be able to overcome the dependency of these methods on high NA objectives and their inability to resolve crowed signals.Therefore, novel deconvolution tools are needed to maximize the amount of information that can be obtained from imaging-based spatially resolved omic methods.
Towards this goal, we develop Deconwolf (DW), an open-access, easy-to-operate and highly computationally e cient deconvolution software that can deal with any type of uorescence microscopy signal, including (near-)diffraction limited uorescence dots generated by high-de nition DNA and RNA FISH as well as by imaging-based spatially resolved omic methods.We show that DW dramatically outperforms Huygens and DeconvolutionLab2 on images generated by single-molecule RNA FISH (smFISH) 23 as well as on standard immuno uorescence images, and that wide eld microscopy coupled with DW can surpass confocal imaging quality.We showcase the technical performance of DW using crowded images generated by smFISH and by the iFISH method that we previously developed for visualizing DNA loci and chromosome territories at high resolution 24 .By applying DW to smFISH images of a breast cancer tissue core in a tumor microarray, we show that individual transcripts can be resolved and accurately counted even when images are acquired using a low magni cation (20x) air objective.Finally, we address the challenge of imaging-based spatially resolved omic methods that rely on the colocalization of (near-)diffraction limited uorescent dots generated through multiple rounds of in situ sequencing 13,14,17,19,20 .We apply DW to two of these methods-ISST 17 and OligoFISSEQ 13 demonstrating that DW drastically improves the resolution and amount of information that can be obtained with these high-throughput methods.In summary, DW is a user-friendly tool that can nd numerous applications in bioimaging and greatly improve the sensitivity and spatial resolution of imaging-based spatially resolved omics.

DW implementation and benchmarking
DW is a publically available, open-source software that can be run on a laptop computer and features an intuitive interface through which multiple z-stacks or whole-slide images can be processed after specifying a few intuitive parameters (Fig. 1a).DW builds on the Richardson-Lucy (RL) method 4,5 with three crucial improvements: (i) a highly e cient implementation of the Biggs acceleration method 25 to reduce the number of required RL iterations; (ii) a high precision point spread function (PSF) calculator; and (iii) automatic lateral and axial boundary handling with minimal artifacts (Methods).The entire DW package is freely available under a GPL3 license at https://github.com/elgw/deconwolf/.
We rst tested whether the Biggs acceleration module in DW improves deconvolution as compared to Huygens (HG) and DeconvolutionLab2 (DL2), which are considered Reference deconvolution tools.To this end, we used a synthetic image of microtubules (http://bigwww.ep.ch/deconvolution/data/microtubules/)that was previously used to benchmark DL2 against HG.Using the RL algorithm implemented in DW (with Biggs acceleration turned off, see Methods) and comparing the deconvolved image to the ground truth image, the smallest mean squared error (MSE) was 1.4 × 10 5 at 1,500 iterations, whereas adding Biggs acceleration yielded the same MSE using only 115 iterations (Fig. 1b-d).We then used the same image to benchmark DW against DL2 and HG.The sharpness and contrast of the image deconvolved by DW were clearly superior compared to the same image processed by DL2 using the same number (115) of iterations or by HG, as judged by eye as well as based on the MSE (1.4 × 10 5 , 2.3 × 10 5 , and 2.1 × 10 5 for DW, DL2, and HG, respectively) (Fig. 1e, f and Supplementary Fig. 1a).Notably, performing the same number (115) of iterations with DW was ~16 times faster than using DL2 (on an 8-Core AMD Ryzen 7 3700X machine).We predict that reaching the same MSE (1.4 × 10 6 ) achieved by DW using DL2 on the same machine would require 1,500 iterations and ~4 hours, whereas this only took 115 iterations and 52 sec with DW-a ~200-fold decrease in computing time.This dramatic difference in deconvolution speed depends mostly on the use of Biggs acceleration in DW, but also on the FFTW3 Fast Fourier Transform (FFT) library 26 used in DW as opposed to AcademicFFT 27 , which is used by default in DL2 (Methods).Similarly, DW outperformed DL2 both in quality and speed when applied to a C. elegans whole-embryo image or to an image of a synthetic hollow bar available from the same source 28 as the microtubule image described above (Supplementary Fig. 1bf and Methods).These results demonstrate that the combination of Biggs acceleration and FFTW3 in DW drastically improves both the quality and the speed of deconvolution compared to the reference opensource deconvolution software DL2, rendering routine deconvolution of uorescence microscopy images a practical option.
The second key feature of DW is the use of a PSF calculator (PC) based on the Born-Wolf (BW) model 29 , which integrates over the sensor pixels (collecting all photons) instead of only sampling the pixels at their center as in the gold-standard tool for PSF calculation-the PSF Generator (PG) 30 -thus theoretically resulting in higher localization precision (Methods).To benchmark PC against PG, we used the PSFs generated by both tools (using the same optical settings and PSF size) as an input to DW, to deconvolve microscopy images previously generated by OligoFISSEQ 13 .These images contain multiple (near-)diffraction limited uorescence dots corresponding to the DNA loci targeted by OligoFISSEQ (Supplementary Fig. 2a and Methods).In the images deconvolved using the PC tool implemented in DW, the uorescent dots were more distinguishable in the (x, y) plane compared to the dots in the images deconvolved using PG (Fig. 1g, h and Supplementary Fig. 2b, c).Accordingly, the size of the uorescence dots was signi cantly smaller in the former compared to the latter images (full width at half maximum, FWHM: 439.9 ± 79.7 nm vs. 477.4± 87.1 nm, mean ± s.d.P value: 1.3 × 10 −29 , Wilcoxon test, two-tailed) (Fig. 1i), which in turn resulted in higher resolvability of OligoFISSEQ dots when using the PC tool.Altogether, these results demonstrate that the implementation of the BW model in the PC tool used by DW outperforms the PSF Generator.
The third key feature of DW is the implementation of a method for handling image boundary effects originally developed in astrophysics 31 , which considers the outside of an image as missing data in contrast to standard boundary handling (BH) methods that either use an explicit guess of what is outside of the imaged region (padding) or that treat the image boundary circularly (with or without apodization) (Methods).To benchmark the BH method implemented in DW (DW-BH), we rst assessed how it performs in comparison to any of the ve BH methods implemented in DL2 (DL2-BH), using the same C. elegans whole-embryo image described above and the same number of iterations (50).The images deconvolved using DW-BH were much sharper and resulted in considerably fewer lateral boundary artifacts compared to the images processed using the default DL2-BH or any of the other BH methods available in DL2 (Fig. 2a, b and Supplementary Fig. 3a-f).We then assessed the ability of DW-BH to handle boundary effects that may arise during the deconvolution of z-stacks, particularly when an object is only partially imaged along the z-direction.To this end, we deconvolved a z-stack image of adherent human HAP1 cell nuclei stained with the DNA dye Hoechst 33342, either using DW-BH or DL2-BH.The latter-but not DW-BH-introduced clearly visible image distortions along the z-axis, even when using 8 times more iterations (Fig. 2c-f and Supplementary Fig. 4a-c).Notably, these artifacts were only partially prevented by using the padding option in DL2 (Fig. 2f) and became much more pronounced when we cropped the bottom focal planes to mimic a scenario frequently encountered in uorescence microscopy experiments-where an object is not imaged entirely along the z-axis (Fig. 2g-j).Accordingly, while this had a modest effect on the uorescence intensity pro le along the z-axis of the images deconvolved with DW, the same procedure drastically changed the z-pro le of the images deconvolved by DL2 (Fig. 2k).To further highlight the ability of DW to avoid boundary effects, we compared a z-stack image of HAP1 cells immunostained for histone H3 tri-methylated on lysine 27 (H3K27me3) before and after cropping the bottom focal planes.The maximum z-projections of the full and cropped stack processed by DW nearly perfectly overlapped, whereas the z-projections of the stacks deconvolved with DL2 showed largely different patterns (Fig. 2ln).Altogether, these results demonstrate that DW outperforms DL2 both in terms of quality and delity of the deconvolved images generated, as well as in terms of the time required to generate them.

DW generates images comparable in quality to those obtained with confocal microscopy
To further assess the reliability of DW, we next sought to compare it with confocal microscopy, considering images generated with the latter as the ground truth.To this end, we imaged the same region of a human brain tissue section stained with an antibody against the glial brillary acidic protein (GFAP) -which marks multiple branched structures localized in the cytoplasm of astrocytes, glial, and ependymal cells in the brain-using both a wide eld and confocal microscope (Methods).As expected, the confocal images were sharper and had more structural details compared to the non-deconvolved wide eld images acquired in the same tissue region using similar optical magni cation (60x for wide eld and 63x for confocal) (Fig. 3a).However, when we deconvolved the same wide eld images using DW, the GFAP pattern became considerably sharper and more resolved, matching the pattern visible in the corresponding confocal images (Fig. 3a and Supplementary Fig. 5a).In fact, the wide eld images processed by DW displayed more ne structural details compared to the corresponding confocal images, especially when they were acquired with a higher magni cation objective (100x), which is frequently the case in wide eld imaging as opposed to confocal (Fig. 3b and Supplementary Fig. 5b).Notably, neither DL2 nor HG were able to closely match the quality and level of structural details obtained by applying DW (Supplementary Fig. 5c).Importantly, wide eld imaging was 210 times faster compared to using a confocal microscope (~10 vs. 2,100 sec per eld of view, respectively).Altogether, these results highlight the power of DW and suggest that wide eld microscopy combined with image deconvolution by DW can outperform confocal imaging in terms of costs and speed, while providing results of comparable, if not superior, quality.

DW enables in silico separation of individual transcripts in crowded smFISH images
Motivated by these results, we then explored whether DW could be used to increase the spatial resolution -and therefore the throughput-in high-resolution smFISH and DNA FISH experiments, which often generate images with spatially crowded (near-)diffraction limited uorescence dots.To this end, we rst generated in silico z-stack images containing different densities of diffraction limited uorescence dots, including a noise component to simulate real smFISH images (Methods).Again, DW clearly outperformed DL2 even when the number of iterations was twice as high in DL2 compared to DW, allowing to identify and count diffraction limited dots even in highly crowded images (~4 dots per mm 3 , which corresponds to ~17,000 dots in a 20 mm diameter spherical cell) (Fig. 4a-e and Supplementary Fig. 6a-e).We then assessed whether DW would also help resolve crowded transcripts in real smFISH images acquired with a wide eld microscope.To this end, we performed smFISH with a probe targeting GAPDH gene transcripts in human SKBR3 breast adenocarcinoma cells (Supplementary Table 1 and Supplementary Methods).As expected, the GAPDH gene was expressed at very high levels in most of the cells, and the corresponding smFISH dots were often too crowded to be resolved by eye in non-deconvolved (raw) images (Fig. 4f).However, when we deconvolved the images with DW, the resolution drastically improved, making individual dots become visible even in very crowded regions (Fig. 4g and Supplementary Fig. 7a).This, however, was not the case when we used DL2 or HG for deconvolution (Supplementary Fig. 7b, c).
To quantitatively assess the performance of DW on these crowded smFISH images (Supplementary Fig. 7a, d), we applied our in-house software DOTTER, which is speci cally tailored for detecting diffraction limited dots in smFISH and high-resolution DNA FISH images (Methods).In images processed by DW, DOTTER managed to detect individual transcripts simply based on their uorescence intensity, whereas this was not possible in the original (raw) images, where instead a signi cantly higher (P = 3.16 × 10 −7 , t-test, two-sided) number of dots was detected, especially in very bright regions (Fig. 4h, i and Supplementary Fig. 8a-c).In these regions, the high local concentration of dots produces high levels of blurred or out-of-focus light, elevating nearby dim signals and making it hard to differentiate true from false positive dots (Fig. 4h, i and Supplementary Fig. 8a, b).Indeed, the dots detected by DOTTER in the images deconvolved with DW showed a narrow size distribution characteristic of smFISH signals 23 , whereas the dots identi ed in the corresponding raw images had a broader size distribution, suggesting that many of them represented false positive signals (Supplementary Fig. 8d, e).
To con rm the ability of DW to resolve smFISH signals in crowded images, we used a different dot detection procedure (difference of Gaussians or DoG), which is also implemented in DOTTER (Methods).
In this case, the number of dots detected by DOTTER was signi cantly lower (P = 3.66 × 10 −5 , t-test, twosided) in the raw images compared to those deconvolved with DW (Supplementary Fig. 8c).Importantly, both the intensity-based and the DoG-based dot identi cation approaches yielded very similar dot counts in the case of deconvolved images (Supplementary Fig. 8c).Furthermore, the size distribution of the dots detected using the DoG approach was still considerably broader for the raw images compared to the same images after deconvolution, suggesting that many of the dots detected in the former represent false positive signals (Supplementary Fig. 8f, g).Accordingly, the corresponding distribution of counts per eld of view (FOV) was signi cantly different in the case of raw images analyzed using the DoG approach compared to the images deconvolved with DW and analyzed by any of the two dot detection methods, further showcasing the robustness of DW (Supplementary Fig. 8h).These results demonstrate that DW can dramatically improve the sensitivity and speci city of smFISH, particularly when highly expressed genes are targeted.
DW resolves densely packed individual DNA loci in crowded DNA iFISH images Next, we assessed the performance of DW on crowded images of DNA loci visualized using highresolution DNA FISH.To this end, we used our previously developed iFISH method 24 to simultaneously visualize 63 DNA loci in different A/B chromatin sub-compartments 32 along chromosome (chr) 16, using wide eld microscope (Supplementary Fig. 9a, Supplementary Table 2, and Methods).In the raw images or in the images deconvolved by DL2 or HG, the iFISH signals in the cell nuclei appeared as clouds of poorly distinguishable uorescence dots, corresponding to individual chromosomal territories (Fig. 4j and Supplementary Fig. 9b).In contrast, after deconvolution of the raw images by DW, the dots representing individual DNA loci became clearly separated and, as a result, the dot counts per nucleus were signi cantly higher, closer to the expected number of dots per cell (Fig. 4k, l and Supplementary Fig. 9a, ce).Notably, the deconvolution process resulted in the loss of large and poorly contrasted dots and, at the same time, in the gain of dots with a FWHM close to the mean-representing bona de iFISH signalswhich were not detected in the non-deconvolved raw images (Fig. 4m, n and Supplementary Fig. 9f-k).These results demonstrate that DW can drastically improve the speci city and spatial resolution of iFISH, allowing the simultaneous visualization and localization of many individual DNA loci within the same chromosomal territory.

DW enables high throughput smFISH in tissue sections
Having demonstrated the ability of DW to resolve crowded (near-)diffraction limited dots in smFISH and iFISH images, we then wondered whether DW would also enable the detection of individual transcripts in smFISH images acquired at low magni cation (20x air objectives).To test this, we targeted the mRNA product of the MKI67 gene (also known as Ki-67)-a cell proliferation marker often used in pathology-in a tumor microarray and imaged an entire tissue core from a breast carcinoma sample using a wide eld microscope (Supplementary Table 1 and Supplementary Methods).As expected, individual transcripts were poorly distinguishable in non-deconvolved (raw) images acquired at 20x magni cation (Fig. 5a, b).However, when we deconvolved the same images by DW, the contrast drastically improved, making individual transcripts clearly visible throughout the entire core (Fig. 5a, b).Importantly, the same spatial patterns of Ki-67 transcripts observed in the 20x deconvolved images were recapitulated in both raw and deconvolved images from the same FOVs but acquired at higher magni cation (60x oil objective) (Fig. 5c and Supplementary Fig. 10a).
We then assessed whether robust automatic detection and counting of individual transcripts would be feasible in images acquired using a 20x air objective.We rst applied DOTTER to the same Ki-67 smFISH images but did not manage to automatically identify a proper threshold for distinguishing real signals from noise, most likely because of the lower signal-to-noise ratio (SNR) when smFISH is performed on tissues.We therefore devised a different approach by plotting the SNR against the intensity of hundreds of thousands of uorescence dots identi ed by DOTTER in the images (Methods).Except for nondeconvolved (raw) 20x images, this approach revealed two clearly distinct point clouds: one corresponding to high-quality (HQ) smFISH dots with high SNR and intensity-most likely representing true signals-and the other corresponding to low-quality (LQ) smFISH dots with lower intensity and low-tointermediate SNR-most likely representing noise (Fig. 5d-g and Supplementary Fig. 10b-e).In all the images, except for 20x raw ones, the boundary between the two clouds corresponded to a local minimum clearly visible in the density plots of the uorescence intensity of the DoG-ltered dots (Fig. 5d-g and Supplementary Fig. 10b-q).We therefore used this local minimum to set a threshold to automatically identify HQ dots in the 60x as well as in the 20x deconvolved images.For 20x raw images, we selected the lower-density tail of the point cloud as containing HQ dots (Fig. 5g and Supplementary Fig. 10n-q).In ve FOVs analyzed, 91.6% of the HQ dots identi ed in the raw images at 60x magni cation matched the HQ dots found in the corresponding deconvolved images (Supplementary Fig. 11a-e).Conversely, 94.1% of all the HQ dots identi ed in the deconvolved images overlapped with the HQ dots in the corresponding raw images, suggesting that these represent true positive signals (Supplementary Fig. 11a-e).We then used the HQ dots shared between raw and deconvolved 60x images as reference and found that 58.3% (n = 8,105) of the HQ dots in the 20x raw images did not match the reference dots, suggesting that they represent false positive signals (Supplementary Fig. 11f-j).In contrast, 81.3% (n = 6,313) of the HQ dots identi ed in the 20x deconvolved images matched the reference dots (Supplementary Fig. 11f-j).Of note, the HQ dots identi ed in the deconvolved images displayed the narrowest size distribution, further suggesting that they represent true positive signals (Supplementary Fig. 11k, l).Altogether, these results demonstrate that wide eld imaging using low magni cation (20x air) objectives, followed by deconvolution with DW, can be used to visualize and reliably count thousands of transcripts across large tissue sections, including sections of clinically relevant samples.

DW improves the sensitivity of in situ spatial transcriptomics
Having demonstrated that DW drastically improves the sensitivity and speci city of dot detection in both crowded and low magni cation smFISH images, we wondered whether it could also improve signal detection in images generated by in situ spatial transcriptomics (ISST) 17 .To this end, we applied DW to an image dataset previously generated by ISST to simultaneously detect 120 genes in a large tissue section of the human middle temporal gyrus (MTG) cortex, using ve consecutive cycles of in situ ligation and imaging with four uorescence channels 17,33 (Supplementary Table 3).Decoding of each individual transcript in this dataset requires that ve signals ((near-)diffraction limited uorescent dots) originating from consecutive imaging rounds are spatially colocalized (Methods).We rst examined how the number of detected dots varied across a broad range of uorescence intensity thresholds, in both non-deconvolved (raw) images as well as after deconvolution with DW.For thresholds lower than 0.1%, the number of assigned (A) and unassigned (U) dots-i.e., dots with a correctly or incorrectly decoded barcode, respectively-was comparable between raw and deconvolved images (Fig. 6a, b).The dots detected in the latter on average also had a higher quality score (Fig. 6b).For thresholds comprised between 0.1% and 2%, the number of U dots decreased sharply, while the quality score of A dots sharply increased in both raw and deconvolved images, plateauing at a threshold of 2% in the latter (Fig. 6a, b).
Above this threshold, the ISST automatic dot detection pipeline started discarding true signals instead of noise, causing a sharp decline in the number of dots detected for thresholds above 10%, especially in the case of raw images (Fig. 6a).Hence, we used a threshold of 2% for all subsequent analyses.
Next, we quantitatively assessed the effect of DW on the number of transcripts correctly decoded and on cell type calling, which is based on which transcripts are expressed in each cell.Across the MTG cortical section pro led by ISST, we observed a ~3.4-fold increase in the number of transcripts identi ed in images deconvolved with DW in comparison to raw ones (328,437 and 96,934, respectively) (Fig. 6c).The decoded transcripts were distributed along a gradient decreasing from the supragranular to the infragranular extremity of the cortical section, and the transcript counts remained strongly correlated between deconvolved and raw images throughout the length of the section (Supplementary Fig. 12a).
Only one target gene, SMYD1, showed a 50% reduction in transcript counts upon deconvolution of the images, perhaps related to the fact that this gene was very lowly expressed.We then annotated different cell types based on the relative expression of each of the 120 pro led genes in individually segmented cells (Methods).The number of cells being successfully annotated increased from 55-75% after applying DW, thanks to the substantially higher number of cell-type speci c genes identi ed in deconvolved images (Fig. 6d and Supplementary Fig. 12b-d).Together, these results demonstrate that DW can considerably improve the sensitivity of target detection and the e ciency of cell type calling in ISST experiments.Therefore, we propose that DW is incorporated into existing ISST analysis pipelines to facilitate multiple applications of this powerful technology.

DW dramatically improves the detection sensitivity in OligoFISSEQ
Lastly, we sought to determine whether DW could also improve the detection sensitivity of OligoFISSEQ 13 , a microscopy-based multiplexed method that enables the reconstruction of DNA trajectories by labeling multiple DNA loci with Oligopaint FISH probes 34 , followed by multiple cycles of in situ sequencing (ISS) to decode the barcodes embedded in the oligos.Like ISST, OligoFISSEQ depends on the colocalization of (near-)diffraction limited uorescent dots generated from the same target locus during multiple rounds of in situ sequencing.Importantly, even though OligoFISSEQ barcodes include redundancies to maximize their detection, the method remains sensitive to the colocalization procedure used to detect the barcodes.
We therefore tested the potential of DW to overcome this issue, by using a previously generated OligoFISSEQ image dataset consisting of 46 DNA loci along chrX that had been visualized together in the same cells using ve ISS cycles 13 (Methods).Visual inspection of the images in the original dataset revealed the presence of densely packed clouds of uorescence dots in different colors inside each nucleus.Notably, these dots had been only partially resolved by applying a commercial deconvolution software (Nikon NIS Elements AR), which is incorporated in the OligoFISSEQ image processing pipeline (Fig. 7a).To test whether DW would generate more resolved images and improve barcode decoding in OligoFISSEQ, we applied it to the same image dataset, which rendered individual uorescence dots inside each cloud clearly visible (Fig. 7a).As a result, the e ciency of OligoFISSEQ barcode detection (i.e., the fraction of the 46 barcodes identi ed in each cell) dramatically increased from 74.1 ± 1.1% (mean ± s.d.) to 97.2 ± 0.5% (mean ± s.d.) after applying DW (Fig. 7b), demonstrating the ability of DW to augment the e ciency with which OligoFISSEQ can detect and count genomic targets.Importantly, when using the original OligoFISSEQ image processing pipeline 13 , a considerable fraction of the barcodes was consistently detected at a lower frequency (Fig. 7c).In contrast, all the barcodes were detected with similarly high e ciency using DW instead of the NIS software to deconvolve the OligoFISSEQ images (Fig. 7c).
We then applied the same chromosome tracing pipeline that was previously developed to reconstruct chromosome trajectories from OligoFISSEQ data 13 , using the coordinates of the uorescence dots identi ed in the images deconvolved by DW as input.The increase in barcode detection e ciency enabled by DW yielded, for the rst time, multiple complete chrX traces for which no interpolation of missing targets was required (Fig. 7d).Such fully decoded traces featured more nodes compared to the single-cell traces reconstructed from OligoFISSEQ images deconvolved with the NIS software (Fig. 7e-h).
To quantitatively compare the chromosome traces reconstructed after applying the NIS software or DW, we compared the contact frequency between the 46 DNA loci visualized by OligoFISSEQ (calculated at different threshold distances for calling two loci as being in contact) with the contact frequency between the same loci assessed by Hi-C 35 .The 3D chromosome traces reconstructed from OligoFISSEQ images deconvolved with DW displayed a consistently higher correlation with Hi-C data compared to the traces reconstructed from images deconvolved with the NIS software, for every distance threshold used to call a pair of DNA loci as being in contact (Fig. 7i).Furthermore, the contact frequency map obtained using OligoFISSEQ images deconvolved with the NIS software was nosier and showed higher contact frequency values near the diagonal, compared to the contact frequency maps generated from OligoFISSEQ images deconvolved with DW or compared to Hi-C maps (Fig. 7j, k).Altogether, these results demonstrate that DW can greatly improve the barcode detection e ciency in OligoFISSEQ experiments, and consequently the delity of chromosome topology reconstructions, further highlighting the performance and broad applicability of our software.

Discussion
We have developed a user-friendly, open-source, freely accessible deconvolution software-Deconwolf (DW)-and shown that it outperforms two of the most commonly used deconvolution tools-DeconvolutionLab2 (DL2) 2 and Huygens (HG)-both in terms of quality and delity of the deconvolved images, and in terms of computational speed.The Biggs acceleration method implemented in DW will enable researchers to achieve stunning results in realistic times-hours to days for large image datasets that would otherwise take weeks or months to be processed with DL2 or HG-making our software suitable for deconvolving terabyte image data generated by high-throughput imaging-based spatially resolved omic methods that are being applied in the frame of large-scale initiatives such as the Human Cell Atlas (https://www.humancellatlas.org/).Of note, the deconvolution speed in DW could be further accelerated using graphics processing units (GPUs).
Importantly, DW managed to solve the two major limitations of conventional wide eld uorescence microscopy-the inability to resolve crowded signals and the need for high NA objectives to detect (near-)diffraction limited signals-unlike DL2 and HG.Thanks to DW, we managed to reliably identify and count individual transcript molecules even in highly crowded smFISH images and in tumor tissue sections imaged with a 20x magni cation air objective, representing a signi cant advance in the eld.Thus, DW dramatically increases the sensitivity and throughput of smFISH and other high-resolution imaging methods that produce (near-)diffraction limited uorescent signals, potentially making these techniques applicable to diagnostics.Previous attempts aiming at improving the resolvability of crowded signals in smFISH and imaging-based spatial transcriptomics experiments relied either on superresolution or on expansion microscopy or on a combination of both [36][37][38][39] .Here we have shown that the same, if not superior resolution can be achieved using a simple wide eld microscope setup together with DW installed on a laptop computer.Crucially however, while super-resolution and expansion microscopy methods have limited throughput (i.e., the tissue area and number of single cells that can be effectively images is limited), this is not the case for wide eld microscopy combined with DW.Importantly, since DW is blind to the type of uorescence signal in the images analyzed, it should also improve the processing of large tissue scans obtained with high-throughput immuno uorescence methods, such as CO-Detection by indEXing (CODEX) 40 , that are now broadly deployed to investigate the spatial organization of tumor immune in ltrates 41 .
Even though it is generally believed that confocal imaging is superior to wide eld microscopy in many applications, we have shown that DW can be routinely applied to enhance the sharpness and contrast of images in wide eld uorescence microscopy experiments, yielding comparable results more than 200 times faster than with confocal imaging.Considering that a confocal microscope is at least three times more expensive than the wide eld microscope setup that we have used in this study, DW makes wide eld uorescence microscopy a truly competitive technology that many research and diagnostic labs could afford.Moreover, the use of light emitting diodes in wide eld microscopes, as opposed to lasers in the case of confocal microscopes, enables safer imaging, especially in live-cell imaging experiments.
In conclusion, DW represents a transformative deconvolution tool that can be routinely applied across many elds in the life sciences and biomedicine to increase the amount of biologically meaningful information retrieved from imaging data generated by many techniques that rely on uorescence detection using wide eld microscopy, including imaging-based spatially resolved omic methods that generate (near-)diffraction limited signals.We therefore anticipate that DW will become broadly adopted and nd numerous applications in both research and diagnostics.

Methods
A description of all the experimental methods used to generate the images analyzed in this study is available in the Supplementary Methods.
Deconwolf DW is based on the Richardson-Lucy (RL) method 4,5 and on the Biggs exponential vector extrapolation technique 25 together with a positivity constraint.Furthermore, DW implements an image boundary handling approach originally developed in astrophysics 31 , which extends the image and treats what is outside of it as missing information.This approach makes it possible to process large images in tiles, with minimal artifacts.DW is written in the C programming language, uses the FFTW3 package 26 for fast Fourier transforms, and utilizes savings in memory and speed, given that the images are real and not complex.All internal computations are done using 32-bit oating point precision regardless of the input and output formats.DW can read and write TIFF stacks of either 16-bit unsigned integers or 32-bit oating point data.FFTW3 is already fully parallelized and further parallelization is enabled by using the lpthread and OpenMP libraries.DW can be run as a command line interface (CLI) or accessed from a GUI (https://github.com/elgw/deconwolf-gui)written in in C using GTK.The entire DW package, including extensive usage documentation, is available at https://github.com/elgw/deconwolf/. Below, we describe some of the key features of DW in detail.
Point spread function (PSF) calculator.There are a multitude of PSF models available for wide eld microscopy (reviewed in 42 and discussed in Supplementary Note 1).For convenience, DW is equipped with a PSF calculator (PC) based on the Born-Wolf (BW) model 29 .The derivation of the BW model is based on several assumptions, including ideal imaging conditions, which in practice can never be achieved.Nevertheless, we have found this model to perform very well on all the images that we have tested.In DW, we rasterize the PSF by integrating over the lateral extent of each pixel, i.e., assuming that each sensor pixel is a perfect square and that no additional low pass ltering is present in the system.In contrast, the previously described PSF Generator tool (PG) 30 only samples the PSF at the center of each pixel, which can be problematic as under the BW model the PSF (at normal pixel sizes) cannot be sampled densely enough according to the Nyquist-Shannon sampling theorem.To achieve high performance, DW pre-computes the BW integral for a discrete set of radii (r) at all relevant depths (z), inspired by PG.Then, using radial symmetry, the BW integral can be interpolated for any (x, y, z) from the pre-computed values.While PG uses linear interpolation, DW interpolates the radial pro le using Lanczos-3 interpolation assuming symmetry around r = 0. We found that a 61-point Gauss-Kronrod rule worked very well for the BW integral while a 15-point Gauss-Kronrod rule was faster when integrating over pixels.
For numerical integration, DW uses the GNU Scienti c Library 43 , while the code is parallelized using POSIX Threads.
Processing of large images and parallelization.DW can process large images, such as whole-slide images, even on a laptop computer, since the software is able to read/write a small portion of the images on demand.Internally this is handled by tiling, i.e., the image is broken up into partially overlapping tiles that are deconvolved one by one.For parallelization, DW can be run using one or more threads per image.Several instances can be run in parallel, and the e ciency of parallelization entirely depends on the machine used.

Generation of in silico smFISH images
To generate ground truth in silico smFISH images, we started with volumetric images of size 255 × 255 × 40 pixels (px) where each pixel is a square of 130 × 130 × 130 nm.We generated diffraction limited dots by placing Gaussian blobs with a total intensity of 10,000 and a sigma of 0.7 px at random locations with sub-pixel accuracy (i.e., we integrated the Gaussians over each pixel).We then added a constant background of intensity equal to 1,000.To emulate a real smFISH image, we convolved the ground truth image with the PSF generated by DW based on the BW model and then added Poissonian noise.Lastly, we added Gaussian noise with a sigma of 10 to simulate sensor noise.

Dot in smFISH and iFISH images
To detect uorescence dots in and iFISH images, we used our in-house analysis suite DOTTER (available at github.com/elgw/dotter)written in MATLAB (R2020a) and C99 with GSL (https://www.gnu.org/software/gsl/), which is speci cally designed to detect (near-)diffraction limited dots in smFISH and iFISH images.Brie y, we detected all local maxima in the images using a 6connectivity, i.e., we considered a pixel as a local maximum only if it was brighter than its face neighbors.We then ranked the identi ed dots either based on their brightness (intensity-based dot detection) or their value after ltering the image with a difference of Gaussians (DoG based dot detection).

Comparison of dots identi ed in iFISH images before and after deconvolution with DW
To compare the number and features of the dots identi ed by DOTTER in iFISH images before (raw) and after deconvolution with DW, we used a custom script written in MATLAB (R2020a), which, for every dot in a raw image, searches for the nearest dot in the corresponding deconvolved image and vice versa.
Brie y, we looped through each segmented nucleus in the raw and deconvolved images and extracted the 3D coordinates of each dot, separately for each of the four uorescence channels corresponding to different subsets of the 63 iFISH probes targeting 63 DNA loci in different A/B subcompartments along chr16 (see Supplementary Fig. 9a).We excluded nuclei in which no dots were found in the raw or in the deconvolved or in both images.For each nucleus and channel, we used the knnsearch function in MATLAB to nd, for every dot detected in a raw image, the nearest neighbor dot in the corresponding deconvolved image (labeled as 'Raw&DW') and vice versa ('DW&Raw'), using a threshold of 260 nm (i.e., two dots closer than 260 nm were considered as matching between raw and deconvolved images).We labeled the dots identi ed in the raw, but not in the corresponding deconvolved images, as 'Lost', whereas we labeled as 'New' the dots identi ed in the deconvolved images but not in the corresponding raw ones.
For each dot group, we then plotted the distributions of the full width at half maximum (FWHM) value and normalized signal-to-noise ratio (NSNR) ratio of the dots (see Fig. 4m, n and Supplementary Fig. 9f-Quanti cation of in low magni cation images from a TMA We imaged ten elds of view (FOVs) of a breast adenocarcinoma tissue core in a TMA on which we performed smFISH with a probe targeting Ki-67 gene transcripts (see Supplementary Methods), using a wide eld inverted epi uorescence microscope (Nikon Ti-E) with a 20x air objective (Nikon CFI Plan Apo VC 20X).For a subset of the regions imaged with the 20x objective we also acquired images using a 60x oil objective (Nikon CFI Plan Apochromat Lambda 60XC).We detected dots in all the images at both magni cations using the DoG based dot detection module in DOTTER (see above).We generated 2D nuclear segmentation masks for each FOV at 60x magni cation using a random forest classi er that we previously trained on pixel features (available at https://github.com/elgw/pixelClassier) and an ad hoc Python script available at https://github.com/ggirelli/deconwolf-tissue-smFISH.We assigned voxels within the intersection of nuclear masks to the nucleus with the closest border in the original mask.We then rescaled the masks to a resolution matching the corresponding FOV imaged at 20x magni cation using the skimage.transform.rescalefunction in Python.We discarded from the mask any object with a size below 1,500 voxels and assigned the smFISH dots detected by DOTTER to each mask based on their 2D coordinates.We selected dots with a FWHM between half and 5 voxel sides and rescaled the intensity of the dots based on a rescaling factor reported in the corresponding Deconwolf log le.To distinguish between bona de transcripts and likely false positive dots, we ltered the dots based on a threshold intensity corresponding to a visual local minimum in the log-transformed DoG-ltered intensity distribution of all the dots in each FOV.To compare the locations and counts of the dots identi ed in the same FOV imaged at 60x or 20x, we rst applied an ad hoc MATLAB script (available at https://github.com/ggirelli/deconwolf-tissue-smFISH) to nd the best translation between the corresponding images and to minimize the local pairwise distances by allowing deformations according to a second order polynomial.We then quanti ed the percentage of dots identi ed at 60x magni cation (for raw and deconvolved images) that were also detected in the corresponding 20x FOV, and vice versa.

ISST image and cell typing
We retrieved z-stack images from an ISST dataset, which we previously generated to visualize 120 different gene transcripts in a tissue section from the human middle temporal gyrus of a 38-year old male donor affected by epilepsy 33 .To decode individual transcripts in images before (raw) or after deconvolution with DW, we used an in-house pipeline (available at https://github.com/Moldia/iss_starsh/), which incorporates the Star sh package 44 (available at http://github.com/spacetx/star sh).In short, we rst aligned images of the same FOV obtained at each hybridization-imaging cycle and stitched multiple FOVs together using the Microscopy Image Stitching Tool (MIST) 45 .We then used the FindSpots module in Star sh with a masking radius of 15 to localize individual transcripts.We changed the thresholding parameter-which speci es the absolute lower bound for scale space maxima-to compare between deconvolved and raw images.Finally, we used probabilistic cell typing 46 to assign cells to one of 18 brain cell types previously described 47 , based on the type and abundance of transcripts detected in each segmented cell.to generate the plot in (i), either calculated using the Born-Wolf (BW) model 29 implemented in DW (g) or using the PSF Generator (PG) 30 (h).The plots on the bottom are 3D renderings of the corresponding 2D heatmap shown on the top.(i) Full width at half maximum (FWHM) value of (near-)diffraction limited uorescence dots in images previously generated by OligoFISSEQ 13 (corresponding to individual genomic loci), deconvolved either using the PSF shown in (g) or the one shown in (h).The dashed red line represents the bisector of the angle between the plot axes.Each grey dot corresponds to one OligoFISSEQ dot for which we measured the FWHM.As it can be seen, with few exceptions, the FWHM is consistently higher using the PSF calculated using PG than the one calculated using the BW model implemented in DW. n, number of dots analyzed.The red rectangle highlights the image deconvolved with DW.  (corresponding to ~17,000 transcripts for a spherical cell 20 mm in diameter) (see Methods).The 10 middle focal planes were used to make the z-projection, while all the planes were used for the quanti cations shown in (e).Same as in (a), but after applying noise to the image to simulate a real image that would be obtained by applying smFISH to visualize the transcripts of a highly expressed gene (see Methods).dots detected in raw images, but not after applying DW.DW&Raw: dots detected after applying DW, that were also present in the corresponding raw images.Raw&DW: dots detected in the raw images that were also detected in the corresponding images after deconvolution with DW (see Methods).n, number of dots analyzed.(n) Same as in (m) but for normalized signal-to-noise ratio (NSNR) values of the DNA FISH dots.In all the boxplots in (l-n), each boxplot extends from the 25th to the 75th percentile, the horizontal bar represents the median, and whiskers extend from -1.5×IQR to +1.5×IQR from the closest quartile, where IQR is the inter-quartile range.Grey dots, outliers.The red square and rectangles highlight the images deconvolved with DW.Absolute dot counts at different normalized intensity thresholds before (Raw) and after deconvolution with DW, using images from a previously described ISST dataset consisting of 120 different genes imaged in a tissue section of human middle temporal gyrus (MTG) cortex 33 .A, assigned dots representing bona de individual transcripts identi ed based on the same pipeline previously used to process the same ISST dataset 33  shown in (c).To assign each cell to a speci c cell type we used the probabilistic cell typing method that we previously developed 46 .The cell type nomenclature used is the same as the one described in ref. 47 .VIP, vasoactive intestinal peptide expressing neurons.SST, somatostatin expressing neurons.PVALB, parvalbumin expressing neurons.OPC, oligodendrocyte precursor cells.

Figures
Figures

Figure 1 Implementation
Figure 1

Figure 4 Deconwolf
Figure 4 (c) Same as in (b), but after deconvolution with DW (100 iterations, it).(d) Same as in (b), but after deconvolution with DeconvolutionLab2 (DL2).(e) Percentage of dots detected after applying DW or DL2 with different numbers of iterations (it) to in silico generated smFISH images such as the one shown in (a).(f) Maximum z-projection of a eld of view (FOV) of SKBR3 human breast carcinoma cells stained with an smFISH probe targeting GAPDH gene transcripts (white) and imaged on a wide eld microscope using a 100x objective.Blue, DNA stained with Hoechst 33342.The region in the black dashed square in the top panel is magni ed in the middle panel, and the region in the dashed rectangle in the middle panel is magni ed in the bottom panel.Scale bars, 20 mm in the top panel and 5 mm in the middle panel.(g) Same as in (f), but after deconvolution with DW.(h) Zoom-in view of one region in the image shown in (f), with GAPDH transcripts identi ed by DOTTER (based on uorescence intensity) encircled in red.(i) GAPDH transcripts identi ed by DOTTER (based on the uorescence intensity) in the same region in (h) after deconvolution of the corresponding image with DW. (j) Maximum z-projection of a FOV of HAP1 human myeloid leukemia cells subjected to iFISH with probes targeting 63 different DNA loci located in different A and B chromatin subcompartments along chromosome (chr) 16 and imaged on a wide eld microscope using a 100x oil objective.Grey, DNA stained with Hoechst 33342.Scale bar, 10 mm.See Supplementary Fig. 9a for the location of probes along chr16.(k) Same as in (j), but after deconvolution with DW. (l) Distributions of the total number of iFISH dots per nucleus for loci located in the A1 subcompartment, in images of which (j) and (k) are representative examples.P, Wilcoxon test, twotailed.n, number of cells analyzed.(m) Distributions of the full width at half maximum (FWHM) values of the dots corresponding to DNA loci in the A1 subcompartment, detected by DOTTER in images of which (j) and (k) are representative examples.New: dots detected only in images deconvolved with DW.Lost:

Figure 6
Figure 6 . U, dots with improper barcodes and thus discarded by the same pipeline.The vertical dashed black line represents the threshold used for all subsequent analyses of this dataset.(b) Median quality score of the A dots shown in (a), calculated at different uorescence intensity thresholds as previously described 17 .The vertical dashed black line represents the threshold used for all subsequent analyses of this dataset.(c) Spatial distribution of the ISST dots identi ed in one MTG cortical stripe from the same ISST image dataset analyzed in (a) and (b), without (Raw) or with deconvolution using DW.Each dot corresponds to an individual transcript.Left to right: supragranular to infragranular.n, number of dots identi ed.(d) Number of cells assigned to each of the of 18 brain cell types shown along the x-axis, based on the transcripts identi ed in raw or deconvolved ISST images