with open(fp) as f: temp = json.load(f) print(len(temp['neurons'])) x = temp['neurons'][0]['soma']['x'] y = temp['neurons'][0]['soma']['y'] z = temp['neurons'][0]['soma']['z'] return (x,y,z) for k,vlist in groups.items(): if k not in [1,3,2,12]: screenshot_params = dict( folder = './screenshots/single_cell_views', name='top_cluster_{0}'.format(k), ) scene = Scene(display_inset=False, screenshot_kwargs=screenshot_params) for i,neuron in enumerate(vlist): if neuron not in left_neurons: fp = cell_filepaths[neuron] else: fp = cell_filepaths[neuron].split('.json')[0] + '_reversed.json' scene.add_neurons(fp, soma_color=cmap[i], render_axons=True, render_dendrites=True, dendrites_color=cmap[i], axon_color=cmap[i], neurite_radius=18) # pos = get_point(fp) # print(pos) # scene.add_sphere_at_point(pos=pos, radius= 75, color=cmap[i]) scene.render(interactive=False,camera='top', zoom=1) scene.take_screenshot()
brainrender.SHADER_STYLE = "cartoon" from brainrender.scene import Scene screenshot_params = dict( folder="./screenshots", name="tutorial", ) # Create a scene scene = Scene( screenshot_kwargs=screenshot_params ) # use screenshot_params to specify where the screenshots will be saved scene.add_brain_regions(["TH"]) # render scene.render( camera="top", interactive=False ) # if interactive is false the program won't stop when the scene is rendered # which means that the next line will be executed scene.take_screenshot() time.sleep(1) # Take another screenshot from a different angle scene.render(camera="coronal", interactive=False, zoom=0.5) scene.take_screenshot( ) # screenshots are saved with a timestamp in the name so you won't be overwriting the previous one. # Render interactively. You can then press 's' to take a screenshot scene.render()