# 3D school detection algorithms

Echoview can perform 3D school detection using one of several algorithms depending upon the scanning mode used when collecting the data:

Each algorithm will produce one or more 3D regions. The algorithm used in creating the region can be seen under Further information on the General page of the Region Properties dialog box. Additional 3D school detection information for each region is recorded on the Notes page of the Region Properties dialog box.

Note: A detection warning is displayed when GPS fix times do not overlap the specified detection ping range times.

## Basic algorithm

The basic 3D school detection algorithm is used in two different contexts:

In both cases it proceeds as follows:

1. Scan through the variable and discard any pings which:
1. cross the previous undiscarded ping, or
2. lie, in part or entirely, between the previous undiscarded ping and the undiscarded ping prior to it
3. are outside the specified Ping range of the Detect 3D Schools dialog box.

Note: This is an attempt to avoid very unusual folding back shapes which are not a good representation of a real school and would cause ambiguity in the calculation of certain 3D Region metrics. The precise manner in which the test is performed may differ slightly to that suggested here.

2. For each remaining ping:
1. Create a virtual ping with data points set to either 1 (include for the detection) or 0 (excluded from the detection).
Note:
Data points are removed from the detection if:
1. their value is outside the range of values defined by the Minimum threshold and Maximum threshold settings on the Data page of the Variable Properties dialog box, or
2. their range is greater than the range threshold (Beyond minimum range of Exclude below surface and/or Exclude below surface additional depth offset) defined on the Analysis page of the Variable Properties dialog box.
3. their depth/range is above the specified Exclude above surface.
4. their depth/range is below the specified Exclude below surface.
2. Identify intervals (contiguous groups of 1s) in each beam.
3. Form (nearly) rectangular prisms from each interval. These prisms span the distance between this ping and the next ping.
Note:
Echoview will complete this step regardless of the actual distance between pings. If your data file contains large gaps between pings, (e.g. you did not log data while moving a vessel between transects) and you do not think the pings on either side of that gap were insonifying the same school, you may wish to do multiple detections and set a limited range of pings for each detection on the Data page of the Detect 3D schools dialog box.
4. Triangulate the prisms. That is, reduce each surface of each prism to two triangles.
5. Store details of the vertices of the triangles that represent the visible surfaces.
3. From the resulting data (i.e. the data from all pings):
1. Analyze vertices and discard non-visible surfaces.
Note: These are all the surfaces shared by more than one prism
2. Define groups of connected vertices.
Note:
Vertices are considered connected if they lie on a common triangle, and any one vertex may lie on more than one triangle.
3. Create a 3D region for each set of connected vertices and the triangles containing them.
Note:
If schools are not connected (even for a single ping) they will be treated as separate schools and separate 3D regions will be created.
4. Identify vacuoles (hollow areas within a fully enclosing larger school).
5. Identify and discard sub-schools (a school within a fully enclosing larger school, i.e. within a vacuole).
6. Calculate the object-aligned bounding box for each 3D region and each vacuole.
7. Compare the dimensions of the object-aligned bounding box for each school with the minimum school dimensions defined on the Size Criteria page of the Detect 3D schools dialog box and discard schools that do not meet the minimum size requirements.
8. Calculate 3D object properties for the 3D regions.

Notes:

• School detection settings can be seen on the Notes page of the 3D Region properties dialog box.
• Exclude above or Exclude below surfaces and Bottom elimination for 3D school detection settings are not applied if there is no GPS fix associated with a ping.

## Cruise scanning algorithm

Used for cruise scanning data only. The basic algorithm is applied with the following restrictions:

For cruise scanning school detection on H-mode variables:

• Only the leading face is considered. Data on the trailing face is disregarded for the purpose of school detection.
See About ping modes for further information.
• The tilt angle of all pings in the detection must be the same, and greater than 5°.

For cruise scanning school detection on V-mode variables:

• The bearing angle of pings in the detection must be the same, and further than 5° from the alongship axis.

For cruise scanning school detection on S-mode variables:

• The tilt angle of all pings in the detection must be the same and greater then 5°.
• The bearing angle of pings in the detection must be the same and further than 5° from the alongship axis.

## Instrument Scanning algorithm

Note: We strongly recommend you prepare your data for school detection before applying this algorithm.

Used for instrument scanning data only.

The algorithm works as follows:

1. Divide the data into frames.
2. To each frame, apply the basic algorithm.

## By ping algorithm

The By ping algorithm is an application of the basic algorithm to each ping individually, producing zero, one or more 3D regions for each ping considered, each of which has a uniform Region width as specified on the Data page of the Detect 3D Schools dialog box. The By ping algorithm is also used when you do a detection on a displayed ping.

Each ping is modeled as a zero width plane and the  Region width is measured in a direction orthogonal to that plane extending an equal distance either side of the plane.

The resulting algorithm proceeds as follows:

1. For each ping:
1. Create a virtual ping with data points set to either 1 (included for the detection) or 0 (excluded from the detection).
Note:
Data points are thresholded out if:
1. their value is outside the range of values defined by the Minimum threshold and Maximum threshold settings on the Data page of the Variable properties dialog box, or
2. their range is greater than the range threshold (Beyond minimum range of Exclude below surface and/or Exclude below surface additional depth offset) defined on the Analysis page of the Variable Properties dialog box.
3. their depth/range is above the specified Exclude above surface.
4. their depth/range is below the specified Exclude below surface.
2. Identify intervals (contiguous groups of 1s) in each beam.
3. Form (nearly) rectangular prisms from each interval. These prisms extend either side of the ping in the direction orthogonal to the plane of the ping a distance equal to one half of the Region width specified on the Data page of the Detect 3D Schools dialog box.
4. Triangulate the prisms. That is, reduce each surface of each prism to two triangles.
5. Store details of the vertices of the triangles that represent the visible surfaces.
6. Analyze vertices and discard non-visible surfaces.
Note: These are all the surfaces shared by more than one prism
7. Define groups of connected vertices.
Note:
Vertices are considered connected if they lie on a common triangle, and any one vertex may lie on more than one triangle.
8. Create a 3D region for each set of connected vertices and the triangles containing them.
Note:
If schools are not connected they will be treated as separate schools and separate 3D regions will be created.
9. Calculate the object-aligned bounding box for each 3D region and each vacuole.
10. Compare the dimensions of the object-aligned bounding box for each school with the minimum school dimensions defined on the Size Criteria page of the Detect 3D schools dialog box and discard 3D regions that do not meet the minimum size requirements.
11. Calculate 3D object properties for the 3D regions.

Notes:

• School detection settings can be seen on to the Notes page of the 3D Region properties dialog box.
• The By-ping detection will detect no schools when the Region width is less than the Minimum shortest dimension.

## Target-locked scanning algorithm

Note: We strongly recommend you prepare your data for school detection before applying this algorithm.

Used for target-locked scanning data only.

For the purposes of school detection, a target-locked ping pair is an H-mode ping and a V-mode ping:

1. that are identified as described in About target-locked ping pairs.
2. that furthermore meet the following requirements:
1. have the same ping position.
2. have the same start range and sample thickness.
3. intersect one another

For any given target-locked ping pair:

• let PH be the H-mode ping
• let PV be the V-mode ping
• let BH be the H-mode beam nearest this intersection
• let BV be the V-mode beam nearest this intersection
• BH and BV may (ideally) be identical (i.e. contain identical data) but in the general case are not assumed to be.

Zero or more 3D regions are created for every target-locked ping pair as follows:

1. Apply the specified exclusion criteria to the data on PH and PV
1. If PV is a V1*V2 or V1L*V2L type variable, ignore the V2 (or V2L) component of PV
2. In both PH and PV find:
1. all samples above the detection threshold (call these 1), and
2. those below the detection threshold (call these 0)
3. Find the largest intersection (in range space) of above threshold samples (1s) in BV and above threshold samples (1s) in BH.
4. Create a 3D region for this overlap as follows:
1. Identify regions+ of above-threshold data (1s) in both PH and PV which surround this overlap:

1. Let RH be the region thus detected on PH
2. Let RV be the region thus detected on PV
2. Create a 3D region as an ellipsoid which encloses RH and RV as follows:
1. Let V be the V-mode plane
2. Let X be the direction perpendicular to BH and tangential to PH
3. Let Y be the direction of BH
4. Let RV3D be a 3D region defined as follows:
1. area (on V) equal to RV and
2. width (in direction X) equal to the width of BH.
Note however that the width is not uniform (the width of BH changes with both range and tilt angle)
3. positioned such that
1. its area covers RV
2. it is vertically centered on BH

Note: If a hemisphere is divided into cells using all possible beams defined by all possible bearing and tilt angles of a V-mode and H-mode ping respectively then RV3D is a composite of such cells (on a spherical coordinate system centered at the transducer). The volume of any such cell is defined as Vs for the Target-locked scanning algorithm under Volume_integration.

5. For each beam in RH create a 3D region RV3Di as follows:
1. Let BHi be the H-mode beams in RH, where i = 1 to the number of H-mode beams in RH
2. RV3Di is a scaled copy of RV3D, such that:
1. let Li be the length of RH at BHi and Wi be the width of BHi
2. let Lr be the length of RH at BH and Wr be the width of BH
3. its area (on V) is scaled by the ratio of Li to Lr
4. its width (in direction X) is scaled by the ratio of Wi to Wr.
5. its position is space is as follows:
1. let D be the distance between the geometric centers of RH at BH and of RH at BHi
2. move RV3Di in direction Y by distance D.
3. rotate RV3Di about the transducer so that it is centered on BH
6. The final 3D region is the union of all the RV3Di
7. Apply the specified exclusion and size criteria
5. Repeat this (step 3) for each intersection (of above threshold samples [1s] in BV and above threshold samples [1s] in BH) in descending order of size (of the intersection) - in the case of ties, the nearest to the transducer is treated first.
Notes:
• A consequence of this algorithm is that the region-ping intersection will always include the detected samples on PV, but may not include them all on PH. On PH the region-ping intersection will always have the same shape as the set of detected samples, but may be nearer to or further from the transducer if there is not a 100% overlap and correspondence between the H-mode and V-mode above threshold samples detected.
• Another consequence of this algorithm is that the initial region RV3D can be scaled down in size or up in size in response to the H-mode data. There is currently no limit specified on the up-sizing or down-sizing and this can as a consequence produce regions which are much larger than a ping.

+ These are not Echoview regions, just a temporary data structure used in this algorithm.