5/17/2023 0 Comments Numpy vstack in 3rd dimension![]() SetNumberOfCells ( nb_lines ) is_colormap = False # Get colors_array (reformat to have colors for each points) # - if/else tested and work in normal simple case if colors is None : # set automatic rgb colors cols_arr = line_colors ( lines ) colors_mapper = np. array ( lines_array ) # Set Points to vtk array format vtk_points = numpy_to_vtk_points ( points_array ) # Set Lines to vtk array format vtk_lines = vtk. intp ) current_position = 0 for i in lines_range : current_len = len ( lines ) points_per_line = current_len end_position = current_position + current_len lines_array += lines_array += range ( current_position, end_position ) current_position = end_position lines_array = np. vstack ( lines ) nb_lines = len ( lines ) nb_points = len ( points_array ) lines_range = range ( nb_lines ) # Get lines_array in vtk input format lines_array = # Using np.intp (instead of int64), because of a bug in numpy: # points_per_line = np. Returns - poly_data : vtkPolyData is_colormap : bool, true if the input color array was a colormap """ # Get the 3d points_array points_array = np. If an array (X, Y, Z) or (X, Y, Z, 3) is given then the values for the colormap are interpolated automatically using trilinear interpolation. If an array (L,) is given, where L is the number of streamlines then these are considered as the values to be used by the colormap per streamline. If an array (K,) is given, where K is the number of points of all lines then these are considered as the values to be used by the colormap. ![]() If an array (K, 3) is given, where K is the number of points of all lines then every point is colored with a different RGB color. If a list of RGB arrays is given then every point of every line takes a different color. Then every line is coloured with a different RGB color. If an array (N, 3) is given, where N is equal to the number of lines. Then all streamlines will have the same colour. Parameters - lines : list list of N curves represented as 2D ndarrays colors : array (N, 3), list of arrays, tuple (3,), array (K,), None If None then a standard orientation colormap is used for every line. Def lines_to_vtk_polydata ( lines, colors = None ): """Create a vtkPolyData with lines and colors.
0 Comments
Leave a Reply. |