1. arivis Knowledge Hub
  2. Vision4D / arivis Pro
  3. Scripting and interaction with other programs

Objects contacts analysis

This article describes how to perform the objects contacts analysis in arivis Vision4D.

Introduction

Identifying the contacts between adjacent objects belonging to the same TAG, is a complex task that requires to detect the space on which two objects edges are touching or overlaping each other. Objects can be in contact either sharing a single voxel rather than more volume.

The python script is available as stand alone code as well as operator.
Please Contact the arivis application support to know how to get either the stand alone script or the operator script.

The process to achive the contacts analysis is executed  as two separate processes:

  • Identifying the overlapping object bounding boxes

  • Verifying if the objects withing the touching bounding boxes are really in contact or overlapped.

Contacts analysis theory

The first step evaluates the Objects candidates checking their bounding box. If the bounding boxes of two, contiguous objects are overlapped, these objects are potentially in contact between them.

This approach does not warrant a perfect contact detection. As you can see here below, the bounding boxes can overlap each other but the related objects are not in contact. It speed-up the next step, the contact refining, allowing to check only the objects potentially in contact.

The second step (optional) converts the shape of the objects candidates in their binary representation. The binary maskes are added and, if a common volume is detected, the contact is confirmed.

Set the stand alone Script options

Open Python Script Editor. From the «Extra» menu, select the «Script Editor» item.

Load the Python Script ContactBetweenObjects_RevC(4_0).py” browsing the folder on which the file has been saved.

Here below how to set the stand alone script options.

TAG_SEGMENTS: Define the TAG name to which the source objects belong to.
NOTE: the TAG name is case sensitive

REFINE_CONTACTS: If True, the refine contacts step is executed. Otherwise, only the bounding boxes are used to find the objects connections.

SAVE_CSV: Sets it True to save the connections information (Parent ID, Children Ids, Children volumes) to a CSV file.

PATH_CSV: Sets a local folder where the CSV file is saved.
Be sure the folder exist in your hard disk.
NOTE: Uses a single ‘/’ or a double ‘\\’ slash as folder separators

CSV_EXT: Sets the CSV file extension (TXT or CSV).

Set and run the Script operator

Open the analysis panel (Pipeline workspace) using the "flask" icon on the main, top icon bar.

Add the “Python Segment Modifier” operator to the active pipeline. Chose it from the Add Operation list.

Select the “ContactBetweenObjects_RevC(4_0)_OP.py” python operator file from the folder on which it is stored. Click on the "3 dots" button to browser in your hard disk  and select the file.

Digit the objects TAG. The TAG must collect the objects to be analyzed.
NOTE: the TAG name is case sensitive.

Sets the «Refine_Contact» option ON

NOTE: A segmentation operator must come first the Python Segment Modifier one.
It creates the objects to be analysing by contacts. If the script operator have to be executed on objects already segmented in a separated pipeline, it is necessary to import them in the active pipeline using the
“Import Document Objects” operator.