Deciphering the immune microenvironment of a tissue by digital imaging and cognition network

Evidence has highlighted the importance of immune cells in various gut disorders. Both the quantification and localization of these cells are essential to the understanding of the complex mechanisms implicated in these pathologies. Even if quantification can be assessed (e.g., by flow cytometry), simultaneous cell localization and quantification of whole tissues remains technically challenging. Here, we describe the use of a computer learning-based algorithm created in the Tissue Studio interface that allows for a semi-automated, robust and rapid quantitative analysis of immunofluorescence staining on whole colon sections according to their distribution in different tissue areas. Indeed, this algorithm was validated to characterize gut immune microenvironment. Its application to the preclinical colon cancer APCMin/+ mouse model is illustrated by the simultaneous counting of total leucocytes and T cell subpopulations, in the colonic mucosa, lymphoid follicles and tumors. Moreover, we quantify T cells in lymphoid follicles for which quantification is not possible with classical methods. Thus, this algorithm is a new and robust preclinical research tool, for investigating immune contexture exemplified by T cells but it is also applicable to other immune cells such as other myeloid and lymphoid populations or other cellular phenomenon along mouse gut.

automatically analysed using a customized algorithm 13,17 . An important use of these methods in gut pathologies is probably the Immunoscore 6 , a new prognostic tool for CRC patients that uses in situ quantification of CD3 + tumor-infiltrating T cells 18 . DIA was also used in murine colitis models to study the gut microenvironment, as reported on whole mouse colon sections, via an automated method to evaluate inflammatory areas 19 , but DIA was not used for single cell analysis. Moreover, there is no general method to obtain the fine localization and number of immune cells along a mouse colon.
Here, we present a DIA semi-automated process using Tissue Studio software (version 2.6) to simultaneously discriminate, localize and quantify immune cell populations within distinct areas of a whole colon section. We chose the APC Min/+ mouse model to validate this approach, as it is a preclinical reference model for CRC 20,21 . Three areas were targeted: the colonic mucosa, lymphoid follicles and tumors, focusing on T cells, the significance of which is well-established in CRC [5][6][7]9,18,22,23 . We validated the precision and robustness of our method on several colon slides and with different fluorescence patterns despite the tissue feature complexity and background. This pipeline allows precise characterization of the immune microenvironment in small tissue structures, such as lymphoid follicles, and was built to be used to other intestinal tissues and other gut diseases.

Results
General DIA procedure based on Cognition Network technology (CNT). Immunostaining was performed using specific membrane fluorescent labelling associated with Tyramide Signal Amplification, as previously described 6,[24][25][26][27] (See Supplementary Fig. S1). This staining was completed with DAPI nuclear counterstaining for cell identification and numbering within tissues. We chose paraffin-embedding to preserve the colon structure and allow optimal sample quality for slide digitalization and image analysis processing. Moreover, the fluorescence signal to noise ratio must be managed to avoid signal saturation and allow accurate tissue and cell delimitation.
To decipher the immune microenvironment in distinct regions of interest (ROIs) in the APC Min/+ colon, we had to develop the optimised DIA algorithm with Tissue Studio software (Definiens, Germany). It was not possible to use the pre-calibrated algorithm available in the software, because of the complexity of detecting multiple cell types in different whole colon regions with precise cell numbering for each ROI. But, the friendly interface of the software allows users to build their new specific algorithm adapted to their scientific problematic and sample. More precisely, users can select, calibrate and organize an extensive series of rules to analyse their images, which are later translated by software in comprehensive language, to allow the automatic execution of the algorithm by the computer. Thus, we have optimised a new algorithm for a whole colon section DIA, by selecting, configuring and classifying various Tissue Studio software functions and rules. The global structure of the developed algorithm is presented in Fig. 1a. This set of commands was developed using an exhaustive catalogue of pre-coded functions, which need to be set and ordered. A brief summary of possible functions and its associated non-configured parameters are described in Supplementary Table 1 together with the available ruleset combination numbering.
All of the rulesets were based on Definiens Cognition Network Technology (CNT) 28 , an object-based image analysis method, which extracts information from the image using a hierarchy of pixel group, called "objects" (See Fig. 1b,c). Contrary to classical image analysis, CNT considers pixels not as an isolated entity but in the image frameworks. In practice, it uses the color, the shape, the size, the context, and their relationship with each group of pixels, or object, to analyse images.
These pixel properties were essential to apply this technology to the whole colon slide (See Fig. 1b-e). In the first step of the algorithm, fluorescence from a colon section (exemplified in Fig. 1b) was detected using DAPI and FITC fluorescent channels and segmented into pixel clustering groups called "primitive objects", as shown in Fig. 1c. The "primitive objects", which have a specific fluorescence pattern and spatial network, when grouped together, form an "object". Depending on the algorithm step, we have linked these specific patterns with a respective group of large "objects" called "ROI" (see Fig. 1d, first line: example of 3 classes of ROI in picture; "ROI1", "ROI2" and "ROI3") or with a respective group of small "objects" called "cells" (Fig. 1d; second line; example of two classes of cells: "nuclei" and "cell with membrane"). This established link thanks to selection, calibration and ordering of pre-coded rules in Tissue Studio catalogue, allowed the user to distinguish ROIs and cells on the colon section, as described in Fig. 1e. More precisely, we implemented different ROIs corresponding to each colonic structure and classified them using an automatic ROI classification step and manual refining as necessary, as shown in Fig. 1a. Up to 8 ROI classes can be defined with the software. Finally, we quantified immune cells by implementing cellular detection and classification based on the same CNT process using segmentation and classification iterations 28 . We exported various parameters, such as the ROI area, mean fluorescence intensities and number of cells per ROI, for statistical comparison.
Specific workflow for mouse colon immune cell detection. The detailed optimised workflow of this new algorithm is described step-by-step, for single ( Fig. 2) and double membrane staining ( Supplementary  Fig. S2). More precisely, CD45 + leucocytes were detected using specific FITC labelled antibodies, meanwhile CD4 + T cells were detected with CD3 and CD4 membrane proteins using Cy3 and FITC labelled antibodies respectively. In each case, nuclei were stained using DAPI fluorochrome. The stainings were performed on colonic sections scanned at 40x magnification, 0.161028 µm/pixel resolution and 16 bit depth. These picture acquisition parameters fix the first step of the algorithm (See Fig. 2a, "General setting" step"). The other analysis steps such as tissue detection, ROI classification, cellular analysis and export were chosen, organized and calibrated via an iterative method ( Fig. 2 and Supplementary Fig. S2). All of these are described in detail below. (a) The procedure to quantify immune cells is based on a computer learning algorithm and elaborated using Tissue Studio software (Definiens, Munich, Germany). After optimal image acquisition, we evolved the algorithm using five sequential steps: global tissue detection, ROI (Region Of Interest) classification, ROI correction to discriminate the ROIs associated with APC Min/+ colon tissue, cellular detection and cellular classification to quantify positive membrane stained cells per ROI. (b-e) Particular blow up of a colon region is shown as an example of the digital image analysis process. Information is extracted from the picture using a hierarchy of image-objects, formed by grouping of pixels, after an evolutionary alternation of classification and segmentation steps. For example, in blow up picture (b), areas (yellow boxes) are selected to distinguish various ROIs (ROI 1: box 1; ROI 2: box 2 and 3; and ROI 3: box 4). These selected zones are recorded as a pixel network with CNT (c, top boxes). The image is analysed at the pixel level in a contextual fashion. Specific groups of connected pixels, named "primitive objects" are identified and shown in c (middle red boxes). Then each primitive object is linked with a specific ROI by a coded action (d, top box; ex: primitive object (I) is linked with ROI 1). The same connected primitive objects are finally grouped to form an object associated to a specific ROI as a result of the recognition of ROI-associated primitive-objects. This permits the classification of each selected  Supplementary Fig. S3) we first defined the total area to analyse, via automatic global tissue detection using membrane ( Fig. 3b) and nuclear stainings (represented in Fig. 3a with alternate red staining). As shown by the flowchart in Fig. 2b, we determined the optimal thresholds for DAPI fluorescence brightness and homogeneity for all slides by up to 10 iterations, on the basis of unstained area exclusion and unique tissue stain area detection at the end of the simulation. Small non-tissue stained areas (<10 µm 2 ) were removed from the analysis by adding a minimal size rule. We thus successfully detected a complete colon section (See Fig. 3a: original data; 3b: colon tissue detection by the machine). Figure 3d shows the result of the segmentation step of the original mucosa image, which is displayed in Fig. 3c. It consists of the fragmentation of detected tissues into "primitive objects". Cell individualization and ROI classification are based on this second step. A higher segmentation scale creates small "primitive objects", which facilitates cell individualization. However, it complicates ROI classification, making it impossible to determine a global fluorescence pattern for each ROI. On the contrary, a low segmentation scale allows precise ROI classification, leading to incorrect cell individualization. We set an efficient segmentation scale of 4 after testing different index values (Figs 2c, 3c: original image of mucosa; Fig. 3d: segmented associated image), so that the ROIs were correctly detected and classified (See Fig. 3e: automatic ROI classification; 3f: ROI reclassification by algorithm; 3g: manual correction).
To conduct this ROI classification, we chose to create three iROI classes and two other ROIs for non-interesting colon regions ("other tissue") and non-tissue areas ("background") (See Flowchart in Fig. 2c and the results in Fig. 3e-g). First we implemented a classical computer based learning step called "Training action" in Tissue Studio by recording a precise selection of representative FITC and DAPI labelled primitive objects for each ROI, as exemplified in Fig. 4a. In the first step, the software determined ROI-associated "primitive objects" for each distinct ROI, as represented in Fig. 4a,b. Mucosa, lymphoid follicle and background ROIs were correctly classified at the end of the computer based learning section (Figs 3e and 4c). However, it failed to distinguish the mucosa from other tissue ROI (See Fig. 3e) and the tumor from mucosa or lymphoid follicle (Figs 3e and 4c). In that case, the "primitive-objects" were similar between mucosa and other tissues, or between tumor and lymphoid follicle, and mucosa within a small area, respectively (See tumor-associated "primitive objects", in Fig. 4b, as an example). To solve this issue, we have added an ROI refining sub-step (named "Reclassification" in Tissue Studio) (See details in Fig. 4d-f). It is based on the selection, organisation and calibration of up to eleven pre-coded conditional rules, from the software library (Summary of the possibilities in Supplementary Table 1). Each of these rules is built in the same fashion (See Fig. 4d,e): it allowed the new classification of an incorrectly classified ROI object into its correct ROI class by selecting a specific characteristic of the object (named "Condition"). More precisely, we implemented and set conditional rules based on the ROI size, tissue complexity and relative borders of each improperly classified ROI (Fig. 4d) which were translated by software (Fig. 4e), allowing a better ROI classification on the whole colon (See result for the whole slide in Fig To finalize the ROI classification step and to validate the whole process, a visual confirmation was performed as well as a possible ROI refining ( To facilitate cell detection, the algorithm was first set to recognize cell nuclei and cellular membranes and, finally, to simulate cells using the "Inside cytoplasmic stain" mode. This mode was optimal for precise cell delimitation despite the blurry DAPI signal resulting from the high cellular density in the lymphoid follicles as shown in Fig. 5e; and in tumors as shown in Fig. 5i. We successfully programmed the algorithm to recognize different cell types on whole colon tissue, with the same settings for the DAPI fluorescence range and mean nuclear area value. We tested several combinations of these parameters. In this step, the grey value level of DAPI was converted into arbitrary units by Tissue Studio software. We determined the optimal fluorescence range (from 0 to 2 arbitrary units (a.u)) and "mean nuclear area". This area (35 µm 2 ) allowed for individualization and detection of nuclei in each ROI using DAPI signals ( Fig. 5b: mucosa, 5f: lymphoid follicle, 5j: tumor). With the same iterative method, we set the CD45 fluorescence threshold at 1,600 grey value levels (g.v.l) and the mean cell area at 38 µm 2 for optimal cell delimitation. Cell algorithm detection was finally performed and validated for all of the ROIs using these four parameters simultaneously ( Fig. 5c: mucosa, 5g: lymphoid follicle, 5k: tumor).
To discriminate CD45 + cells (FITC + ) (Fig. 5, white arrows: negative cells; yellow arrows: positive cells), we implemented a cellular classification step and defined a "positive cell" class based on nuclear and membrane co-staining to avoid incorrect classification due to fluorescence artefacts (e.g., fluorochrome aggregates or red blood cells). Preliminary DAPI and FITC thresholds were set on the basis of the minimal DAPI intensity from 7 random fields of five different colon samples. The maximum FITC intensity was based on 5 control slide random fields without a primary anti-CD45 antibody. We adjusted these parameters after performing simulations to a unique optimal threshold of 1,000 g.v.l for DAPI staining and 1,300 g.v.l for FITC staining (maxima at colon zones into respective ROI (e, top boxes; ROI 1: Green; ROI 2: Yellow; ROI 3: Blue). The same process is applied for cellular analysis (c, bottom purple boxes), with a more segmented image reaching cellular scale. An object is defined as a cell (e, second line). In that case, primitive objects (c, bottom purple boxes) are smaller, and linked to a cell type (d, second line).   Figure 2. Optimal digital image analysis algorithm flowchart for whole colon slide: example of CD45 single staining. All algorithm functions were chosen and ordered from the exhaustive Tissue Studio software prewritten rule list. They constituted an innovative program that did not exist in software library, and were optimised to quantify cells in various ROIs from a whole colon stained section. It was developed by an iterative method. (a) First step, "General settings", is a fixed step by the software. It allows to set the analysis workflow by indicating all the image file parameters (magnification, resolution and fluorescence staining). (b) We implemented a second step, called "Tissue detection" to detect the complete colon tissue on the slide. It is based on user defined optimal parameter settings: fluorescence channel, minimal tissue detected size, and fluorescence brightness and homogeneity. (c) We implemented a third step, "ROI Classification", to discriminate the various colon regions of interest (ROI). To manage with the complexity of a whole organ slide, we implemented three analysis steps, named composers. First composer is "Initialization", a mandatory composer in Tissue Studio software to detect ROI. It allows automatic recognition of ROIs by software, using a stock of representative areas, selected on colon section during algorithm development. Second composer is "Reclassification region" based As expected, no positive cells were counted on negative control slides. Moreover, as observed on immunostained APC Min/+ mouse colons (Fig. 6a-c), the leucocyte density was far higher in lymphoid follicles (2.10 × 0 4 cells/mm 2 ± 0.06 × 10 4 cells/mm 2 ) than in the mucosa (2.97 × 10 3 cells/mm 2 ± 0.25 × 10 3 cells/mm 2 ) or tumors (3.22 × 10 3 cells/mm 2 ± 0.52 × 10 3 cells/mm 2 ) (See Fig. 6d), showing numeric data consistency. As expected for each whole section, we were able to analyse a significant tissue area per animal, from 0.13 mm 2 ± 0.03 mm 2 (for the smallest iROI: lymphoid follicle) to 4.73 mm 2 ± 0.28 mm 2 (for the largest iROI: mucosa), which resulted in a significant number of total analysed cells per animal, from 3.73 × 10 3 ± 1.17 × 10 3 (for lymphoid follicles) to 1.17 × 10 5 ± 0.07 × 10 5 (for the mucosa). Therefore, this method enabled analysis of a significant number of total cells to obtain precise densities of frequent and rare interesting cells in each ROI (Fig. 6b,d).
Thus, we were able to precisely quantify cells in each iROI, a result that was either imprecise by manual scoring or impossible by manual counting due to the high cellular densities in the iROIs. In this way, we were able to compare leucocyte distribution in the three APC Min/+ mouse gut immune areas: mucosa, lymphoid follicles and tumors (Fig. 6d, p < 0.0001).
To confirm CD45 + leucocyte quantification, we compared the cell density obtained from the digital algorithm measurement (positive cells iROI /area iROI (mm 2 )) to the density index assessed by manual scoring in each iROI, as it is presented in Fig. 6e (e.g., mucosa). The range of the scoring index was between 0 (no positive cells) and 5 (elevated positive cell density) and was specific to each iROI. The comparison between manual scoring and the DIA density in the mucosa (Fig. 6e, Pearson r = 0.6869, p < 0.01), tumors and lymphoid follicles (data not shown) highlighted a significant positive correlation that supported the consistency of the numeric data from the algorithm.
Because the fluorescence pattern was different from that of CD45, we had to optimise the main parameters of the algorithm (Fig. S2). We adjusted the ROI classification by computer based learning and ROI reclassification rules (See details in Fig. S4, parameter differences between single and double staining are highlighted in blue). Since CD3 is more frequently detected on T cells than CD4, we used the former for cellular delimitation. The optimal fluorescence thresholds (DAPI: from 0 to 2 a.u.; Cy3: from 48,356 to 65,536 g.v.l) and mean areas (nuclei: 35 µm 2 ; cell: 36 µm 2 ) were applied. Cell classification was modified using DAPI + CD3 + and DAPI + CD3 + CD4 + cell classes for the successful detection of T cells and CD4 + T cells, respectively (Fig. 7a). We improved several classification parameters to prevent false CD3 + cell detection due to paraffin-embedded tissue edge fluorescence properties (see the Troubleshooting section). As for the CD45 analysis, we used unique fluorescence thresholds (DAPI: 500 g.v.l; Cy3: 2, 500 g.v.l; FITC: 1,500 g.v.l; maxima at 65,536 g.v.l) to detect and classify these cell populations in each iROI (Fig. 7b: mucosa, 7c: lymphoid follicle, 7d: tumor). We exported the same numeric data as in the CD45 analysis and added three export rules to obtain CD4 + T cell quantification in each iROI ( Supplementary Fig. S2), and cells densities were calculated using equations (2) and (3). on a specific series of conditional rules to automatically reclassify the ROIs which were incorrectly classified by the initialization composer. We have added a third composer, "ROI correction" to allow a quick visual checking of "ROI classification" by user. (d) Then, to quantify cells of interest in each ROI, we implemented the "Cellular analysis" step. The first action is a mandatory "Initialize Cellular analysis" function, to set the optimal parameters of cellular analysis (magnification and chosen ROIs). Then, we have chosen and ordered three optimal coded functions and their settings to detect all cells and cells of interest (e.g. CD45 + cells here) in all ROIs: Nuclei Detection, Cell Simulation and Cell classification. (e) To finalize this algorithm we selected the export command parameters. As described above, we validated each step of our method (Fig. 7a-d) on a batch of whole immunostained colon slides (n = 23, including 5 controls) from different mice (n = 18). Numeric data were compared via manual . We detected the whole colon section using a global tissue detection step and DAPI (red) counterstaining, and (b) we simulated data using detected (dark blue) and not detected (light grey) areas. (c,d) Representative validation of the optimal tissue segmentation index on mucosa with immunostaining (c) and segmented mucosa (d). (e-g) For ROI classification, we approved five ROI classes to differentiate between mucosa (beige), lymphoid follicles (green), tumors (orange), other tissues (light blue and dark grey) and background areas (blue green and light grey). (e) We first performed automated ROI classification based on the nuclear and membrane fluorescence signals. This step permitted the precise distinction between mucosa (beige), lymphoid follicles (green) and background (blue-green and dark-grey). (f) We evolved the automated ROI reclassification step by adding conditional rules to detect tumor (orange) and avoid false mucosa detection (grey area). (g) To optimise and control ROI classification before cellular analysis, we added a last step using manual correction. We presented an example of a false ROI classification (white arrow), which was detected as mucosa (e). We corrected this error after ROI reclassification as other tissue (dark grey) (f,g).  (a) An analysis slide is shown with its original picture and specific blow ups corresponding to mucosa, lymphoid tissue and tumor (white boxes), and (b) exemplary red boxes pointing out a pixel group as a "primitive-object". Each of them is automatically associated with a specific ROI, by a stock of ROI-representative "primitive-objects" (c, ex: mucosa: yellow area; lymphoid follicle: green area), that were constituted by selecting specific colon area during the algorithm development. With this automatic learning method, we can distinguish lymphoid follicle and mucosa ROI correctly, due to clearly distinct mucosa and lymphoid follicle associatedprimitive-objects (b,c: middle and bottom boxes). On the contrary, tumor-extracted primitive-objects are associated with mucosa and lymphoid follicle-primitive objects (b; top boxes), resulting in an incorrect tumor ROI classification (c; top box). (d-f) To solve this issue, we implemented a set of user defined commands to obtain a correct ROI classification. (d) We implemented four conditional rules by selecting a ROI couple (the "source class" is the false ROI that needs to be reclassified and the "target class" is the true ROI) and the parameter used to reclassify the ROI. (e) Conditional rule selected is translated by the software in a coded rule and (f) allows the automatic reclassification of false ROI by software. By using this method we manage to reclassify "false lymphoid follicle" into "tumor", using a conditional rule based on size object; (d-f; composer 1, arrow I, II and III) and "false mucosa" into "tumor", using a conditional rule based on object proximity with  (Fig. 7e,f), showing a strong correlation for both CD3 + T cell (Fig. 7e, Pearson r = 0.8252, p < 0.0001) and CD4 + T cell quantification (Fig. 7f, p < 0.05) in the mucosa as well as the other iROIs (data not shown). As expected, a significantly higher density of these cells was observed in the follicle structure (Fig. 7g, Pearson r = 0.4999, p < 0.0001).
Troubleshooting. We used immunofluorescence staining to detect specific immune cells because it allows for multiplexed analysis 26 . However, the variability of fluorescence detection (the mean intensity, and the variation of fluorescence intensity around the mean and its standard deviation), due to the intrinsic properties of some tissue structures and cell components (elastin, red blood cells), influenced our DIA results (See Table 1). More precisely, we encountered three difficulties during algorithm development. First, the fluorescence signal could be heterogeneous from one slide to another due to a non-optimal acquisition and/or staining protocol ( To address these phenomena, the staining protocol and image acquisition were optimised ( Table 1, sixth column). Importantly, the same conditions can only be applied to a batch of slides when the fluorescence patterns are homogenous on all slides. To this end, it is essential to use the same staining and acquisition parameters (Table 1. 1, 2, 5, 6: sixth column). To obtain optimal signals (homogeneity, minimal and maximal intensity) for DIA, the preferred time to scan a slide batch is up to 10 days after staining. The other optimal parameters are precisely described in the Online Methods.
In cases in which staining and acquisition protocol optimization were insufficient (Table 1. 3, 4, 5, 7), improvements of the DIA algorithm played a key role in preventing analysis errors (see the troubleshooting guide Table 1, fifth column). In particular, fluorescence heterogeneity on the same slide (e.g., due to biological heterogeneous marker distribution or tissue states) caused improper ROI classification. We overcame the inability of Tissue Studio to determine a general fluorescence pattern for each area by adding reclassification rules based on fluorescence-independent parameters, such as the ROI size or tissue complexity (Table 1. 2-4). Fluorescence artefacts inducing false positive cell detection (1.9% of slides for a single staining, or 30.4% of slides for a double staining) could also be solved by minor algorithm modifications. This correction step was more easily achieved if the affected ROI did not contain target cells (Table 1.

6).
Provided attention is paid to these critical points, the pipeline we describe here allows immune colon profiling on numerous slides without failure. It is important to mention that the dependence of the algorithm on membrane detection means that it must be optimised for each new surface marker. However, this can be accomplished quickly by adjusting the numeric parameters according to the recommendations of our troubleshooting guide (Table 1).

Discussion
Here, we describe a new quantitative semi-automated method to characterize the immune microenvironment on whole mouse colon slides. Based on CNT, the proposed method allows tissue to cell scale analysis; thus, we are able to simultaneously investigate various ROIs and immune cell populations associated with colonic tissue. A recent immune cell quantification study by Blom and colleagues used another software on a slide of prostate mice tumor 26 but did not distinguish different structures as with our method using ROI classification. Here, we show how to use our method to quantify leucocytes and T cells in three immune colon regions in APC Min/+ mouse model (mucosa, lymphoid follicle and tumor), and it is possible to implement up to 8 ROIs. This new analysis enables precise quantification of cells and comparison of cell distributions between different areas in whole tissue.
Compared to classical IHC scoring, this method using automatic learning avoids human bias and quantifies cells quickly without laborious manual work. Moreover, as the whole tissue and all the cells are analysed on the slide (from 0.13 to 4.73 mm 2 of tissue and from 10 3 to 10 5 cells), we provide accurate results compared to classical IHC assessment in a few random fields 13 . Therefore, this new method can consider biological variations and rare cell populations.
Our method can act as a complementary tool to flow cytometry (FC) because it allows analysis of significant cell number without requiring a complex and laborious cell extraction process. Cross-correlation and cellular relationships between immune cell density and other staining methods (e.g., FISH, HES, cellular damage staining) performed on consecutive sections are possible, adding new possibilities compared to classical FC studies.
Furthermore, thanks to the development of our algorithm, its step by step description, and its troubleshooting guide (Table 1), it is easier to analyse data than to perform mass spectrometry imaging. If necessary, our algorithm can be easily applied to the Definiens software interface using the Tissue Studio User guide 29 . Additionally, obtaining numerical data is faster than with mass spectrometry or classical IHC. Thus, we developed a fast and simple way to robustly quantify and localize immune cells on numerous tissue samples without the requirement of complex bioinformatics expertise.
Moreover, our method allows the cell density to be determined from microscopic structures, such as lymphoid follicles and small neoplastic lesions, which are not accessible with FC. Because of the Definiens CNT used in our algorithm, we can implement specific settings to detect these structures within the colon and count the associated cells. This gives significant information as the high density of immune cells in lymphoid structures shows the link between gut inflammation and lymphoid follicles, which has already been described in the mouse 30 ; furthermore, the importance of the tumor microenvironment has been shown in colorectal cancer patients 6,7,18 .
tumor (d-f; composer 2, arrows I, II and III). Same method is used to correct other "false classification" due to confusion between mucosa and other tissue (d-f; composer 3, arrows II, III and IV) or tumor and other tissue (d-f; composer 4, arrows II, III and IV). Because our algorithm is based on immunofluorescence detection, its settings are sensitive to fluorescence variations (e.g., pattern and intensity). Whereas the method pipeline is validated on different slide sections and stainings, an optimal and reproducible immunostaining protocol is required to analyse a batch of slides. Furthermore, algorithm optimization is needed for each new immunostaining or to develop new membrane markers. A simple software interface 28,29 and troubleshooting guide make this process easier and faster for everyone.
Application of this new, quantitative, easy method could be extended to multiplex studies, such as the work by Blom 26 , as well as to whole sections with various complex structures, such as gut samples, because these settings are optimised for this type of tissue. Application of this method enables precise immune cell characterization in various gut regions of interest (from the epithelium to muscular layers) via cell-cell interaction studies and fine localization of cellular events at different time points along the gut. This method could be useful to better understand both the mechanism of immune dysfunction associated with gut disorders 1-8 and the interaction between pathogenic bacteria (FISH determination) and the immune system 9,10,12,22 .
In summary, here, we describe a powerful method to characterize immune cells in the gut of mice that is user-friendly for the scientific community. We expect that this method will help to decipher the complexity of interactions between the gut microenvironment and gut disorders or their treatments. Moreover, this method could apply to the detection and quantification of cells in any particular microscopic structure that is not reachable by classical means. For example, subtle neuronal immune cross talk in the gut, such as macrophages interacting with mesenteric neurons 31 could be studied using the developed algorithm and method in a quantitative fashion. It will allow scientist to follow the precise and quantitative development of specific microenvironment within a disease context in whole organs for the purposes of preclinical studies. To detect all cells in the mucosa, we used two sequential steps. (b) The first step was nuclear detection as represented by blue delimitation based on DAPI fluorescence and the nuclear mean size as determined by iteration to delimit DAPI (35 µm 2 ± 5 µm 2 ). (c) Then, we performed cell detection using a second step with nuclear staining, the CD45 membrane signal and the mean cellular size determined by iteration to delimit FITC staining (38 µm 2 ± 5 µm 2 ). (d) To identify leucocytes, we carried out cell classification of positive cells (CD45 + , light yellow cells and arrows) and negative cells (CD45 − , white arrow, dark yellow cells), applying optimal fluorescence thresholds for nuclei and membrane markers. We simultaneously performed all of these steps using the same parameters on lymphoid follicles (e-h) and tumors (i-l). Automated discrimination of CD45 + cells was successful on all iROIs simultaneously with the same optimal parameters. Tissue harvesting and processing. The colons were removed from the caecum to the rectum, flushed with PBS, and splayed longitudinally. The colons were swiss-rolled from the distal to proximal end and fixed for 24 h in 10% formalin (Sigma, Tokyo, Japan) at room temperature (RT). Colon blocks were embedded in paraffin (Tissue-Tek Paraffin Wax #4511, Sakura, Leiden, Holland) according to the standard procedure. Paraffin-embedded sections were cut into 5 µm sections on superfrost slides (Thermo Scientific TM , Waltham, MA, USA), dried overnight at +37 °C and stored at RT. For long-term storage, slides were stored at +4 °C.
Immunofluorescence staining (IF) and mounting slides. All IF staining was performed using an auto-   Negative control slides were also included that lacked any appropriate antibody or, in the case of double staining, omitted one or the other primary antibody.
Image acquisition. All slides were acquired automatically at 0,161 µm/pixel resolution using a VS-120-ASW-L100 whole-slide scanner (Olympus, Rungis, France) equipped with a Digital monochrome Olympus XM10 camera 40x objective (NA 0.95). First, a global overview of the whole colon section was performed automatically using an Olympus camera set on brightfield (VC50 camera 4x objective and the mercury lamp U-HGLPS, Lumencor) to define the scan area. Second, a fluorescence image was acquired with automatic focusing (default factors setting) and used DAPI (ex: 350 nm/em: 450 nm), FITC (ex: 495 nm/em: 521 nm) and CY3 (for Rhodamine fluorophore, ex: 550 nm/em: 570 nm) filter sets compatible with light sources (X-Cite exacte Microscope Illumination System) and AT350/50x filter wheels. For CD45 fluorescence imaging, we used 50 ms We validated our classification method and optimal sets on all iROIs: mucosa (b), lymphoid follicles (c) and tumors (d). (e) Comparisons between the algorithm quantification of CD3 + cells on the mucosa and manual scoring showed a significant correlation, (****p < 0,0001; Pearson's test, r = 0,8252). (n = 23 immunostained sections from 18 different mice). (f) We obtained a significant correlation for CD3 + CD4 + T cells between the manual and algorithm quantifications (*p < 0,05; Pearson's test, r = 0,4999) (g) We successfully automated the discrimination and quantification of CD3 + T cells (fill dot) and CD4 + CD3 + T cells (empty dot) on all ROIs simultaneously using the same parameters. A significant increase of the CD3 + T cell density (****p < 0, 0001; one-way analysis of variance) and CD4 + CD3 + T cells (****p < 0, 0001; one-way analysis of variance) was observed in the lymphoid follicle, as expected. . For T cell analysis, we used the same 18 mice, but we performed analyses on 23 different sections (18 IF stains and 5 controls: 3 without anti-CD3 and CD4 primary antibodies, 1 without anti-CD3 primary antibody, and 1 without anti-CD4 primary antibody). To score leucocytes (CD45 + cells) and CD3 and CD4 T cell densities, the iROI (mucosa, lymphoid follicle and tumor) of each mouse was observed with a 20x objective and scored separately. For mucosa and tumor, 10 and 7 random fields were observed and scored, respectively, and then the mean was calculated. For lymphoid follicles, the whole lymphoid area was observed. The manual score was determined between 0 (absence of positive immune cells) and 5 (high presence of positive immune cells). The slides were anonymously analysed; to simplify scoring, each specific iROI (mucosa, lymphoid follicle, and tumor) was compared between the different mice, but the iROIs of the same mouse were not compared with each other.
Digital image analysis and code availability. Digital image analysis was performed on the same hardware as the manual analysis, using the IF module of Definiens Tissue Studio software version 4.3.1. All images were downloaded in the original format (ets, 0.161 µm/pixel resolution; 16-bit depth, 40x objective). Each slide was automatically analysed using 40x viewing resolution for segmentation and cellular analysis steps, and 10x viewing resolution was used for ROI detection and classification steps. Across the entire analysis between ROI correction and cellular analyses steps, the same resolution parameters were selected. Each step was confirmed visually. To obtain the best distinction between the algorithm simulation and the original image, we used a false colour representation (DAPI in red, membrane marker in green). First, algorithm settings (described previously) were established on five representative slides. They then were tested and optimised on 10 randomly selected slides. Finally, they were confirmed on each batch of slides (20-23 slides). Validated algorithm codes were saved as dax files that are available at Scientific Report online.
Numeric data analysis and statistical methods. Statistical analyses were performed using Prism 6.05 (GraphPad Prism, La jolla, CA, USA). Correlations between manual score and numeric data analyses were calculated using Pearson's correlation coefficient (r). One-way analysis of variance test was used to compare cell density between iROIs of the same mouse. p-values <0.05 were considered statistically significant. Accession code. Algorithm codes for digital image analysis of whole colon slide, and more precisely for ROI classification and leucocytes and T cells quantification are available on Scientific Report website, in dax format. This format must be opened in Tissue Studio Software. Structures and all any details of algorithm code are available in.pdf format in article figures (Figs 1a, 2 and 4d) and in Supplementary information ( Supplementary Figs 2 and 3).