예제 #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()
예제 #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()
예제 #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)
예제 #4
0
파일: tex3d.py 프로젝트: baothien/fos
  
    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] ])
 
예제 #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()
예제 #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()
예제 #7
0
파일: line.py 프로젝트: 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()