def __init__(self, vertices=[], triangle_indices=[], tetrahedron_indices=[], data=[], **kwargs):
        """Construct a TetraMesh.

        A TetraMesh is a tetrahedron-based mesh. ``vertices`` is the array of points, ``triangle_indices`` is the array of
        triangle indices defining the mesh "skin", and ``tetrahedron_indices`` are the indices for constructing the tetrahedrons.
        """
        triangle_indices = np.asarray(triangle_indices).flatten()
        tetrahedron_indices = np.asarray(tetrahedron_indices)

        # If the skin is not provided, we compute it
        if triangle_indices.size == 0:
            if tetrahedron_indices.ndim != 2:
                tetrahedron_indices.reshape(int(tetrahedron_indices.size / 4), 4)

            # Extract all the triangle indices
            faces = np.concatenate([
                tetrahedron_indices[:, [2, 1, 0]],
                tetrahedron_indices[:, [0, 3, 2]],
                tetrahedron_indices[:, [1, 3, 0]],
                tetrahedron_indices[:, [2, 3, 1]]
            ])

            # Sort triangles indices so that we can compare them and find duplicates
            sorted_faces = np.sort(faces, axis=1)

            # Get unique triangle indices and the number of times they appear
            _, unique_index, counts = np.unique(sorted_faces, return_index=True, return_counts=True, axis=0)

            # Extract triangles that appear exactly once
            triangle_indices = faces[unique_index[counts == 1]].flatten()

        super(TetraMesh, self).__init__(
            vertices=vertices, triangle_indices=triangle_indices,
            tetrahedron_indices=tetrahedron_indices.flatten(), data=data, **kwargs
        )
Construct a TetraMesh.

        A TetraMesh is a tetrahedron-based mesh. ``vertices`` is the array of points, ``triangle_indices`` is the array of
        triangle indices defining the mesh "skin", and ``tetrahedron_indices`` are the indices for constructing the tetrahedrons.
        
ipygany/ipygany.py