# NEIGHBOUR-IN: Image processing software for spatial analysis of animal grouping.

Yves Pierre-Louis Caubet, Freddie-Jeanne Richard

► To cite this version:

Yves Pierre-Louis Caubet, Freddie-Jeanne Richard. NEIGHBOUR-IN: Image processing software for spatial analysis of animal grouping.. Zookeys, 2015, 515, pp.173-189. 10.3897/zookeys.515.9390. hal-01204825

HAL Id: hal-01204825

https://hal.science/hal-01204825v1

Submitted on 10 Sep 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# NEIGHBOUR-IN: Image processing software for spatial analysis of animal grouping

Yves Caubet¹, Freddie-Jeanne Richard¹

Université de Poitiers - Faculté des Sciences, UMR CNRS 7267 EBI - “Écologie, Évolution, Symbiose”, Bat. B8-B35; 6, rue Michel Brunet, TSA 51106, F-86073 POITIERS Cedex 9, France

Corresponding author: Yves Caubet (yves.caubet@univ-poitiers.fr)

Academic editor: E. Hornung | Received 13 February 2015 | Accepted 11 May 2015 | Published 30 July 2015

http://zoobank.org/1D91A190-B5D5-4B6F-BC50-6831392176E5

**Citation:** Caubet Y, Richard F-J (2015) NEIGHBOUR-IN: Image processing software for spatial analysis of animal grouping. In: Taiti S, Hornung E, Štrus J, Bouchon D (Eds) Trends in Terrestrial Isopod Biology. ZooKeys 515: 173–189. doi: 10.3897/zookeys.515.9390

## Abstract

Animal grouping is a very complex process that occurs in many species, involving many individuals under the influence of different mechanisms. To investigate this process, we have created an image processing software, called NEIGHBOUR-IN, designed to analyse individuals' coordinates belonging to up to three different groups. The software also includes statistical analysis and indexes to discriminate aggregates based on spatial localisation of individuals and their neighbours. After the description of the software, the indexes computed by the software are illustrated using both artificial patterns and case studies using the spatial distribution of woodlice. The added strengths of this software and methods are also discussed.

## Keywords

Inter-individual distances, aggregation, individual attraction, spatial distribution

## Introduction

Group formation or crowd formation behaviour occurs in many taxa, from very simple organisms (bacteria) to highly complicated organisms (e.g. mammals), both wild and domestic (Krause and Ruxton 2002; Parrish and Edelstein-Keshet 1999; Parrish and Hamner 1997). Depending on the species, crowds of individuals are referred to as a
herd in mammals, flocks in birds, schools in fish, swarms in insects and many other terms that indicate aggregation. Species can be range to simply aggregated species with temporal fluid group composition to very complex and relatively stable composition with non-random structures (Kutsukake 2009).

Group living confers several advantage compare to solitary lifestyle and many ani-
mals live in groups for part or all of their lives. Aggregate can be the results of abiotic
factors and environmental heterogeneity (non-social aggregates) or relied on mutual
attraction (interattraction) resulting in different formation process (Broly et al. 2013).
In most of the cases, the ecological and social factors that explain group life are un-
known. Ecological factors favouring group life are numerous and usually addressed
the benefits from individuals association or differences in fitness related with spatial
position of individuals in groups (Krause and Ruxton 2002). The main two factors
are the availability of food and the presence of predators and the optimum group size
change according to the species and environmental pressure variations. For example,
group's dimension and geographical repartition change according of both predators
and food availability in starlings (Zoratto et al. 2009). Group size reduces the risk of
predation (Brown and Brown 1987) and offers a better foraging efficiency (Stacey
1986) and large groups present feeding advantage compared to small groups (Miller
and Dietz 2006). Little is known in general about how group size affects individual
welfare (Ohl and Putman 2014). Costs are mainly the result of competition for lim-
ited resources (food, mate, habitat...) and increase in group size favours disease trans-
mission, probability of infection and ectoparasitism that affect survival (Brown and
Brown 2004; Krause and Ruxton 2002).

Animal group formation is a complex dynamic system made up of potentially thousands of individuals. The group formation is the result of each individual's behaviour under the influence of many (and non-exclusive) parameters, such as heterogeneities of environment, inter-individual interactions, and temporal changes (ie, season, reproduction, and feeding) (Camazine et al. 2003; Sumpter and Pratt 2009). In cockroaches, the aggregation relies on mechanisms of amplification depending on the interactions with other individuals (Jeanson et al. 2005). Group dynamic is also the result of the heterogeneous social relationships and conflict management for maintaining group living in mammals (Kutsukake 2009). Moreover, animal groups exhibit different patterns according to the species (Parrish and Edelstein-Keshet 2000; Parrish and Edelstein-Keshet 1999) which necessitate incorporating species characteristics for conceptual questions and modelling.

To better understand group dynamic complexity, the identification of factor in-
fluencing group composition and how the dynamic change, it's necessary to provide
specific tools.

Many analytic models and simulation of aggregation (mathematical and comput-
er-based) offer interesting tools to investigate aggregation phenomena in various spe-
cies (Schellinck and White 2011), including scale of different aggregate-level behav-
iour (individuals, castes, groups, or species).
Description of animal movements in their environment is necessary to understand species, dispersion strategy as results of individual intrinsic factors, collective responses and social relationship (including change of individual composition moving in or out the group) and also to predict their geographical needs and spatial distribution, providing consistent data for models and simulation accuracy (Schellinck and White 2011).

In order to study aggregation patterns, researchers can use various methods for data collection that could be divided into three main categories (1) manual: observation and capture (Krause et al. 2000; Spieler 2003), photography and film (Aschwanden et al. 2008; Ballerini et al. 2008; Boulay et al. 2013; Eklund and Jensen 2011; Le Goff et al. 2009; Yoshida et al. 2010) (2) semi-manual: sonar and echo sound (Axelsen et al. 2001; Gerlotto et al. 2006; Gerlotto and Paramo 2003; Handegard 2007; Soria et al. 2003), (3) automatic: microtransponders (Jeanson 2012), RFID tagging (Planas-Sitja et al. 2015).

In the current study we propose a data processing software called NEIGHBOUR-IN which allows spatial coordinates to be attributed to individual (object) of up to three different categories (groups), such as species, sex, age, size, moult stage, etc. We illustrate the software applications with artificial patterns and experimental study of aggregation in terrestrial isopods (Crustacea, Oniscidea). The software then calculates indexes qualifying spatial distribution, composition of groups and many other parameters. All data outputs can be used for further analysis and quantification of spatial variations.

## Methods

NEIGHBOUR-IN is a software designed to analyse individuals' coordinates belonging to up to three different groups. The software can be used only for picture analysis and not for film analysis. However film screenshots in the appropriate format could be made to follow the dynamics of the studied processes. Once the image of the objects (i.e. individuals) is loaded, the user identifies each individual by clicking on anterior and posterior extremities. Each object belongs to up to three different groups. The software includes statistical analysis and indexes to discriminate aggregates based on spatial location of individuals and their neighbours. At the end of the treatment the table of coordinates can be exported for further spatial analysis. Different displays are available in order to show the aggregates or the influence distance of each object (for example the area where the antennas can touch and interact with another individual in the case of insects).

Software installation and procedures (Fig. 1) are detailed in a separate additional document (NEIGHBOUR-IN Reference Manual). In the current article we will define and illustrate the different indexes of inter-individual distances and spatial distribution provided by the software and how such indexes can be helpful in the analysis of spatial distribution of objects in general and animal aggregation in particular.

Three categories of output characterising the group structure and for statistics analysis are prepared: i) inter-individual distances; ii) aggregation profile; and iii) spatial distribution.
<figure><img src="image_2.png" /><figcaption>**Figure 1.** Flow chart of the creation of a new NEIGHBOUR-IN file. This figure presents the different steps in the creation of a new file, from the importation of the snapshot to the calculation of the statistics of dispersion.</figcaption></figure>
The indexes and data included in the statistics report are:

**Header:** all the parameters of the experiment (file name; image size in pixels; experiment name; total number of objects identified; calibration information with the ratio "pixel / centimetre", width or radius of the box and number of cells; and for each group: name, number of objects, mean body width).

**Inter-individual distance:** the mean inter-individual distances between the centre-point (G point) of all objects and both for each inter-group and intra-group combination are provided. In addition to the mean value, descriptive statistics are available in the output (sample size, standard error, minimum and maximum).

**Distance to nearest neighbours:** these descriptive statistics are identical to the ones described in the previous section (same inter-individual distances) but only between nearest neighbours (belonging to the same or different groups). The number of neighbours is defined by the user in the parameters dialog box.

**Statistics on aggregates:** When at least one of the three points of an object is included within the perception field of another object, both are considered aggregated. The perception field is calculated using the mean body width of the group multiplied by the perception ratio determined by the user for the group. The statistics include the number of aggregates automatically identified by the software; number and composition (type of group) of isolated objects; composition of each aggregate; percentage of aggregation in general and for each group (% Aggr.); and in the case of heterogeneous populations, Aggregation Heterogeneity Index (AHI). The AHI provides an estimate of the homogeneity of subpopulation distributions. It will be maximum (1) when the aggregates are "pure" (i.e. each one is composed by objects which belong to the same group) and minimum (0) when all individuals in the aggregates are equally mixed whatever their features. The index is calculated using the following formula:

$$AHI = \frac{\sum_{i}^{N} m_{i}}{M/2}$$

where N is the number of aggregates; mi is the minimum number of objects belonging to the same group for the aggregate i; M is the total number of objects aggregated.

**Statistics on distribution:** The area is divided in different cells by the software, defining a grid. The distribution of the objects on the area is described by two indexes: the Spatial Distribution Index (SDI) for each group, and the Spatial Mixed Index (SMI) for groups' pair comparison.

**Spatial Distribution Index (SDI)** is given for each group and is calculated by dividing the number of cells/sectors where at least one object of the group is present by the total number of objects in the group. SDI will be maximum (1) when each object is in a different cell and minimum when the objects are aggregated in few cells (0.125 for eight objects in the same cell). Therefore the SDI index is sensitive to
the number of cells (user defined) and the size of the objects (i.e. how many objects can contain a single cell).

**Spatial Mixed Index (SMI)** is calculated for two groups by dividing the number of cells in which at least one object of both groups is present by the total number of cells occupied by the two groups. SMI will be maximum (1) when all occupied cells contain mixed groups and minimum (0) when the objects of each group are all in different cells. The SMI between the three groups is also computed.

**Table of distribution:** The repartition of the objects (i.e. the number of objects from each group) in the different cells/sectors of the open field is presented in a table. The number of rows/columns is defined previously by the user (parameters dialog box).

**Table of coordinates:** The list of the coordinates of each point constituting the objects are presented in a table where the objects are in rows and the type of group is in columns. Group identity number, identity number of which aggregate the object is in, the object's width and length, and x and y coordinates in pixels for the three constitutive points (forward, gravity and backward) are included in this table.

## Illustrative examples

### Aggregation and dispersion indexes using artificial patterns

In order to validate the indexes computed by the software, we have designed artificial patterns using two groups of objects. The placement of each object has been chosen in order to reflect i) a high level of aggregation or no aggregation at all; ii) a high, medium, low or null level of inter-group affinity. The patterns are provided on the top three rows of Table 1 and illustrated by Figs 2.1–2.8. Additionally, ten replicates with random distribution of objects have been calculated. The last artificial patterns present the maxima and minima obtained in the random replicates (Table 1). The goal is to use a set of indexes able to discriminate between the different patterns.

Aggregation patterns can be discriminated by comparing the different indexes (see Table 1). For example, we will compare data for artificial patterns 1–4 (high aggregation) with 5–7 (high dispersion) for the red group, and between patterns 1–5 (high aggregation) and 6–7 (high dispersion) for the green group.

The three categorical values of aggregation (% Aggr.) reflect the overall aggregation pattern (100%, 50% or 0%) and for each group (100% or 0%) for extreme cases. The percentages of aggregation do not discriminate between two groups with a high level of aggregation, but their level of affinity differs.

The Aggregation Heterogeneity Index (AHI) can be used to discriminate between configurations where both groups are highly aggregative according to the presence or absence of affinity between them.

The Number of Aggregates index (*Nb Aggr.*) will show the exact number of aggregate but without providing affinity information (except in case of null affinity). When the two groups are not aggregating in the same way, the index is similar (for example
<table><caption>**Table 1.** Evolution of indexes in different virtual configurations. Specific patterns of intra-group aggregation and inter-group affinity based on eight virtual configurations composed of two groups of 8 objects (Red and Green). The last configuration (named Random) is the average of ten replicates of a random distribution of 16 objects and presents also minima and maxima of the indexes. Each configuration is illustrated by the Figures 2.1–2.8. Categories of indexes are: i) Inter-individual distances between all objects (All), or objects of the red (Red) or green groups (Gr); ii) Nearest neighbours distances considering only the three nearest neighbours; iii) Number of aggregates (Nb Aggr.), Aggregation heterogeneity index (AHI); Overall aggregation level (%Aggr. All) and aggregation level for each group (%Aggr. Red) and %Aggr. Green); iv) Spatial distribution index (SDI) for each group and Spatial Mixed Index (SMI) between both groups.</caption><thead><tr><th rowspan="2">Groups:</th><th rowspan="2">Configuration</th><th rowspan="2">Virtual 1</th><th rowspan="2">Virtual 2</th><th rowspan="2">Virtual 3</th><th rowspan="2">Virtual 4</th><th rowspan="2">Virtual 5</th><th rowspan="2">Virtual 6</th><th rowspan="2">Virtual 7</th><th colspan="2">Virtual 8 (10 repl.)</th></tr><tr><th>Random</th><th>Random</th></tr><tr><th>Red</th><th>Aggregation</th><th>High</th><th>High</th><th>High</th><th>High</th><th>None</th><th>None</th><th>None</th><th>Minimum</th><th>Maximum</th></tr><tr><th>Green</th><th>Aggregation</th><th>High</th><th>High</th><th>High</th><th>High</th><th>High</th><th>None</th><th>None</th><th></th><th></th></tr><tr><th>Red/Green</th><th>Affinity</th><th>High</th><th>Medium</th><th>Low</th><th>None</th><th>None</th><th>Medium</th><th>None</th><th></th><th></th></tr><tr><th colspan="11">Categories of index:</th></tr><tr><th rowspan="10">Inter-individual<br>Distances</th><th>All &lt;&gt; All</th><td>62</td><td>59</td><td>61</td><td>454</td><td>364</td><td>326</td><td>363</td><td>301</td><td>374</td></tr><tr><th>Red &lt;&gt; All</th><td>60</td><td>66</td><td>81</td><td>819</td><td>537</td><td>318</td><td>425</td><td>304</td><td>365</td></tr><tr><th>Red &lt;&gt; Red</th><td>63</td><td>64</td><td>40</td><td>38</td><td>293</td><td>334</td><td>292</td><td>307</td><td>451</td></tr><tr><th>Red &lt;&gt; Gr.</th><td>60</td><td>66</td><td>81</td><td>819</td><td>537</td><td>318</td><td>425</td><td>304</td><td>365</td></tr><tr><th>Gr. &lt;&gt; All</th><td>60</td><td>66</td><td>81</td><td>819</td><td>537</td><td>318</td><td>425</td><td>304</td><td>365</td></tr><tr><th>Gr. &lt;&gt; Gr.</th><td>66</td><td>39</td><td>38</td><td>39</td><td>37</td><td>335</td><td>293</td><td>254</td><td>400</td></tr><tr><th>All &lt;&gt; All</th><td>37</td><td>39</td><td>38</td><td>149</td><td>160</td><td>195</td><td>223</td><td>177</td><td>247</td></tr><tr><th>Red &lt;&gt; All</th><td>32</td><td>46</td><td>60</td><td>799</td><td>517</td><td>175</td><td>303</td><td>164</td><td>239</td></tr><tr><th>Red &lt;&gt; Red</th><td>49</td><td>45</td><td>31</td><td>32</td><td>219</td><td>249</td><td>211</td><td>232</td><td>344</td></tr><tr><th>Red &lt;&gt; Gr.</th><td>32</td><td>46</td><td>60</td><td>799</td><td>517</td><td>175</td><td>303</td><td>164</td><td>239</td></tr><tr><th>Gr. &lt;&gt; All</th><td>31</td><td>51</td><td>62</td><td>799</td><td>410</td><td>169</td><td>307</td><td>162</td><td>210</td></tr><tr><th>Gr. &lt;&gt; Gr.</th><td>49</td><td>32</td><td>31</td><td>31</td><td>31</td><td>257</td><td>220</td><td>169</td><td>320</td></tr><tr><th rowspan="5">Nearest<br>Neighbours<br>Distances</th><th>Nb Aggr.</th><td>1</td><td>1</td><td>1</td><td>2</td><td>1</td><td>0</td><td>0</td><td>0</td><td>3</td></tr><tr><th>AHI</th><td>1</td><td>1</td><td>1</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>1</td></tr><tr><th>%Aggr. All</th><td>100</td><td>100</td><td>100</td><td>100</td><td>50</td><td>0</td><td>0</td><td>0</td><td>43.75</td></tr><tr><th>%Aggr. Red</th><td>100</td><td>100</td><td>100</td><td>100</td><td>0</td><td>0</td><td>0</td><td>0</td><td>37.50</td></tr><tr><th>%Aggr. Gr.</th><td>100</td><td>100</td><td>100</td><td>100</td><td>100</td><td>0</td><td>0</td><td>0</td><td>50.00</td></tr><tr><th rowspan="3">Spatial<br>distrib.</th><th>SDI Red</th><td>0.5</td><td>0.25</td><td>0.13</td><td>0.13</td><td>1</td><td>1</td><td>1</td><td>0</td><td>1</td></tr><tr><th>SDI Gr.</th><td>0.5</td><td>0.13</td><td>0.13</td><td>0.13</td><td>0.13</td><td>1</td><td>1</td><td>0</td><td>1</td></tr><tr><th>SMI Red-Gr.</th><td>1</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0.88</td></tr></thead></table>
<figure><img src="image_3.png" /></figure>

<figure><img src="image_4.png" /><figcaption>**Figure 2.** Virtual configurations used for software validation. Virtual configurations used to compile the data presented in the Table 1. Part 2.8 is one of the 10 replicates obtained with a random distribution. All other configurations have been designed in order to reach the desired level of aggregation and affinity between groups. The filled and empty shapes represented two virtual groups in the population.</figcaption></figure>
between configurations 3 and 5). In our example group affinity will be characterised
more using the spatial distribution index.

The Spatial Distribution Index (SDI) reflects the different aggregation patterns for both groups. However, in the case of high affinity between groups, the index increases significantly.

The other index of this category, the Spatial Mixed Index (SMI), reflects the high affinity in configuration 1. However, such an index is similar in the other configurations. These two indexes of spatial distribution are complementary to other indexes.

In the case of non-aggregative groups, showing or not a relative affinity (for example configuration 6 or 7 respectively), neither the percentage of aggregation nor the number of aggregates differs. In this case (see Fig. 2.6 and 2.7) the comparison of inter-individual distances will be the most informative to characterise individual affinity.

Inter-individual distance is a good indicator of aggregation level. Intra-group inter-individual distances are minimal when aggregation level is high. However, Table 1 shows that when affinity is high between groups, such intra-group inter-individual distances increase, as immediate neighbours can belong to both groups due to affinity (configurations 1–2). Use of distances to nearest neighbours limits this inconvenience. The inter-group distances are good indicators of the relationship between groups. Finally, the different levels of affinity between groups differentiate these two configurations.

Case study: Aggregation in Woodlice

The indexes have been tested using snapshots of individual distribution in terrestrial crustacean species (Oniscidea). Woodlice are good candidates for aggregation studies since such behaviour is widespread in this group and is explained as an adaptive response supporting their conquest of terrestrial life (Broly et al. 2013; Broly et al. 2012; Caubet et al. 1998; Caubet et al. 2008) and is under social component (Beauché and Richard 2013; Devigne et al. 2011). Such crustaceans present several specific constraints (weakness, group density. etc.) which lead to difficulties in real time tracking in comparison to insects.

First, we compared three gregarious species (groups): *Porcellio dilatatus* (PD), *Porcellio scaber* (PS) and *Cylisticus convexus* (CC). Three different combinations of two groups of eight individuals (“objects”) are placed in a squared arena (width 12.3 cm) divided into 64 cells. After one hour, a snapshot is taken (Fig. 3) and the distribution of the individuals is analysed with NEIGHBOUR-IN. We used indexes in order to characterise our aggregates according to group characteristics. In a second step, we added the species *Armadillidium vulgare* (AV) to PD and PS. This species presents a more scattered aggregation pattern (Hassall et al. 2010). A snapshot is taken after one hour and analysed. The indexes are presented in Table 2 and the outputs concerning spatial distribution in Fig. 4 (“*Surfaces*” output display).

In our combinations, a first analysis focused on the main aggregate obtained in
each combination using AHI and SMI indexes as descriptors of the quality of the ag-
<figure><img src="image_5.png" /><figcaption>**Figure 3.** Aggregation heterogeneity in woodlice. Aggregation patterns of two groups of woodlice illustrating the Aggregation Heterogeneity Index (AHI) and the Spatial Mixed Index (SMI). PD: *P. dilatatus*, PS: *P. scaber*, CC: *C. convexus*. Values of indexes: PD-PD: AHI=0.93 & SMI=0.80; PD-PS: AHI=0.67 & SMI=0.60; PD-CC: AHI=0.63 & SMI=0.33.</figcaption></figure>

<table><caption>**Table 2.** Evolution of indexes in real configurations. Specific patterns of intra-group aggregation and inter-group affinity based on three real configurations composed of two groups of 8 woodlice (Red and Green). PD: *P. dilatatus*; PS: *P. scaber*; AV: *A. vulgare*. Each configuration is illustrated by figs 4.a-4.c. See Table 1 for the description of the categories of indexes.</caption><thead><tr><th>Groups</th><th>Configuration</th><th>PD-PD</th><th>PD-PS</th><th>PD-AV</th></tr></thead><tbody><tr><td rowspan="2">Species</td><td>Red</td><td>PD</td><td>PD</td><td>PD</td></tr><tr><td>Green</td><td>PD</td><td>PS</td><td>AV</td></tr><tr><td colspan="5">Categories of index:</td></tr><tr><td rowspan="7">Inter-individual<br>Distances</td><td>All &lt;&gt; All</td><td>188</td><td>174</td><td>541</td></tr><tr><td>Red &lt;&gt; All</td><td>188</td><td>183</td><td>550</td></tr><tr><td>Red &lt;&gt; Red</td><td>71</td><td>279</td><td>449</td></tr><tr><td>Red &lt;&gt; Gr.</td><td>188</td><td>183</td><td>550</td></tr><tr><td>Gr. &lt;&gt; All</td><td>188</td><td>183</td><td>550</td></tr><tr><td>Gr. &lt;&gt; Gr.</td><td>305</td><td>50</td><td>614</td></tr><tr><td>All &lt;&gt; All</td><td>113</td><td>107</td><td>302</td></tr><tr><td rowspan="6">Nearest<br>Neighbours<br>Distances</td><td>Red &lt;&gt; All</td><td>49</td><td>160</td><td>288</td></tr><tr><td>Red &lt;&gt; Red</td><td>53</td><td>217</td><td>305</td></tr><tr><td>Red &lt;&gt; Gr.</td><td>49</td><td>160</td><td>288</td></tr><tr><td>Gr. &lt;&gt; All</td><td>155</td><td>54</td><td>321</td></tr><tr><td>Gr. &lt;&gt; Gr.</td><td>130</td><td>37</td><td>492</td></tr><tr><td>Nb Aggr.</td><td>1</td><td>2</td><td>4</td></tr><tr><td rowspan="4">Aggregation</td><td>AHI</td><td>0.93</td><td>0.67</td><td>0.20</td></tr><tr><td>%Aggr. All</td><td>93.75</td><td>93.75</td><td>62.50</td></tr><tr><td>%Aggr. Red</td><td>100.00</td><td>87.50</td><td>87.50</td></tr><tr><td>%Aggr. Gr.</td><td>87.50</td><td>100.00</td><td>37.50</td></tr><tr><td rowspan="3">Spatial<br>distrib.</td><td>SDI Red</td><td>0.500</td><td>0.500</td><td>0.75</td></tr><tr><td>SDI Gr.</td><td>0.625</td><td>0.375</td><td>1</td></tr><tr><td>SMI Red-Gr.</td><td>0.800</td><td>0.400</td><td>0.077</td></tr></tbody></table>

gregates (Fig. 3). In these snapshots the aggregate is composed of animals from both groups. However, the pattern of aggregation is different and the inter-individual distances cannot be used, since all individuals are close to one other. However, the use of
<figure><img src="image_6.png" /></figure>

**Figure 4.** Spatial distribution in woodlice. Graphic outputs of spatial distribution patterns obtained in three configurations with monospecific or bispecific populations including two groups of eight individuals: **a** PD-PD: The two groups are *P. dilatatus* (red and green) **b** PD-PS: *P. dilatatus* (red) and *P. scaber* (green) **c** PD-AV: *P. dilatatus* (red) and *A. vulgare* (green). The outputs show 64 cells. Each cell is represented with a colour corresponding to the individual(s) in that cell. The colour is mixed using green and red proportional to the number of green and red individuals. If the cell is empty, the colour is black. The intensity of the colour reflects the number of individuals. The position of the individual is determined by its point G (centre-point).
*AHI* and *SMI* indexes can be informative since they differentiate the three combinations. When the two groups belong to the same species *P. dilatatus* (PD-PD, Fig. 3.a), affinity score is at a maximum between individuals and the *AHI* and *SMI* are at their highest score (respectively 0.93 and 0.80). When both groups belong to the species *P. dilatatus* and *Cylisticus convexus* (PD-CC, Fig. 3.c), the *AHI* and *SMI* are at their lowest (respectively 0.63 and 0.33). The intermediary configuration with the species *P. dilatatus* and *P. scaber* (PD-PS, Fig. 3.b) shows intermediary indexes (respectively 0.67 and 0.60). In conclusion, even in the case of very aggregative species, the quality of the aggregation pattern, matched with the affinity between individuals, can be characterised using a combination of complementary indexes.

The distribution of the two groups and the aggregation level appear to be very different according to the species pairing (Fig. 4). The indexes computed by NEIGHBOUR-IN reflect qualitative and quantitative differences in aggregation pattern variability well (see indexes on Table 2).

In the homospecific combination of the species *P. dilatatus* (PD-PD, Fig. 4.a) a single individual in the green group is isolated while all other individuals are crowded in a single mixed aggregate (five cells among 64 contain individuals). Only the cell containing the isolated individual is pure (bottom right corner on Fig. 4.a), while the four other cells contain animals that belong to both groups (*SMI* = 0.8; most of the cells contain individuals from both groups) and the distribution is totally mixed (*AHI* = 0.93; higher level of heterogeneity in the aggregate). The inter-individual distances show differences between red and green groups due to the isolated green individual (71 and 305 for reds and greens respectively). The nearest neighbour distances adjust the values especially for the green group (53 and 130 for reds and greens respectively). The intra- and inter-group distances are similar (53 and 49 pixels respectively). Aggregation indexes reflect the high level of aggregation of both groups (between 100% and 87.5% for reds and greens respectively). Concerning the spatial distribution index (*SDI*), the fact that one individual is isolated in the green group induces a small difference in the index (0.5 and 0.625 for red and green groups respectively).

In the heterospecific combination, with the species *P. dilatatus* – *P. scaber* (PD-PS, Fig. 4.b), we obtain two distinct aggregates located in the two opposed corners of the arena. Even if both species present a high level of aggregation (87.5% and 100% for PD and PS), the indexes are able to differentiate the quality of aggregation in comparison to the homospecific configuration (PD-PD). Both *AHI* and *SDI* values decrease (0.67 and 0.4 respectively). We observed that individuals in the same aggregate are sharing a single cell (Fig. 4.b). The other individuals are juxtaposed but not mixed, and stay close to conspecifics. Among the five occupied cells, four of them are occupied by individuals of the same group. Inter-individual distances increase because the aggregates are separated. The nearest neighbour distances adjust the values, and we observe an inter-group distance higher than in the homospecific configuration (169 rather than 49).

The third combination, using the two species *P. dilatatus* and *A. vulgare* (PD-AV, Fig. 4.c) presents another pattern of distribution: The green group (*A. vulgare*) appears
less aggregative than the red group (*P. dilatatus*) (37.5% and 87.5% respectively). In this configuration, four aggregates are identified by the software. The *AHI* index, reflecting the mixture of the aggregates, is very low (0.2) compared to homospecific and genera-related configurations (0.93 and 0.67 respectively). Moreover, the spatial distribution is completely different for both species: *A. vulgare* shows the maximum value of *SDI* index (1.0) meaning that each individual is in a different cell, and *P. dilatatus* shows a more dispersed distribution (0.75) than in the other two combinations (PD vs. PD and PD vs. PS) (0.5).

## Discussion

Our image processing software, NEIGHBOUR-IN, provides indices with efficient discriminatory power to characterize and analyse group structure using individuals' coordinates. In the features of the software we integrate elementary statistical analysis and complementary index calculation that are important tools to describe aggregations, as well as a new index for more precise analysis. We provided examples based on random data and a case study using gregarious arthropods to highlight the accuracy of the output information. Moreover, the raw data, individual coordinates and location can be directly manipulated by the researcher for specific analysis such as simulation, modelling, and classic spatial statistics.

One of the assets of NEIGHBOUR-IN is the distinction between up to three groups and the open group size, which allow for a variety of applications. The differentiation between groups of individuals can be applied to compare intra-specific and inter-individual affinity according to size, age, sex, moult stage, health, and genetic relatedness at the individual level. Behavioural adaptive responses in inter-specific interactions is also an important field of investigation, and NEIGHBOUR-IN could be a new tool to study prey-predator, host-parasite, and commensalism impacts on group formation and composition. How the dispersion of animals in heterogeneous habitat and physical environment changes the aggregation pattern can also be investigated with this method. Moreover, the management of the image doesn't require a specific template or scale, and can be used with all type of images including aerial images of vertebrates, to macro photography of small invertebrates, and even picture under microscope with micro-organisms.

In comparison with the tools available in aggregation analysis, NEIGHBOUR-IN appears to be an accessible, light, and open solution. Our software is designed for analysis at a point-time however continuous monitoring of behavioural is not possible. The level of integration and data analysis complexity is smaller in comparison to GIS systems, which require user training and specific data templates and libraries. Other powerful softwares that track and analyse animal movement, such as Noldus ETHOVISION, analyse in real time and are not designed for snapshot analysis. Noldus ETHOVISION analyses are automated and qualitative information on aggregates could be missed. Many species present complex aggregate structures and often in three
dimensions so that a fully automatic tracking is necessarily imprecise. For example, when two individuals are superimposed, softwares like Noldus ETHOVISION lose track of the two individuals (one source of imprecision) and then randomly assign the initial characteristics to individuals when they separate, so that both intermediate and final results can lead to incoherency. Our semi-manual software allows manual localisation of individuals, increasing the precision of the spatial encoding, while keeping an automatic acquisition of results and analyses. Moreover, the user is able to identify orientation of individual (anterior and posterior extremities) with its perception area and consequently the possibility of interactions or not.

Finally, this software promises to evolve with new features, and could be used to generate and export distribution and coordinates database for other purposes. Potential fields of applications could be evolution of invasive species (animals and plants) distribution using aerial image, competition of fungus or microbial colonies, identification of harems in marine mammals grouping and so on.

The main limitations of NEIGHBOUR-IN software are in the potential excessive overlap of the individuals in an aggregate, and the total number of group and individuals taken into account. However, in both case, the user himself/herself is confronted to difficulties and the task, even if it is complicated, will be easier using NEIGHBOUR-IN. In comparison to a direct analysis of the image, the advantage to generating NEIGHBOUR-IN data files is that the image is saved with the coordinates but the statistics are managed separately, which allows the researcher to re-use the same files with further statistical analysis, as well as the integration of new graphic outputs and indexes.

## Acknowledgements

Authors are grateful to Holly McKelvey for English revision, P. Broly for his comments, and the anonymous reviewers.

## References

* Aschwanden J, Gygax L, Wechsler B, Keil NM (2008) Social distances of goats at the feeding rack: Influence of the quality of social bonds, rank differences, grouping age and presence of horns. Applied Animal Behaviour Science 114: 116–131. doi: 10.1016/j.applanim.2008.02.002

* Axelsen BE, Anker-Nilssen T, Fossum P, Kvamme C, Nøttestad L (2001) Pretty patterns, but a simple strategy: predator-prey interactions between juvenile herring and atlantic putfins observed with multi-beam sonar. Canadian Journal of Zoology 79: 1586–1596. doi: 10.1139/z01-113

* Ballerini M, Cabibbo N, Candelier R, Cavagna A, Cisbani E, Giardina I, Lecomte V, Orlandi A, Parisi G, Procaccini A, Viale M, Zdravkovic V (2008) Interaction ruling animal col-
lective behavior depends on topological rather than metric distance: evidence from a field study. Proceedings of the National Academy of Sciences 105: 1232-1237.

Beauché F, Richard F-J (2013) The best timing of mate search in *Armadillidium vulgare* (Isopoda, Oniscidea). PLoS ONE 8: e57737. doi: 10.1371/journal.pone.0057737

Boulay J, Devigne C, Gosset D, Charabidze D (2013) Evidence of active aggregation behaviour in Lucilia sericata larvae and possible implication of a conspecific mark. Animal Behaviour 85: 1191-1197. doi: 10.1016/j.anbehav.2013.03.005

Broly P, Denebourg J-L, Devigne C (2013) Benefits of aggregation in woodlice: a factor in the terrestrialization process? Insectes Sociaux 60: 419-435. doi: 10.1007/s00040-013-0313-7

Broly P, Mullier R, Deneubourg JL, Devigne C (2012) Aggregation in woodlice: social interaction and density effects. ZooKeys 176: 133-144. doi: 10.3897/zookeys.176.2258

Brown C, Brown M (1987) Group-living in cliff swallows as an advantage in avoiding predators. Behavioral Ecology and Sociobiology 21: 97-107. doi: 10.1007/bf02395437

Brown C, Brown M (2004) Group size and ectoparasitism affect daily survival probability in a colonial bird. Behavioral Ecology and Sociobiology 56: 498-511. doi: 10.1007/s00265-004-0813-6

Camazine S, Denebourg J-L, Franks NR, Sneyd J, Theraulaz G, Bonabeau E (2003) Self-organization in biological systems. Princeton University Press, 538 pp.

Caubet Y, Juchault P, Mocquard JP (1998) Biotic triggers of female reproduction in the terrestrial isopod *Armadillidium vulgare* Latr. (Crustacean: Oniscidea). Ethology Ecology Evolution 10: 209-226. doi: 10.1080/08927014.1998.9522853

Caubet Y, O'Farrell G, Lefebvre F (2008) Geographical variability of aggregation in terrestrial isopods: What is the actual significance of such behaviour? In: Zimmer M, Charfi Cheikhrouha F, Taiti S (Eds) Proceedings of the International Symposium of Terrestrial Isopod-ISTIB07. Shaker Verlag, Germany, 137-148.

Devigne C, Broly P, Deneubourg JL (2011) Individual Preferences and Social Interactions Determine the Aggregation of Woodlice. PLoS ONE 6: e17389. doi: 10.1371/journal.pone.0017389

Eklund B, Jensen P (2011) Domestication effects on behavioural synchronization and individual distances in chickens (*Gallus gallus*). Behavioural processes 86: 250-256. doi: 10.1016/j.beproc.2010.12.010

Gerlotto F, Bertrand S, Bez N, Gutiérrez M (2006) Waves of agitation inside anchovy schools: a way to transmit information and facilitate fast morphological and structural changes in response to predation, as observed with multibeam sonar. ICES Journal of Marine Science 63: 1405-1417. doi: 10.1016/j.icesjms.2006.04.023

Gerlotto F, Paramo J (2003) The three-dimensional morphology and internal structure of clupeid schools as observed using vertical scanning multibeam sonar. Aquatic Living Resources 16: 113-122. doi: 10.1016/S0990-7440(03)00027-5

Handegard NO (2007) Observing individual fish behavior in fish aggregations: Tracking in dense fish aggregations using a split-beam echosounder. The Journal of the Acoustical Society of America 122: 177-187. doi: 10.1121/1.2739421

Hassall M, Edwards D, Moss A, Derhé M, Carmenta R (2010) Predicting the effect of climate change on aggregation behaviour in four species of terrestrial isopods. Behaviour 147: 151-164. doi: 10.1163/000579509x12512861455834
Jeanson R (2012) Long-term dynamics in proximity networks in ants. Animal Behaviour 83: 915–923. doi: 10.1016/j.anbehav.2012.01.009

Jeanson R, Rivault C, Deneubourg J-L, Blanco S, Fournier R, Jost C, Theraulaz G (2005) Self-organized aggregation in cockroaches. Animal Behaviour 69: 169–180. doi: 10.1016/j.anbehav.2004.02.009

Krause J, Hoare DJ, Croft D, Lawrence J, Ward A, Ruxton GD, Godin J-GJ, James R (2000) Fish shoal composition: mechanisms and constraints. Proceedings of the Royal Society B 267: 2011–2017. doi: 10.1098/rspb.2000.1243

Krause J, Ruxton GD (2002) Living in groups. Oxford University Press, Oxford, 210 pp.

Kutsukake N (2009) Complexity, dynamics and diversity of sociality in group-living mammals. Ecological Research 24: 521–531. doi: 10.1007/s11284-008-0563-4

Le Goff G, Mailleux AC, Detrain C, Deneubourg JL, Clotuche G, Hance T (2009) Spatial distribution and inbreeding in *Tetranychus urticae*. *Comptes Rendus Biologies* 332: 927–933. doi: 10.1016/j.crvi.2009.06.002

Miller KE, Dietz JM (2006) Effects of Individual and Group Characteristics on Feeding Behaviors in Wild *Leontopithecus rosalia*. *International Journal of Primatology* 26: 1291–1319. doi: 10.1007/s10764-005-8854-7

Ohl F, Putman RJ (2014) Animal Welfare at the Group Level: More Than the Sum of Individual Welfare? *Acta Biotheoretica* 62: 35–45. doi: 10.1007/s10441-013-9205-5

Parrish J, Edelstein-Keshet L (2000) Response to “benefits of membership”. *Science* 287: 804–805.

Parrish JK, Edelstein-Keshet L (1999) Complexity, pattern, and evolutionary trade-offs in animal aggregation. *Science* 284: 99–101. doi: 10.1126/science.284.5411.99

Parrish JK, Hamner WM (1997) Animals Groups in Three Dimensions. Cambridge University Press, 378 pp. doi: 10.1017/CBO9780511601156

Planas-Sitja I, Deneubourg JL, Gibon C, Sempo G (2015) Group personality during collective decision-making: a multi-level approach. *Proceedings of The Royal Society* 282. doi: 10.1098/rspb.2014.2515

Schellinck J, White T (2011) A review of attraction and repulsion models of aggregation: Methods, findings and a discussion of model validation. *Ecological Modelling* 222: 1897–1911. doi: 10.1016/j.ecolmodel.2011.03.013

Soria M, Bahri T, Gerlotto F (2003) Effect of external factors (environment and survey vessel) on fish school characteristics observed by echosounder and multibeam sonar in the mediterranean sea. *Aquatic Living Resources* 16: 145–157. doi: 10.1016/S0990-7440(03)00025-1

Spieler M (2003) Risk of predation affects aggregation size: a study with tadpoles of *Phrynoman-
tis microps* (anura: Microhylidae). Animal Behaviour 65: 179–184. doi: 10.1006/
anbe.2002.2030

Stacey P (1986) Group size and foraging efficiency in yellow baboons. Behavioral Ecology and Sociobiology 18: 175–187. doi: 10.1007/bf00290821

Sumpter DJ, Pratt SC (2009) Quorum responses and consensus decision making. Proceedings of the Royal Society B 364: 743–753. doi: 10.1098/rstb.2008.0204

Yoshida T, Akagi K, Toda T, Kushairi MMR, Kee AAA, Othman BHR (2010) Evaluation of fish behaviour and aggregation by underwater videography in an artificial reef in Tioman island, Malaysia. *Sains Malaysia* 39: 395–403.
Zoratto F, Santucci D, Alleva E (2009) Theories commonly adopted to explain the antipredatory benefits of the group life: the case of starling (*Sturnus vulgaris*). Rendiconti Lincei 20: 163-176. doi: 10.1007/s12210-009-0042-z