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()
def test_extract_largest_surface(aorta_surface_two_segments, compare_surfaces): name = __name__ + '_test_extract_largest_surface.vtp' connectiv = connectivity.vmtkSurfaceConnectivity() connectiv.Surface = aorta_surface_two_segments connectiv.Method = 'largest' connectiv.CleanOutput = 1 connectiv.Execute() assert compare_surfaces(connectiv.Surface, name) == True
def test_extract_closest_to_point(aorta_surface_two_segments, compare_surfaces): name = __name__ + '_test_extract_closest_to_point.vtp' connectiv = connectivity.vmtkSurfaceConnectivity() connectiv.Surface = aorta_surface_two_segments connectiv.Method = 'closest' connectiv.ClosestPoint = [0.0, 0.0, 0.0] connectiv.Execute() assert compare_surfaces(connectiv.Surface, name) == True
def test_extract_closest_to_reference_surface(aorta_surface_two_segments, aorta_surface_reference, compare_surfaces): name = __name__ + '_test_extract_closest_to_reference_surface.vtp' connectiv = connectivity.vmtkSurfaceConnectivity() connectiv.Surface = aorta_surface_two_segments connectiv.Method = 'closest' connectiv.ReferenceSurface = aorta_surface_reference connectiv.Execute() assert compare_surfaces(connectiv.Surface, name) == True
def test_extract_largest_surface(aorta_surface_two_segments, compare_surfaces): name = __name__ + '_test_extract_largest_surface.vtp' connectiv = connectivity.vmtkSurfaceConnectivity() connectiv.Surface = aorta_surface_two_segments connectiv.Method = 'largest' connectiv.CleanOutput = 1 connectiv.Execute() assert compare_surfaces(connectiv.Surface, name) == True