示例#1
0
 def check_all_normals(self, interval=100) -> None:
     centroid = math.mean(self)
     scale = np.mean(self.nn_weights[:, 3])
     normals = self.point_normals[:, ::interval]*scale
     pyplot.plot3d(*self[:, ::interval], '.', alpha=1, markersize=1)
     pyplot.quiver3d(
         *self[:, ::interval],
         *normals)
     pyplot.equal_aspect_3d_centered(centroid)
     pyplot.show()
示例#2
0
    def check_normals_n_at_a_time(self, interval=1000, n_normals=3) -> None:
        scale = np.mean(self.nn_weights[:, 3])

        for i, (point, normal) in enumerate(
                zip(self.T, self.point_normals.T)):
            if i % interval == 0:
                normal = normal*scale
                I_nearest = self.nn_indices[i]
                # nn = self[:, I_nearest]
                # nn_normals = self.point_normals[I_nearest]
                pyplot.plot3d(*self, '.', alpha=1, markersize=1)
                pyplot.quiver3d(*point, *normal)
                pyplot.equal_aspect_3d_centered(point)
                pyplot.show()
示例#3
0
    perpendicularPointDict = centerline_main.findPointPairsAtPerpendicularDistance(centerline_bifur, distance=landmark.bar, resolution=0.0001)
    print("the data required:\n", perpendicularPointDict)


    # %%
    pt_main, pt_bifur, error, vector = perpendicularPointDict.values()


    # %%
    plt.figure_3d()
    centerline_main.plot3d('b')
    centerline_bifur.plot3d('r')
    vector.quiver3d(origin=pt_main)
    pt_main.scatter3d(color='green')
    pt_bifur.scatter3d(color='red')
    plt.equal_aspect_3d_centered(pt_main)
    plt.show()

    # %% [markdown]
    # Originally our transport frames are not oriented along the centerline. But since we now have an approximation to of the orientation of our frames we can now orient our transport frames.

    # %%
    orientedTransportFrames, origin_id = centerline_main.oriented_transport_frames(
        pt_main, vector
    )
    mainTransportFrames = centerline_main.transport_frames()
    plt.figure_3d()
    centerline_main.plot3d('g')
    centerline_bifur.plot3d('r')

    # the now oriented transport frames
示例#4
0
 def post_plot(self, ax):
     pyplot.equal_aspect_3d_centered(self.data.mean(axis=-1), ax=ax)
示例#5
0
    file = data_folder/'00000.vtk'
    pv_obj = pv.read(file)

    points = pv_obj.points.T
    test_points = points[:, ::20]*1000
    # test_points = points*1000
    psurf = Pointsurface(
        test_points, leafsize=100, neighbours=13, external=True)
    psurf.compute_all_normals()
    psurf.compute_principle_curvatures(n_processors=5)
    psurf
    if False:
        ii = 500
        ids = psurf.nn_indices[ii]
        xx, yy = psurf.principle_directions[ii].T
        X, Y, Z = psurf.point_basis[ii].T
        pyplot.plot3d(*psurf, '.', alpha=0.5, markersize=2)
        pyplot.plot3d(*psurf[:, ii, None], 'go')
        pyplot.plot3d(*psurf[:, ids], 'ro')
        pyplot.quiver3d(*psurf[:, ii, None], *X[:, None], color='blue')
        pyplot.quiver3d(*psurf[:, ii, None], *Y[:, None], color='blue')
        pyplot.quiver3d(*psurf[:, ii, None], *Z[:, None], color='green')
        pyplot.quiver3d(*psurf[:, ii, None], *xx[:, None], color='red')
        pyplot.quiver3d(*psurf[:, ii, None], *yy[:, None], color='red')
        pyplot.equal_aspect_3d_centered(psurf[:, ii, None])
        pyplot.show()
    # psurf.plot_curvature()
    # pyplot.show()
    # psurf.check_all_normals(interval=1)
    print('done')