Esempio n. 1
0
    #create the interaction system for tracks
    tl = TrackLabeler('Bundle Picker',
                      qb,
                      qb.downsampled_tracks(),
                      vol_shape=(182, 218, 182),
                      tracks_alpha=1)
    #add a interactive slicing/masking tool
    #sl = Slicer(affine,data)
    #add one way communication between tl and sl
    #tl.slicer=sl

    title = 'Bundle Picking'
    w = Window(caption=title, width=1200, height=800, bgcolor=(0., 0., 0.2))

    region = Region(regionname='Main',
                    extent_min=np.array([-5.0, -5, -5]),
                    extent_max=np.array([5, 5, 5]))

    ax = Axes(name="3 axes", scale=10, 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, "(0,0,0)", 10 * 2.5, 10 * .5, ptr)

    #region.add_actor(ax)
    #region.add_actor(tex)
    region.add_actor(tl)
    #region.add_actor(streamlines)
    #w.screenshot( 'red.png' )
    w.add_region(region)
    w.refocus_camera()
Esempio n. 2
0
    tracks = [tr[0] for tr in a[0]]
    #tracks = tracks-np.concatenate(tracks,axis=0)
    lentra = [len(t) for t in tracks]
    colors = np.random.rand(np.sum(lentra),4)
    #colors[:,3]=0.9
    """

    streamlines = Line('fornix', tracks, colors, line_width=2)
    from fos import Window, Region
    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))
    region = Region(regionname='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)

    region.add_actor(ax)
    region.add_actor(tex)
    region.add_actor(streamlines)
    #w.screenshot( 'red.png' )
    w.add_region(region)
    w.refocus_camera()
Esempio n. 3
0
    affine = None

    data = np.zeros((256, 128, 32), np.uint8)
    volume = np.zeros(data.shape + (3, ))
    volume[..., 0] = data.copy()
    volume[..., 1] = data.copy()
    volume[..., 2] = data.copy()
    volume = volume.astype(np.ubyte)
    volume[..., :] = (255, 0, 0)

    #volume[] =
    print volume.shape, volume.min(), volume.max()

    window = Window()
    region = Region()

    #volume = data
    tex = Texture3D('Buzz', volume, affine)
    w, h, d = volume.shape[:-1]
    depindex = 100
    dep = (0.5 + depindex) / np.float(d)
    texcoords = np.array([[dep, 0, 0], [dep, 0, 1], [dep, 1, 1], [dep, 1, 0]])
    vertcoords = np.array([[-w / 2., -h / 2., 0.], [-w / 2., h / 2., 0.],
                           [w / 2., h / 2., 0.], [w / 2, -h / 2., 0]])

    tex.update_quad(texcoords, vertcoords)

    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)
Esempio n. 4
0
  
    affine = None
    
    data = np.zeros((256, 128, 32), np.uint8)
    volume = np.zeros(data.shape+(3,))
    volume[...,0] = data.copy()
    volume[...,1] = data.copy()
    volume[...,2] = data.copy()
    volume = volume.astype(np.ubyte)
    volume[..., :] = (255, 0 , 0)
    
    #volume[] = 
    print volume.shape, volume.min(), volume.max()
	
    window = Window()
    region = Region()
    
    #volume = data
    tex = Texture3D('Buzz', volume, affine)
    w, h, d = volume.shape[:-1]
    depindex = 100
    dep = (0.5 + depindex) / np.float(d)
    texcoords = np.array([  [dep, 0, 0], 
                            [dep, 0, 1], 
                            [dep, 1, 1],
                            [dep, 1, 0] ])
    vertcoords = np.array( [ [-w/2., -h/2., 0.],
                            [-w/2., h/2., 0.],
                            [w/2., h/2., 0.],
                            [w/2, -h/2., 0] ])
 
Esempio n. 5
0
    tl = TrackLabeler('Bundle Picker',
                        qb,qb.downsampled_tracks(),
                        vol_shape=(182, 218, 182),tracks_alpha=1)   
    #add a interactive slicing/masking tool
    #sl = Slicer(affine,data)    
    #add one way communication between tl and sl
    #tl.slicer=sl

    title = 'Bundle Picking'
    w = Window(caption = title, 
                width = 1200, 
                height = 800, 
                bgcolor = (0.,0.,0.2) )

    region = Region( regionname = 'Main',
                        extent_min = np.array([-5.0, -5, -5]),
                        extent_max = np.array([5, 5 ,5]))
    
    ax = Axes(name = "3 axes", scale= 10, 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, "(0,0,0)", 10*2.5, 10*.5, ptr)

    #region.add_actor(ax)
    #region.add_actor(tex)
    region.add_actor(tl)
    #region.add_actor(streamlines)
    #w.screenshot( 'red.png' )
    w.add_region(region)
    w.refocus_camera()
Esempio n. 6
0
    # load initial QuickBundles with threshold 30mm
    fpkl = dname + "data/subj_05/101_32/DTI/qb_gqi_1M_linear_30.pkl"
    # qb=QuickBundles(T,30.,12)
    # save_pickle(fpkl,qb)
    qb = load_pickle(fpkl)
    # create the interaction system for tracks
    tl = TrackLabeler("Bundle Picker", qb, qb.downsampled_tracks(), vol_shape=data.shape, tracks_alpha=1)
    # add a interactive slicing/masking tool
    # sl = Slicer(affine,data)
    # add one way communication between tl and sl
    # tl.slicer=sl

    title = "Bundle Picking"
    w = Window(caption=title, width=1200, height=800, bgcolor=(0.0, 0.0, 0.2))

    region = Region(regionname="Main", extent_min=np.array([-5.0, -5, -5]), extent_max=np.array([5, 5, 5]))

    ax = Axes(name="3 axes", scale=10, linewidth=2.0)

    vert = np.array([[2.0, 3.0, 0.0]], dtype=np.float32)
    ptr = np.array([[0.2, 0.2, 0.2]], dtype=np.float32)
    tex = Text3D("Text3D", vert, "(0,0,0)", 10 * 2.5, 10 * 0.5, ptr)

    region.add_actor(ax)
    region.add_actor(tex)
    region.add_actor(tl)
    # region.add_actor(streamlines)
    # w.screenshot( 'red.png' )
    w.add_region(region)
    w.refocus_camera()
Esempio n. 7
0
File: line.py Progetto: baothien/fos
    colors = np.random.rand(np.sum(lentra),4)
    #colors[:,3]=0.9
    """

    streamlines = Line('fornix',tracks,colors,line_width=2)
    from fos import Window, Region
    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) )
    region = Region( regionname = '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)

    region.add_actor(ax)
    region.add_actor(tex)
    region.add_actor(streamlines)
    #w.screenshot( 'red.png' )
    w.add_region(region)
    w.refocus_camera()