Back

ComplementaryROI

sofa::component::engine::select::ComplementaryROI
DataEngine
Doc (from source)

Find the points that are NOT in the input sets. Output the positions and their indices in the global mesh not in the specified sets @todo make it general as other ROI (edges, triangles,...) @author Thomas Lemaire @date 2014

Abstract (AI generated)

The `ComplementaryROI` component identifies and outputs the indices and positions of points not included in specified regions of interest (ROIs) within a global mesh.

Metadata
module
Sofa.Component.Engine.Select
namespace
sofa::component::engine::select
include
sofa/component/engine/select/ComplementaryROI.h
inherits
  • DataEngine
templates
  • sofa::defaulttype::Vec3Types
description

The ComplementaryROI component in the SOFA framework is designed to identify points within a global mesh that are not included in specified regions of interest (ROIs). This functionality can be useful for isolating or analyzing regions outside predefined subsets in simulations and models. Here is a detailed mathematical description of its operation:

Inputs

  • Positions (d_position): A vector of positions representing the coordinates of points within the global mesh.
  • Number of Sets to Complement (d_nbSet): An integer indicating the number of ROIs from which points need to be excluded.
  • Indices of Included Points in Each Set (vd_setIndices): A list of sets, where each set contains indices corresponding to points included within a specific ROI.

Outputs

  • Indices of Points Outside Specified Sets (d_indices): A vector containing the indices of points that are not part of any specified ROI.
  • Positions of Points Outside Specified Sets (d_pointsInROI): A vector containing the positions corresponding to the indices in d_indices.

Core Functionality (doUpdate Method)

  1. Initialization:
  2. The method initializes an empty set myIndices and populates it with all possible indices from 0 to the size of the input positions (position.size()).

  3. Set Complementation:

  4. For each ROI specified in vd_setIndices, iterate through the indices within that ROI.
  5. Remove any index found in an ROI from the set myIndices if it exists, ensuring only points outside all ROIs remain.

  6. Output Assignment:

  7. Convert the remaining indices in myIndices to the output vector d_indices.
  8. Retrieve and store the corresponding positions for these indices in d_pointsInROI from the input positions position.

Mathematical Formulation

Let $ P = \{p_0, p_1, ..., p_{n-1}\} $ be the set of all points with coordinates given by d_position, where each point is represented as a vector in $\mathbb{R}^3$.

Let $ S_i \subseteq P $ be the indices of points included within the i-th ROI, for $ i = 1, 2, ..., m $, where m is given by d_nbSet. Each set S_i corresponds to an entry in vd_setIndices.

The goal is to find:

$$ C = P - (S_1 \cup S_2 \cup ... \cup S_m) $$

where $C$ is the complement of all ROIs, containing points not included in any specified ROI. The output d_indices will contain indices corresponding to elements in set $C$, and d_pointsInROI contains their positions.

Summary

The ComplementaryROI component effectively computes the complement of multiple regions of interest within a global mesh, providing a mechanism for isolating points that do not belong to any specified subset. This functionality can be critical in various simulation scenarios where analyzing or manipulating non-overlapping regions is required.

Data Fields
NameTypeDefaultHelp
d_position VecCoord input positions
d_nbSet unsigned int number of sets to complement
vd_setIndices SetIndex
d_indices SetIndex indices of the point in the ROI
d_pointsInROI VecCoord points in the ROI
Methods
void doUpdate () virtual
void parse (sofa::core::objectmodel::BaseObjectDescription * arg) virtual
void parseFields (const int & str)
void init () virtual
void reinit () virtual
{
  "name": "ComplementaryROI",
  "namespace": "sofa::component::engine::select",
  "module": "Sofa.Component.Engine.Select",
  "include": "sofa/component/engine/select/ComplementaryROI.h",
  "doc": "Find the points that are NOT in the input sets.\n\nOutput the positions and their indices in the global mesh not in the specified sets\n@todo make it general as other ROI (edges, triangles,...)\n@author Thomas Lemaire @date 2014",
  "inherits": [
    "DataEngine"
  ],
  "templates": [
    "sofa::defaulttype::Vec3Types"
  ],
  "data_fields": [
    {
      "name": "d_position",
      "type": "VecCoord",
      "xmlname": "position",
      "help": "input positions"
    },
    {
      "name": "d_nbSet",
      "type": "unsigned int",
      "xmlname": "nbSet",
      "help": "number of sets to complement"
    },
    {
      "name": "vd_setIndices",
      "type": "SetIndex"
    },
    {
      "name": "d_indices",
      "type": "SetIndex",
      "xmlname": "indices",
      "help": "indices of the point in the ROI"
    },
    {
      "name": "d_pointsInROI",
      "type": "VecCoord",
      "xmlname": "pointsInROI",
      "help": "points in the ROI"
    }
  ],
  "links": [],
  "methods": [
    {
      "name": "doUpdate",
      "return_type": "void",
      "params": [],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "parse",
      "return_type": "void",
      "params": [
        {
          "name": "arg",
          "type": "sofa::core::objectmodel::BaseObjectDescription *"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "parseFields",
      "return_type": "void",
      "params": [
        {
          "name": "str",
          "type": "const int &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "init",
      "return_type": "void",
      "params": [],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "reinit",
      "return_type": "void",
      "params": [],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    }
  ],
  "description": "The `ComplementaryROI` component is part of the SOFA framework and operates within the engine/select module, inheriting from `DataEngine`. Its primary role is to find points that are not included in specified sets (regions of interest) within a global mesh. This can be useful for isolating or analyzing regions outside predefined subsets in simulations or models.\n\nIt interacts with other components through its data fields and methods such as `doUpdate`, which performs the core functionality of identifying and outputting points not present in input sets, and `parse` for configuration setup. The component takes input positions (`d_position`) and a number of sets to complement (`d_nbSet`). It also manages indices of included points within each set (`vd_setIndices`).\n\nThe outputs include the indices of points outside the specified sets (`d_indices`) and their corresponding positions (`d_pointsInROI`). Practical usage involves setting up these input data fields, calling `doUpdate` to compute the complement, and retrieving the output indices and positions. The component is templated with default vector types for flexibility.",
  "maths": "The `ComplementaryROI` component in the SOFA framework is designed to identify points within a global mesh that are not included in specified regions of interest (ROIs). This functionality can be useful for isolating or analyzing regions outside predefined subsets in simulations and models. Here is a detailed mathematical description of its operation:\n\n### Inputs\n- **Positions (`d_position`)**: A vector of positions representing the coordinates of points within the global mesh.\n- **Number of Sets to Complement (`d_nbSet`)**: An integer indicating the number of ROIs from which points need to be excluded.\n- **Indices of Included Points in Each Set (`vd_setIndices`)**: A list of sets, where each set contains indices corresponding to points included within a specific ROI.\n\n### Outputs\n- **Indices of Points Outside Specified Sets (`d_indices`)**: A vector containing the indices of points that are not part of any specified ROI.\n- **Positions of Points Outside Specified Sets (`d_pointsInROI`)**: A vector containing the positions corresponding to the indices in `d_indices`.\n\n### Core Functionality (doUpdate Method)\n1. **Initialization**:\n   - The method initializes an empty set `myIndices` and populates it with all possible indices from 0 to the size of the input positions (`position.size()`).\n\n2. **Set Complementation**:\n   - For each ROI specified in `vd_setIndices`, iterate through the indices within that ROI.\n   - Remove any index found in an ROI from the set `myIndices` if it exists, ensuring only points outside all ROIs remain.\n\n3. **Output Assignment**:\n   - Convert the remaining indices in `myIndices` to the output vector `d_indices`.\n   - Retrieve and store the corresponding positions for these indices in `d_pointsInROI` from the input positions `position`.\n\n### Mathematical Formulation\nLet \\( P = \\{p_0, p_1, ..., p_{n-1}\\} \\) be the set of all points with coordinates given by `d_position`, where each point is represented as a vector in \\(\\mathbb{R}^3\\).\n\nLet \\( S_i \\subseteq P \\) be the indices of points included within the i-th ROI, for \\( i = 1, 2, ..., m \\), where `m` is given by `d_nbSet`. Each set `S_i` corresponds to an entry in `vd_setIndices`.\n\nThe goal is to find:\n\\[\n    C = P - (S_1 \\cup S_2 \\cup ... \\cup S_m)\n\\]\nwhere \\(C\\) is the complement of all ROIs, containing points not included in any specified ROI. The output `d_indices` will contain indices corresponding to elements in set \\(C\\), and `d_pointsInROI` contains their positions.\n\n### Summary\nThe `ComplementaryROI` component effectively computes the complement of multiple regions of interest within a global mesh, providing a mechanism for isolating points that do not belong to any specified subset. This functionality can be critical in various simulation scenarios where analyzing or manipulating non-overlapping regions is required.",
  "abstract": "The `ComplementaryROI` component identifies and outputs the indices and positions of points not included in specified regions of interest (ROIs) within a global mesh.",
  "sheet": "# ComplementaryROI\n\n## Overview\n\nThe `ComplementaryROI` is an engine/select module that inherits from `DataEngine`. Its primary role is to identify and output the indices and positions of points outside predefined regions of interest (ROIs) in a global mesh. This functionality is useful for isolating or analyzing non-overlapping regions within simulations.\n\n## Mathematical Model\n\nLet \\( P = \\{p_0, p_1, ..., p_{n-1}\\} \\) be the set of all points with coordinates given by `d_position`, where each point is represented as a vector in \\(\\mathbb{R}^3\\).\n\nLet \\( S_i \\subseteq P \\) be the indices of points included within the i-th ROI, for \\( i = 1, 2, ..., m \\), where `m` is given by `d_nbSet`. Each set \\(S_i\\) corresponds to an entry in `vd_setIndices`.\n\nThe goal is to find:\n\\[\n    C = P - (S_1 \\cup S_2 \\cup ... \\cup S_m)\n\\]\nwhere \\(C\\) is the complement of all ROIs, containing points not included in any specified ROI. The output `d_indices` will contain indices corresponding to elements in set \\(C\\), and `d_pointsInROI` contains their positions.\n\n## Parameters and Data\n\n- **d_position**: Input positions (type: VecCoord).\n- **d_nbSet**: Number of sets to complement (type: unsigned int, default: 0).\n- **vd_setIndices**: Indices of included points in each set (type: SetIndex).\n- **d_indices**: Indices of the point outside the ROI (type: SetIndex).\n- **d_pointsInROI**: Positions of points outside the specified sets (type: VecCoord)."
}