Exemplo n.º 1
0
def streamline2rgb(streamline):
    """Compute orientation of a streamline and retrieve and appropriate RGB
    color to represent it.
    """
    # simplest implementation:
    tmp = orient2rgb(streamline[0] - streamline[-1])
    return tmp
Exemplo n.º 2
0
def track2rgb(track):
    """Compute orientation of a track and retrieve and appropriate RGB
    color to represent it.
    """
    # simplest implementation:
    #return orient2rgb(track[0] - track[-1])
    v=track[0]-track[-1]
    v=v/np.linalg.norm(v)
    #return boys2rgb(v)
    return orient2rgb(v)
Exemplo n.º 3
0
def see_skeletons(fskel):
    
    C=load_pickle(fskel)
    tracks=[C[c]['most'] for c in C if C[c]['N'] > 10 ]
    
    r=fvtk.ren()    
    colors=np.array([t[0]-t[-1] for t in tracks])
    colors=colormap.orient2rgb(colors)
    fvtk.add(r,fvtk.line(tracks,colors))
    
    fvtk.show(r)
Exemplo n.º 4
0
def track2rgb(track):
    """Compute orientation of a track and retrieve and appropriate RGB
    color to represent it.
    """
    # simplest implementation:
    return orient2rgb(track[0] - track[-1])
Exemplo n.º 5
0
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

"""

# To show the figure
Exemplo n.º 6
0
def track2rgb(track):
    """Compute orientation of a track and retrieve and appropriate RGB
    color to represent it.
    """
    # simplest implementation:
    return orient2rgb(track[0] - track[-1])
Exemplo n.º 7
0
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.º 8
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)