neurodec.mdt.Surface#
- class neurodec.mdt.Surface(dictionary: dict)#
A surface of an anatomical model
- property id: int#
Returns the ID of the object
- property image_label: Optional[int]#
Returns the image label of this Surface.
- Returns
If this Surface was extracted from an Image, the label that identified it is returned. If this surface was created using Surface.new(), then its image_label will be None.
- property label: str#
Returns the human-readable label of this Surface.
This is the human-readable label (a string) that was passed to Surface.new(). Do not confuse it with the image_label property.
- Returns
The human-readable label of this Surface, if one was given during the Surface.new() call. If the surface was extracted from a Tetrahedra instance, the label will be None.
- classmethod new(vertices: ArrayLike, triangles: ArrayLike, tissue_type: TissueType, label: Optional[str] = None, force_computation: bool = False) Surface #
Create a new surface
Creates a new surface from raw data. This will initiate a call to the Neurodec Myoelectric Digital Twin (MDT) API that will save the surface, preprocess it, and return its metadata in the form of a dict.
- Parameters
vertices – A numpy array of float with a shape of (N, 3) that contains the location of the vertices.
triangles – A numpy array of unsigned integers with a shape of (M, 3) that contains the indices of the vertices for each triangle.
tissue_type – The tissue enclosed by this surface, see neurodec.mdt.TissueType.
label – A human-readable name to easily identify the surface. If not given, the label will be autogenerated from the surface type. Note that this label exists only locally and not in the database. This means that if two Surface objects are created with different labels but with same vertices, triangles and types, the result will be two instances that share the same id and status, despite having different labels.
force_computation – Boolean flag that allows to bypass a status check. Normally, the API would check if an object with the requested parameters was already present in the database. If this was the case, the API would not request its computation and would simply return its identifier. By setting this flag to True, the user can bypass this logic and force the computation of the resource even if it existed already. The main reason is to allow starting a calculation again in case of unexpected errors.
- Returns
The new surface. If another surfaces with the same parameters already exits, that one will be returned instead of creating a new surface.
- property triangles#
Retrieve the triangles of this Surface.
- Returns
A NumPy array of unsigned integers with a shape of (M, 3) that contains the indices of the vertices for each triangle.
- property type: TissueType#
Returns the type of the surface
- property vertices#
Retrieve the vertices of this Surface.
- Returns
A NumPy array of float with a shape of (N, 3) that contains the location of the vertices.
- wait()#
Wait for the object to be ready