当前位置: 首页>>代码示例>>Python>>正文


Python Dpy.read_tracksi方法代码示例

本文整理汇总了Python中dipy.io.dpy.Dpy.read_tracksi方法的典型用法代码示例。如果您正苦于以下问题:Python Dpy.read_tracksi方法的具体用法?Python Dpy.read_tracksi怎么用?Python Dpy.read_tracksi使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dipy.io.dpy.Dpy的用法示例。


在下文中一共展示了Dpy.read_tracksi方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_dpy

# 需要导入模块: from dipy.io.dpy import Dpy [as 别名]
# 或者: from dipy.io.dpy.Dpy import read_tracksi [as 别名]
def test_dpy():

    fd,fname = mkstemp()    
    dpw = Dpy(fname,'w')    
    A=np.ones((5,3))
    B=2*A.copy()
    C=3*A.copy()        
    dpw.write_track(A)
    dpw.write_track(B)
    dpw.write_track(C)            
    dpw.write_tracks([C,B,A])    
    dpw.close()    
    dpr = Dpy(fname,'r')    
    assert_equal(dpr.version()=='0.0.1',True)    
    T=dpr.read_tracksi([0,1,2,0,0,2])    
    print(T)    
    T2=dpr.read_tracks()    
    assert_equal(len(T2),6)    
    dpr.close()
    assert_array_equal(A,T[0])
    assert_array_equal(C,T[5])
    os.remove(fname)

    
    
    
开发者ID:yarikoptic,项目名称:dipy,代码行数:24,代码来源:test_dpy.py

示例2: roi_intersection

# 需要导入模块: from dipy.io.dpy import Dpy [as 别名]
# 或者: from dipy.io.dpy.Dpy import read_tracksi [as 别名]
def roi_intersection(fdpy,fatlas,roi_no,froidpy):    
    dpr=Dpy(fdpy,'r')
    T=dpr.read_tracksi(range(10000))    
    dpr.close()    
    Troi=[]
    wI=get_roi(fatlas,roi_no,0)
    for (i,t) in enumerate(T):
        if i%1000==0:
            print i
        if track_roi_intersection_check(t,wI,.5):
            Troi.append(t)
    print(len(Troi))    
    dpw=Dpy(froidpy,'w')
    dpw.write_tracks(Troi)
    dpw.close()
    
    '''
开发者ID:Garyfallidis,项目名称:trn,代码行数:19,代码来源:analyze_steam.py

示例3: test_dpy

# 需要导入模块: from dipy.io.dpy import Dpy [as 别名]
# 或者: from dipy.io.dpy.Dpy import read_tracksi [as 别名]
def test_dpy():
    fname = 'test.bin'
    with InTemporaryDirectory():
        dpw = Dpy(fname, 'w')
        A = np.ones((5, 3))
        B = 2 * A.copy()
        C = 3 * A.copy()
        dpw.write_track(A)
        dpw.write_track(B)
        dpw.write_track(C)
        dpw.write_tracks([C, B, A])
        dpw.close()
        dpr = Dpy(fname, 'r')
        assert_equal(dpr.version() == '0.0.1', True)
        T = dpr.read_tracksi([0, 1, 2, 0, 0, 2])
        T2 = dpr.read_tracks()
        assert_equal(len(T2), 6)
        dpr.close()
        assert_array_equal(A, T[0])
        assert_array_equal(C, T[5])
开发者ID:MPDean,项目名称:dipy,代码行数:22,代码来源:test_dpy.py

示例4: test_dpy

# 需要导入模块: from dipy.io.dpy import Dpy [as 别名]
# 或者: from dipy.io.dpy.Dpy import read_tracksi [as 别名]
def test_dpy():
    fname = 'test.bin'
    with InTemporaryDirectory():
        dpw = Dpy(fname, 'w')
        A = np.ones((5, 3))
        B = 2 * A.copy()
        C = 3 * A.copy()
        dpw.write_track(A)
        dpw.write_track(B)
        dpw.write_track(C)
        dpw.write_tracks(Streamlines([C, B, A]))

        all_tracks = np.ascontiguousarray(np.vstack([A, B, C, C, B, A]))
        npt.assert_array_equal(all_tracks, dpw.tracks[:])
        dpw.close()

        dpr = Dpy(fname, 'r')
        npt.assert_equal(dpr.version() == u'0.0.1', True)
        T = dpr.read_tracksi([0, 1, 2, 0, 0, 2])
        T2 = dpr.read_tracks()
        npt.assert_equal(len(T2), 6)
        dpr.close()
        npt.assert_array_equal(A, T[0])
        npt.assert_array_equal(C, T[5])
开发者ID:StongeEtienne,项目名称:dipy,代码行数:26,代码来源:test_dpy.py

示例5: Dpy

# 需要导入模块: from dipy.io.dpy import Dpy [as 别名]
# 或者: from dipy.io.dpy.Dpy import read_tracksi [as 别名]
dpw.write_tracks(streamlines)

"""
Write one track
"""

dpw.write_track(streamlines[0])

"""
or one track each time.
"""

for t in streamlines:
    dpw.write_track(t)

dpw.close()

"""
Read streamlines directly from the disk using their indices

.. include:: ../links_names.inc
"""

dpr = Dpy('fornix.dpy', 'r')
some_streamlines = dpr.read_tracksi([0, 10, 20, 30, 100])
dpr.close()


print(len(streamlines))
print(len(some_streamlines))
开发者ID:StongeEtienne,项目名称:dipy,代码行数:32,代码来源:streamline_formats.py

示例6:

# 需要导入模块: from dipy.io.dpy import Dpy [as 别名]
# 或者: from dipy.io.dpy.Dpy import read_tracksi [as 别名]
"""
or one track each time
"""

for t in tracks:
    dpw.write_track(t*3)

dpw.close()

"""
read tracks directly from the disk using their indices
"""

dpr=Dpy('fornix.dpy','r')
some_tracks=dpr.read_tracksi([0,10,20,30,100])
dpr.close()


"""
Number of tracks in before and after
"""

print(len(tracks))
print(len(some_tracks))

"""
.. include:: ../links_names.inc

"""
开发者ID:JDWarner,项目名称:dipy,代码行数:31,代码来源:file_formats.py


注:本文中的dipy.io.dpy.Dpy.read_tracksi方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。