# -*- coding: utf-8 -*- import readMostd as rmd import readSwc as rs dst = "W:\\lsu\\TDI072\\figure\\all\\1\\" swc = rs.Swc(r"W:\lsu\TDI11302020\sl\swc\raw\b10.swc", (0.3, 0.3, 1)) #print swc.real_roi print swc.fiber_length #print swc.max_level real_roi = swc.real_roi print real_roi #swc_roi = rmd.Roi(real_roi, r'W:\lsu\TDI11302020\TDI11302020_mostd_z.mostd') #swc_roi.outputImages(dst, False) #swc.trans_to_local_swc(swc.real_roi, True, dst) ###swc.trans_to_local_real_swc(swc.real_roi, dst)
# -*- coding: utf-8 -*- import readMostd as rmd import readSwc as rs swc = rs.Swc(".\\res\\dendrite.swc", (0.3, 0.3, 1)) swc.displayInVtk()
import readSwc as rs import funs import readMostd as rm import vtk #import libtiff as lt swc_src = '../res/axon_test.swc' mostd_src = '../res/TDI072-test.mostd' dst = 'G:\\sulei\\workplace\\Swc\\result\\' image_resolution = (0.3, 0.3, 1) block_width = 256 block_height = 256 block_depth = 64 swc = rs.Swc(swc_src, image_resolution) line = swc.lines[0] points = line.points i = 0 for s, e in zip(xrange(0, len(points), 64), xrange(63, len(points), 64)): if i != 0: continue used_64_points = points[s:e + 1] used_center = funs.get_center(used_64_points) block_section = funs.get_section(used_center, block_width, block_height, block_depth, image_resolution) used_images = rm.Roi(block_section, mostd_src).getImages() # funs.save_vtk_image(used_images, dst, i) image_import = vtk.vtkImageImport() image_import.CopyImportVoidPointer(used_images.tostring(),
# -*- coding: utf-8 -*- import vtk import readMostd as rmd import readSwc as rs swc = rs.Swc("dendrite.swc", (0.3, 0.3, 1)) lines = swc.lines lines_actors = [] for i in xrange(len(lines)): this_line = lines[i].data this_line_poly_data = vtk.vtkPolyData() this_line_points = vtk.vtkPoints() for i in xrange(len(this_line)): this_line_points.InsertPoint(i, this_line[i][2:5]) this_line_cells = vtk.vtkCellArray() this_line_cells.InsertNextCell(len(this_line)) for i in xrange(len(this_line)): this_line_cells.InsertCellPoint(i) this_line_poly_data.SetPoints(this_line_points) this_line_poly_data.SetLines(this_line_cells) this_line_mapper = vtk.vtkPolyDataMapper() this_line_mapper.SetInput(this_line_poly_data) this_line_actor = vtk.vtkActor() this_line_actor.SetMapper(this_line_mapper) this_line_actor.GetProperty().SetLineWidth(1) lines_actors.append(this_line_actor) ren = vtk.vtkRenderer()