Beispiel #1
0
def surfaceclipp_centerline(input_file, output_file):
    '''
    使用中心线自动的裁剪端口
    '''
    surface_reader = sr.vmtkSurfaceReader()
    surface_reader.InputFileName = input_file
    surface_reader.Execute()

    centerline = cl.vmtkCenterlines()
    centerline.Surface = surface_reader.Surface
    centerline.Execute()

    endpointextractor = ep.vmtkEndpointExtractor()
    endpointextractor.Centerlines = centerline.Centerlines
    endpointextractor.Execute()

    branchclipper = bc.vmtkBranchClipper()
    branchclipper.Surface = surface_reader.Surface
    branchclipper.Centerlines = endpointextractor.Centerlines
    branchclipper.Execute()

    surface_connectivity = sufct.vmtkSurfaceConnectivity()
    surface_connectivity.Surface = branchclipper.Surface
    surface_connectivity.CleanOutput = 1
    surface_connectivity.Execute()

    surface_writer = sw.vmtkSurfaceWriter()
    surface_writer.Surface = surface_connectivity.Surface
    surface_writer.OutputFileName = output_file
    surface_writer.Execute()
Beispiel #2
0
def test_clip_groupids_surface_returns_as_expected(aorta_centerline_branches, aorta_surface, 
                                                  groupids, paramid, compare_surfaces):
    name = __name__ + '_test_clip_group_' + paramid + '_surface_returns_as_expected.vtp'
    clipper = branchclipper.vmtkBranchClipper()
    clipper.Centerlines = aorta_centerline_branches
    clipper.Surface = aorta_surface
    clipper.RadiusArrayName = 'MaximumInscribedSphereRadius'
    clipper.BlankingArrayName = 'Blanking'
    clipper.GroupIdsArrayName = 'GroupIds'
    clipper.GroupIds = groupids
    clipper.Execute()

    assert compare_surfaces(clipper.Surface, name) == True
Beispiel #3
0
def test_clip_returns_3_groups(aorta_centerline_branches, aorta_surface):
    clipper = branchclipper.vmtkBranchClipper()
    clipper.Centerlines = aorta_centerline_branches
    clipper.Surface = aorta_surface
    clipper.RadiusArrayName = 'MaximumInscribedSphereRadius'
    clipper.BlankingArrayName = 'Blanking'
    clipper.GroupIdsArrayName = 'GroupIds'
    clipper.Execute()

    wrapedclip = dsa.WrapDataObject(clipper.Surface)
    uniqueGroups = np.unique(np.array(wrapedclip.PointData['GroupIds'].tolist()))

    assert np.allclose(uniqueGroups, np.array([0, 2, 3])) == True
Beispiel #4
0
def test_clip_groupids_with_insideout_surface_returns_as_expected(aorta_centerline_branches, aorta_surface, 
                                                                 groupids, paramid, compare_surfaces):
    name = __name__ + '_test_clip_groupids_' + paramid + '_with_insideout_surface_returns_as_expected.vtp'
    clipper = branchclipper.vmtkBranchClipper()
    clipper.Centerlines = aorta_centerline_branches
    clipper.Surface = aorta_surface
    clipper.RadiusArrayName = 'MaximumInscribedSphereRadius'
    clipper.BlankingArrayName = 'Blanking'
    clipper.GroupIdsArrayName = 'GroupIds'
    clipper.GroupIds = groupids
    clipper.InsideOut = 1
    clipper.Execute()

    assert compare_surfaces(clipper.Surface, name, method="addpointarray", arrayname="ClippingArray") == True