Exemplo n.º 1
0
def show(T,A,IND,VERTS,scale):
    
    r=fvtk.ren()
    fvtk.clear(r)
    fvtk.add(r,fvtk.line(T,fvtk.red))
    fvtk.show(r)
    
    Td=[downsample(t,20) for t in T]
    C=local_skeleton_clustering(Td,3)
    fvtk.clear(r)
    lent=float(len(T))
    
    for c in C:
        color=np.random.rand(3)
        virtual=C[c]['hidden']/float(C[c]['N'])
        if length(virtual)> virtual_thr: 
            linewidth=100*len(C[c]['indices'])/lent
            if linewidth<1.:
                linewidth=1
            #fvtk.add(r,fvtk.line(virtual,color,linewidth=linewidth))
            #fvtk.add(r,fvtk.label(r,str(len(C[c]['indices'])),pos=virtual[0],scale=3,color=color ))
        #print C[c]['hidden'].shape
    
    print A.shape
    print IND.shape
    print VERTS.shape
    
    all,allo=fvtk.crossing(A,IND,VERTS,scale,True)
    colors=np.zeros((len(all),3))
    for (i,a) in enumerate(all):
        if allo[i][0]==0 and allo[i][1]==0 and allo[i][2]==1:
            pass
        else:            
            colors[i]=cm.boys2rgb(allo[i])
    
    fvtk.add(r,fvtk.line(all,colors))    
    fvtk.show(r)
Exemplo n.º 2
0
dcross_shift = [c + np.array([3, 8, 6]) for c in dcross]

fvtk.add(r, fvtk.line(no_cross_shift, fvtk.blue, linewidth=5.))
fvtk.add(r, fvtk.line(cross_shift, fvtk.indigo, linewidth=5.))
fvtk.add(r, fvtk.line(dcross_shift, fvtk.red, linewidth=5.))

from dipy.viz import colormap as cm

all_shift = [c + np.array([10, 0, 0]) for c in all]
all_shift2 = [c + np.array([20, 0, 0]) for c in all]

colors = np.zeros((len(all), 3))
colors2 = np.zeros((len(all), 3))
for (i, a) in enumerate(all):
    #print a[0]
    colors[i] = cm.boys2rgb(allo[i])
    colors2[i] = cm.orient2rgb(allo[i])

fvtk.add(r, fvtk.line(all_shift, colors, linewidth=1.))
fvtk.add(r, fvtk.line(all_shift2, colors2, linewidth=2.))
"""

.. figure:: visualize_cross1000000.png
   :align: center

   **The crossings of a region of interest shown with one color, or boy2rgb or standard orient2rgb colormap**.

.. include:: ../links_names.inc

"""
Exemplo n.º 3
0
dcross_shift=[c+np.array([3,8,6]) for c in dcross]

fvtk.add(r,fvtk.line(no_cross_shift,fvtk.blue,linewidth=5.))
fvtk.add(r,fvtk.line(cross_shift,fvtk.indigo,linewidth=5.))
fvtk.add(r,fvtk.line(dcross_shift,fvtk.red,linewidth=5.))

from dipy.viz import colormap as cm

all_shift=[c+np.array([10,0,0]) for c in all]
all_shift2=[c+np.array([20,0,0]) for c in all]

colors=np.zeros((len(all),3))
colors2=np.zeros((len(all),3))
for (i,a) in enumerate(all):
    #print a[0]
    colors[i]=cm.boys2rgb(allo[i])
    colors2[i]=cm.orient2rgb(allo[i])

fvtk.add(r,fvtk.line(all_shift,colors,linewidth=1.))
fvtk.add(r,fvtk.line(all_shift2,colors2,linewidth=2.))


"""

.. figure:: visualize_cross1000000.png
   :align: center

   **The crossings of a region of interest shown with one color, or boy2rgb or standard orient2rgb colormap**.

.. include:: ../links_names.inc
Exemplo n.º 4
0
#3,8,6 double crossing
dcross=fvtk.crossing(QA[3,8,6],IN[3,8,6],verts,1)

all=fvtk.crossing(QA,IN,verts,1)
fvtk.add(r,fvtk.line(all,fvtk.azure,linewidth=1.))

no_cross_shift=[c+np.array([3,8,4]) for c in no_cross]
cross_shift=[c+np.array([3,8,5]) for c in cross]
dcross_shift=[c+np.array([3,8,6]) for c in dcross]

fvtk.add(r,fvtk.line(no_cross_shift,fvtk.blue,linewidth=5.))
fvtk.add(r,fvtk.line(cross_shift,fvtk.indigo,linewidth=5.))
fvtk.add(r,fvtk.line(dcross_shift,fvtk.red,linewidth=5.))

from dipy.viz import colormap as cm

all_shift=[c+np.array([10,0,0]) for c in all]
all_shift2=[c+np.array([20,0,0]) for c in all]

colors=np.zeros((len(all),3))
colors2=np.zeros((len(all),3))
for (i,a) in enumerate(all):
    #print a[0]
    colors[i]=cm.boys2rgb(a[0])
    colors2[i]=cm.orient2rgb(a[0])

fvtk.add(r,fvtk.line(all_shift,colors,linewidth=1.))
fvtk.add(r,fvtk.line(all_shift2,colors2,linewidth=2.))

fvtk.show(r)