# Advanced detection settings: Subject contour

Aim

▪To eliminate the detection of thin objects such as the rodent's tail.

▪To remove the effect of fibers and other thin objects of similar color as the subject, for example in optogenetic stimulation systems.

▪To remove the effect of cage bars.

▪To 'join up' the parts of the body, when they are detected separately. For example a zebrafish when swimming over a dark object.

How to access this option

In the Detection Settings window, locate Subject Contour.

Procedures

To remove the rodent’s tail, or thin objects

1.Select Erosion >0, Dilation >0. In most cases the second Erosion filter is not necessary.

2.Increase the values Erosion and Dilation until the rodent’s tail or the interfering objects are no longer detected.

tip Try with equal values for Erosion and Dilation; alternatively, Erosion slightly higher than Dilation. For example, 3, 2, 0.

For tethered animals, increase Erosion until only the subject is detected:

To remove the effect of cage bars

▪If the cage bars are the same color as the subject, first erode, then dilate. In the example below, Erosion 1, Dilate 3, Erosion 0.

▪If the cage bars are darker (or lighter) than the subject, then first dilate, then erode. In the example below, Erosion 0, Dilation 4, Erosion 1.

To 'join up' parts of animals like fish and insects

1.Select Erosion 0, Dilate > 0, Erosion > 0.

2.Increase Dilation until the subject’s body is fully detected. Then increase Erosion to return to the normal subject size. For example Erosion 0, Dilation 4, Erosion 2.

How Erosion and Dilation work

Contour erosion

Erosion removes an external layer of pixels from the subject’s contour. The detected subject appears smaller. 1 means that a layer of 1 pixel is removed. Range: 1 to 10.

Contour dilation

Dilation adds a layer of pixels around the subject’s contour. The detected subject appears larger. 1 means that a layer of one pixel is added. Range: 1 to 20.

Combine erosion and dilation

Select Erosion and Dilation when you want to keep the apparent size of the subject as the original.

When you select at least two filters, erosion and dilation are applied based on the sequence that results from which filters you choose.

▪Erosion > 0, Dilation > 0, Erosion =0. A layer of pixels is removed, then another layer is added to the contour. This is the same as Erode first, then dilate in EthoVision XT 15 and earlier.

▪Erosion = 0, Dilation > 0, Erosion > 0. A layer of pixels is added, then another layer is removed from the contour. This is the same as Dilate first, then erode in EthoVision XT 15 and earlier.

▪Erosion > 0, Dilation > 0, Erosion > 0. A layer of pixels is removed, then another layer is added, and finally a third layer is removed.

tip Use this combination to improve nose-tail detection in some difficult situations, for example when the subject enters a darker area. Adding the second Erosion filter may help.

Note

▪It is important that the complete body of the animal is detected. If even after setting the Contour adjustments you do not achieve this, go back to the appropriate Detection method and adjust the contrast to improve body detection.

▪A reason for why you may want to eliminate the animal's tail is that when the animal sits still and its tail moves, it adds to distance moved. Furthermore, when the tail is not part of the detected blob, the center point is better estimated.

▪If you apply Erosion 2, Dilation 0, Erosion 2, the effect is like that of Erosion 4, Dilation 0, Erosion 0.

See also

▪The video tutorial Contour Settings.