This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import os | |
# import pyvista | |
# import meshio | |
import vtk | |
from pyvista import examples | |
if __name__ == '__main__': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Python script to extract a submesh give an input mesh vertices and faces array and a list of vertices or faces to keep.""" | |
def get_submesh(verts, faces, verts_retained=None, faces_retained=None, min_vert_in_face=2): | |
''' | |
Given a mesh, create a (smaller) submesh | |
indicate faces or verts to retain as indices or boolean | |
verts : Input mesh vertices (Nx3) | |
faces : Input mesh faces (Fx3) | |
verts_retained : list of the vertices indices to keep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Blender python script to export the selected vertices as an index list.""" | |
import bpy | |
import pickle | |
# Fetch the selected object and list all the selected vertices indices | |
bpy.ops.object.mode_set(mode = 'OBJECT') | |
obj = bpy.context.object | |
bpy.ops.object.mode_set(mode = 'EDIT') | |
verts_ind = [i.index for i in obj.data.vertices if i.select] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyvista as pv | |
from pyvista import examples | |
import data_mri as dd | |
import numpy as np | |
def plot_3D_image(arr, resolution, center, p=None, interactive_slice=False, orthogonal_slices=True): | |
''' Plot of a 3D volume with orthogonal slices slices.''' | |
values = arr | |
values.shape |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import os | |
import pyvista | |
from pyvista import examples | |
if __name__ == '__main__': | |
# Parse a vtp file and convert it to a ply file | |
parser = argparse.ArgumentParser(description='Convert a folder of vtp files to a folder of ply files') |