Example #1
0
def test_fos_functions():
    
    # Create a renderer
    r=fos.ren()    
    
    # Create 2 lines with 2 different colors
    lines=[np.random.rand(10,3),np.random.rand(20,3)]    
    colors=np.random.rand(2,3)
    c=fos.line(lines,colors)    
    fos.add(r,c)    

    # Create a volume and return a volumetric actor using volumetric rendering        
    vol=100*np.random.rand(100,100,100)
    vol=vol.astype('uint8')    
    r = fos.ren()
    v = fos.volume(vol)
    fos.add(r,v)
    
    # Remove all objects
    fos.rm_all(r)
    
    # Put some text
    
    l=fos.label(r,text='Yes Men')
    fos.add(r,l)

    # Show everything
    #fos.show(r)

    
Example #2
0
        
r=fos.ren()

#fos.add(r,fos.line(tracks1,fos.red,opacity=0.01))
#fos.add(r,fos.line(tracks2,fos.cyan,opacity=0.01))

tracks1zshift=[t+np.array([-70,0,0]) for t in tracks1z]
tracks2zshift=[t+np.array([70,0,0]) for t in tracks2z]
tracks3zshift=[t+np.array([210,0,0]) for t in tracks3z]

fos.add(r,fos.line(tracks1zshift,fos.red,opacity=0.02))
fos.add(r,fos.line(tracks2zshift,fos.cyan,opacity=0.02))
fos.add(r,fos.line(tracks3zshift,fos.blue,opacity=0.02))

print 'Show track to track correspondence br1 br2'
for i in track2track:
	fos.add(r,fos.line(tracks1zshift[i[1]],fos.yellow,opacity=0.5,linewidth=3))
	fos.label(r,str(i[0]),tracks1zshift[i[1]][0],(4,4,4),fos.white)

	fos.add(r,fos.line(tracks2zshift[i[2]],fos.yellow,opacity=0.5,linewidth=3))
	fos.label(r,str(i[0]),tracks2zshift[i[2]][0],(4,4,4),fos.white)

print 'Show track to track correspondence br1_FACT and br2_RK2'
for i in track2track2:
	fos.add(r,fos.line(tracks3zshift[i[2]],fos.yellow,opacity=0.5,linewidth=3))
	fos.label(r,str(i[0]),tracks3zshift[i[2]][0],(4,4,4),fos.white)

fos.show(r,size=(1024,768))