NODeJ: an ImageJ plugin for 3D segmentation of nuclear objects

Background The three-dimensional nuclear arrangement of chromatin impacts many cellular processes operating at the DNA level in animal and plant systems. Chromatin organization is a dynamic process that can be affected by biotic and abiotic stresses. Three-dimensional imaging technology allows to follow these dynamic changes, but only a few semi-automated processing methods currently exist for quantitative analysis of the 3D chromatin organization. Results We present an automated method, Nuclear Object DetectionJ (NODeJ), developed as an imageJ plugin. This program segments and analyzes high intensity domains in nuclei from 3D images. NODeJ performs a Laplacian convolution on the mask of a nucleus to enhance the contrast of intra-nuclear objects and allow their detection. We reanalyzed public datasets and determined that NODeJ is able to accurately identify heterochromatin domains from a diverse set of Arabidopsis thaliana nuclei stained with DAPI or Hoechst. NODeJ is also able to detect signals in nuclei from DNA FISH experiments, allowing for the analysis of specific targets of interest. Conclusion and availability NODeJ allows for efficient automated analysis of subnuclear structures by avoiding the semi-automated steps, resulting in reduced processing time and analytical bias. NODeJ is written in Java and provided as an ImageJ plugin with a command line option to perform more high-throughput analyses. NODeJ can be downloaded from https://gitlab.com/axpoulet/image2danalysis/-/releases with source code, documentation and further information avaliable at https://gitlab.com/axpoulet/image2danalysis. The images used in this study are publicly available at https://www.brookes.ac.uk/indepth/images/ and https://doi.org/10.15454/1HSOIE. Supplementary Information The online version contains supplementary material available at 10.1186/s12859-022-04743-6.

as chromocenters in Arabidopsis thaliana [2]) can have a drastic effect on gene expression [3] and on the maintenance of heterochromatin itself [4,5].
Three-dimensional (3D) imaging methods are widely used to investigate nuclear morphology [6,7]. We previously developed a workflow called NucleusJ2.0, designed to compute nuclear morphometric parameters (e.g. shape and size), as well as chromatin organization [8,9]. While NucleusJ2.0 can automatically detect nuclei in 3D images and compute their general characteristics, further segmentation of subnuclear structures is at best a semi-automated procedure that requires user input. This induces limitations for high-throughput data analysis and for achieving consistency when processing a large number of images, while also potentially introducing user bias.
Here, we describe Nuclear Object DetectionJ (NODeJ), a new tool to automatically segment subnuclear objects such as chromocenters and Fluorescence In Situ Hybridization (FISH) signals. NODeJ implements an algorithm based on a Laplacian convolution [10]. This results in an increase in the contrast of objects of interest and allows to define a threshold on the enhanced image to obtain the segmented objects. The relevant parameters for the objects detected in the raw images are computed using NucleusJ2.0 methods [9] implemented within NODeJ.

Implementation
NODeJ can be used to process images of nuclei from samples expressing fluorescent reporters, or from fixed tissues or isolated nuclei stained with DNA dyes. The program can be run as an ImageJ plugin through the graphic user interface (GUI) or the command line (CLI) mode to handle large datasets.
Our method is based on a Laplacian algorithm for object boundary detection [10]. The Laplacian method belongs to a group of mathematical methods for automated segmentation of objects based on the distribution of voxel intensities across an image. Other methods also included in this group are the watershed [11,12] and the Isodata algorithms [13]. All of these methods use the distribution of voxel values to define the connected components of an image [10].
NODeJ assumes one nucleus per image and uses as an input the raw image of the nucleus as well as the mask of this nucleus (binary image of the nucleus) and computes the enhanced image resulting from the Laplacian operator ( δv x ). The voxel values of the enhanced image are used to compute a threshold value ( t ). A thresholding is then applied on the image to segment the final objects (Fig. 1).
Starting from the raw image (Fig. 1A), the new voxel value is derived (Fig. 1C) for each voxel v x . NODeJ computes a locally averaged new value δv x inside the mask of the nucleus (Fig. 1B), defined as: where N(s) is the neighborhood (of size s) of v x . The size (s) is defined by the user for small nuclei (volume < 50 μm 3 ), or automatically adjusted for larger nuclei ( s = s · 2.5 ). If the neighborhood voxel tested ( v y ) is outside the mask, the algorithm ignores it and goes to the next v y .
Once the enhanced image is obtained (Fig. 1C), its signal is smoothed using a Gaussian blur filter from ImageJ [15]. Then, the threshold value t is computed (using the enhanced image) as t = x + stdev · f , where f is a factor defined by the user (for the whole dataset) and automatically adjusted ( f = f + 1 ) for large nuclei (volume > 50 μm 3 ), x being the average of voxel values from the enhanced image and stdev being the standard deviation from the same image (Fig. 1C). Finally, the connected components of the binary image, obtained by applying the threshold t , are defined using the library MorphoLibJ [16] (Fig. 1D).

Results and discussion
NODeJ requires raw images [e.g. DNA staining (Figs. 2 and 3) or FISH (Fig. 4)] and a mask of the nuclei as input. The mask can be generated by NucleusJ2.0 (Fig. 1B). All boundaries of the nuclei need to be included in the two input images.
To demonstrate the performance of NODeJ, we generated and analyzed an artificial dataset of 3D nuclei (Additional file 4: Fig. S1 , Additional file 1), and subsequently processed several publicly-available datasets. Public data analyzed consisted of three different A. thaliana datasets [8,9,14] stained with DAPI or Hoechst, which were analyzed with NODeJ to identify and characterize chromocenters, and one dataset from a DNA FISH experiment targeting the 180bp repeat, which was used to characterize centromere organization [19]. We also compared the results obtained with NODeJ to a manual count of chromocenter number or FISH signals (Additional file 5: Fig. S2).

Chromocenter segmentation of 3D nuclear images from Hoechst or DAPI staining
To demonstrate the ability of NODeJ to segment objects from grayscale images, we first analyzed the artificial dataset containing images with increasing signal-to-noise ratio, and confirmed the robustness of the results detected by our automated method (Additional file 4: Fig. S1). To further validate NODeJ, we then compared the results obtained by performing a manual count (52 nuclei for the Hoechst staining experiment, and 61 nuclei for the FISH experiment) to the NODeJ results. We observed similar results from the two methods (manual or automated via NODeJ) used to determine the number of chromocenters or FISH signals (Additional file 5: Fig. S2).
Following validation, we reanalyzed several datasets of nuclei stained with DNA dyes. Arpòn et al. [14] published images of isolated nuclei from various tissues from showing different levels of endoreduplication (i.e. ploidy level) and therefore different numbers of chromocenters. They analyzed the spatial organization of the chromocenters and showed that these heterochromatic domains are located at the nuclear periphery. This finding is in agreement with a previous report using whole-mount staining of cotyledons of A. thaliana, which revealed that chromocenters were localized at the nuclear periphery in the two cell types of the leaf epidermis [5].
First, we used NucleusJ2.0 [9] to obtain the masks of the nuclei from the Arpòn et al. [14] dataset. The distribution of nuclear volume as detected by NucleusJ2.0 was similar to that reported in the previous publication (centered ≈ 100 μm 3 ) ( Fig. 2A)   Fig. 2 Analysis of A. thaliana wild type nuclei with NODeJ. Results obtained from Arpòn et al. [14] describing chromocenters from isolated wild type nuclei (n=212) extracted from whole plants (Additional file 1). A-D. Histograms of chromocenters and nucleus characteristics. The histograms show the repartition of nuclear volume (A), the chromocenter volume (B), the chromocenter number per nucleus (C) and their distance to the nuclear envelope (D). The segmentation of the nuclei was obtained using NucleusJ2.0 with default parameters [9]. Histograms were made using various R packages [17,18] (Additional file 2 and 3 describe the computed parameters) [14]. We then used NODeJ to detect the size and the number of individual chromocenters for each nucleus. We found that 91% of chromocenters had a volume < 1 μm 3 (Fig. 2B), and we detected an average of 8 chromocenters per nucleus (Fig. 2C), comparable to the values found in Arpòn et al. [14]. We also analyzed the radial distance from the chromocenter boundary to the nearest border of the nuclear envelope. 75.5% of detected chromocenters were under 0.6 μm 3 from the nuclear periphery (Fig. 2D) compared to 80% in the original study [14]. All together, the results obtained with NODeJ are in agreement with previously published results.
Next, we tested whether NODeJ is able to detect known characteristics of the nuclear periphery mutants crwn1/2 [20] and kaku4 crwn1/4 [9] from the datasets of Poulet et al. [8] and Dubos et al. [9]. These mutants are known to alter nuclear morphology, chromatin organization and gene expression [8,9,20]. The crwn1/2 and kaku4 crwn1/4 mutant nuclei have a reduced number of chromocenters which are increased in volume compared to the chromocenters in wild type plants [8,9,20]. The nuclear images of Poulet the mean 180bp repeat signal volume per nucleus, D. the mean distance from 180bp repeat signal border to the nuclear envelope. Mann-Whitney U test P-value: * ≤0.05, *** ≤0.001. Box plots and statistical tests were made using various R packages [17,18,21] (Additional files 2 and 3 describe the computed parameters) et al. [8] (39 crwn1/2 mutant nuclei and 38 wild type nuclei) and Dubos et al. [9] (851 kaku4 crwn1/4 nuclei and 609 wild type nuclei) were acquired from the epidermis of whole-mount cotyledons (13 dag) stained with Hoechst (Fig. 3A, E). Our results show that NODeJ correctly detected the previously reported changes in heterochromatin organization in the guard cells (i.e. diploid cells forming the stomates in the leaf epidermis) of the crwn1/2 mutant (Fig. 3B, C, D). We observed a smaller number of chromocenters (Fig. 3B), an increase of their volumes (Fig. 3C), and a slight decrease in the distance between the chromocenter periphery and the nuclear periphery (Fig. 3D) [20]. Similar results were obtained by comparing kaku4 crwn1/4 triple mutants and wild type nuclei from the epidermis. We observed a decrease in the number of chromocenters per nucleus (average of 2.78 chromocenters per nucleus in the mutant and 4.25 for the wild type) (Fig. 3F), a 25% increase of their volumes (Fig. 3G), and an increase in the distance between the chromocenters and the nuclear envelope in the triple mutant (Fig. 3H). These differences in the kaku4 crwn1/4 mutants obtained with NODeJ are similar to the previously published characterization of chromocenters in this mutant [9].

3D DNA FISH signal segmentation via NODeJ
The 180bp repeat sequence is one of the constituents of chromocenters in A. thaliana, and its disorganization can impact heterochromatin silencing [5]. Dubos et al. [9] published a 3D image dataset of a FISH experiment labeling the 180bp repeats in kaku4 crwn1/4 and wild type nuclei (Fig. 4A). We applied NODeJ to segment and analyze the FISH signals in these images. The results from this analysis are similar to those obtained with Hoechst staining of nuclei from the same tissue and at the same developmental stage (Fig. 3F, G, H). The number of 180bp repeat signals observed (Fig. 4B) was reduced in the kaku4 crwn1/4 mutant compared to the wild type. The results obtained from the NODeJ analysis of the 3D FISH are consistent with the results obtained from the Hoechst staining (Fig. 3F). We also found an increase in the volume of the 180bp repeat FISH signals in the mutant compared to the wild type (Fig. 4C). However, we did not detect a significant change in the position of the 180bp repeats in the mutant (Fig. 4D), which is in contrast with the chromocenter position as analyzed in the Hoechst-stained images (Fig. 3H). Overall, the conclusions reached from using NODeJ are consitent with the results obtained with manual segmentation and analysis using NucleusJ2.0 [9].

Comparison of object detection between NODeJ and NucleusJ2.0
The chromocenter segmentation method available in NucleusJ2.0 uses the same input files as NODeJ, but applies a watershed immersion algorithm on the raw images [11,12]. This method in NucleusJ2.0 partitions the nucleus mask into a number of region intensities based on voxel values. The values of each region are weighed to create a map of contrast between neighbouring regions [22]. Subsequently, the user manually applies a specific thresholding to each image obtained by this method using the ImageJ GUI. This segmentation method works well to obtain a set of high intensity regions of interest to describe the nuclear chromatin organization, but the manual thresholding is slow ( ≈ 60 nuclei/hour). In addition, because the threshold is defined by the user, consistency between experiments, and even between nuclei, is not guaranteed. Therefore, this step represents a bottleneck for high-throughput analyses of nuclear images. In contrast, using NODeJ significantly accelerates the analysis of large datasets. For example, the analyses of the four different datasets (a total of 2014 nuclei [8,9,14]) using NODeJ took approximately 125 minutes of computational time, compared to ≈ 33 hours of manual labor if analyzed via NucleusJ2.0.
In order to further compare the results obtained from NODeJ and NucleusJ2.0, we used the wild type nuclei available in Poulet et al. [8] and Dubos et al. [9]. We found that segmentation by NODeJ and NucleusJ2.0 detected similar objects, but in both datasets, the objects defined by NODeJ tended to be fewer and larger (Fig. 5). For example, we sometimes observed in the FISH analysis (Fig. 5D) that the two programs detected the same regions, but NucleusJ2.0 defined several objects whereas NODeJ only identified one object. Therefore, the number of centromeric regions expected from the DNA FISH of 180bp repeats can be overestimated in larger nuclei by NucleusJ2.0. However, even though NucleusJ2.0 sometimes incorrectly defines subnuclear structures, this method still reveals the expected differences in comparisons between mutants and wild type.

Conclusion
Here, we presented NODeJ, a new software tool for automated detection of subnuclear structures. We demonstrated the accuracy of NODeJ by reanalyzing three public datasets of 3D nuclear images of A. thaliana. NODeJ was used for detection and quantification of two types of subnuclear structures in mutants with altered chromatin organization included in these datasets. Our results are in agreement with published assessments of these A. thaliana mutants.
Our main conclusion is that NODeJ is an effective novel tool for the automated segmentation of nuclear images, and is able to accurately identify heterochromatic domains from a diverse set of A. thaliana nuclei. NODeJ was developed as an extension of Nucle-usJ2.0 and allows for rapid automated analysis of subnuclear structures by eliminating the semi-automated steps inherent to the use of NucleusJ2.0, resulting in reduced processing time and biases in the analysis. Our method will also be valuable for the preparation of training datasets for machine learning applications by reducing time spent during manual segmentation.
In this study, we validated the NODeJ method by analyzing characteristics of heterochromatin domains. However, we believe that the utility of this tool could be extended to other datasets such as those obtained by nucleolar labeling or even for analysis of subcellular organelles outside of the nucleus (e.g. mitochondria). The ability to extend NODeJ to additional datasets will depend on the specific subcellular structures of interest being investigated. In conclusion, our study shows that NODeJ is a valuable approach to overcome the computational bottleneck of image analysis.

Availability and requirements
Project name: NODeJ Project home page: https:// gitlab. com/ axpou let/ image 2dana lysis Operating system(s): Platform independent Programming language: Java Other requirements: Java 10 or higher License: GPL-3.0 were obtained from wild type nuclei from Poulet et al. [8] and Dubos et al. [9]. We used the published results [8,9] for the NucleusJ2.0 results (Hoechst n = 253) and reanalyzed the global set of wild type nuclei available for NODeJ results (Hoechst n = 719) (Additional file 1). A-C comparison of Hoechst staining analysis. A. Z-projection of nuclei (Hoechst staining), and NucleusJ2.0 and NODeJ segmentation results (scale bar 2 μm 3 ). The denstity plots show the repartition of the number of chromocenters per nucleus (B) and the mean chromocenter volume per nucleus (C). D-F comparison of FISH analysis. D. Z-projection of nuclei (180bp repeats FISH) and segmentation results from NucleusJ2.0 and NODeJ (scale bar 2 μm 3 , each color is an individual object). Red arrows indicate the same region identified as two objects by NucleusJ2.0 and one object by NODeJ. The denstity plots show the repartition of the number of FISH signals per nucleus (n = 68 for NODeJ and NucleusJ2.0 results) (E), the mean FISH signals volume per nucleus (F). Density plots were made using various R packages [17,18] (Additional files 2 and 3 describe the computed parameters)