import nibabel as nib from fos import Window, Scene, Init, Run #dname='/home/eg309/Data/trento_processed/subj_03/MPRAGE_32/' #fname = dname + 'T1_flirt_out.nii.gz' #dname = '/home/eg309/Data/111104/subj_05/' #fname = dname + '101_32/DTI/fa.nii.gz' dname = '/usr/share/fsl/data/standard/' fname = dname + 'FMRIB58_FA_1mm.nii.gz' #fname = '/home/eleftherios/Data/trento_processed/subj_01/MPRAGE_32/raw.nii' img = nib.load(fname) data = img.get_data() data[np.isnan(data)] = 0 data = np.interp(data, [data.min(), data.max()], [0, 255]) data = data.astype(np.ubyte) affine = img.get_affine() print data.shape Init() window = Window(caption='[F]OS', bgcolor=(0.1, 0.2, 0.6)) scene = Scene(activate_aabb=False) sli = Slicer('Volume Slicer', data, affine, convention='RAS') scene.add_actor(sli) window.add_scene(scene) window.refocus_camera() Run()
if __name__ == '__main__': import nibabel as nib dname = '/usr/share/fsl/data/standard/' fname = dname + 'FMRIB58_FA_1mm.nii.gz' fname = '/home/eg309/Data/trento_processed/subj_01/MPRAGE_32/rawbet.nii.gz' img=nib.load(fname) data = img.get_data() data = np.interp(data, [data.min(), data.max()], [0, 255]) from fos import Init, Run Init() window = Window(caption="[F]OS", bgcolor=(0.4, 0.4, 0.9)) scene = Scene(activate_aabb=False) guil = Guillotine('VolumeSlicer', data) scene.add_actor(guil) window.add_scene(scene) window.refocus_camera() #window = Window() window.show() #print get_ipython() Run()
""" streamlines = Line('fornix',tracks,colors,line_width=2) from fos import Window, Scene from fos.actor.axes import Axes from fos.actor.text import Text3D title='Bundle Picker' w = Window(caption = title, width = 1200, height = 800, bgcolor = (0.,0.,0.2) ) scene = Scene( scenename = 'Main', extent_min = np.array([-5.0, -5, -5]), extent_max = np.array([5, 5 ,5])) ax = Axes(name = "3 axes", linewidth=2.0) vert = np.array( [[2.0,3.0,0.0]], dtype = np.float32 ) ptr = np.array( [[.2,.2,.2]], dtype = np.float32 ) tex = Text3D( "Text3D", vert, "Reg", 10, 2, ptr) scene.add_actor(ax) scene.add_actor(tex) scene.add_actor(streamlines) #w.screenshot( 'red.png' ) w.add_scene(scene) w.refocus_camera()