Skip to content
Snippets Groups Projects
Commit e94616ed authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

Unit test for mask query on a prob sumamry image. Fixed test mask

parent 95adaa45
No related branches found
No related tags found
No related merge requests found
......@@ -330,6 +330,40 @@ def test_prob_atlas_mask():
assert np.isclose(props[i], 0)
def test_summary_atlas_mask():
# test the maskLabels function on a probabilistic label atlas
reg = atlases.registry
reg.rescanAtlases()
hotests = [
'test_atlases_ho_mask_1mm',
'test_atlases_ho_mask_2mm'
]
resolutions = [1, 2]
for prefix, res in it.product(hotests, resolutions):
maskfile = op.join(datadir, '{}.nii.gz' .format(prefix))
resultsfile = op.join(datadir, '{}_res{}_summary.txt'.format(prefix,
res))
atlas = reg.loadAtlas('harvardoxford-cortical',
loadSummary=True,
resolution=res)
mask = fslimage.Image(maskfile)
labels, props = atlas.maskLabel(mask)
labels2, props2 = atlas.label( mask)
expected = np.loadtxt(resultsfile)
explabels = list(expected[:, 0])
expprops = list(expected[:, 1])
assert np.all(np.isclose(labels, labels2))
assert np.all(np.isclose(props, props2))
assert np.all(np.isclose(labels, explabels))
assert np.all(np.isclose(props, expprops))
def test_label_atlas_mask():
# Test the maskLabel function
reg = atlases.registry
......
10 6.7940552017
19 16.7728237792
43 23.3545647558
46 22.9299363057
10 27.2727272727
19 18.1818181818
43 21.2121212121
46 21.2121212121
10 9.0909090909
19 10.6060606061
43 20.0757575758
46 25.0000000000
10 27.2727272727
19 18.1818181818
43 21.2121212121
46 21.2121212121
No preview for this file type
107 1.132015306122
151 0.860969387755
154 0.573979591837
155 20.551658163265
156 14.381377551020
223 1.307397959184
224 1.482780612245
230 14.205994897959
231 12.356505102041
610 4.607780612245
612 6.058673469388
942 0.510204081633
946 0.111607142857
1009 2.423469387755
1011 3.204719387755
1033 3.252551020408
1034 3.140943877551
1035 2.726403061224
1036 2.040816326531
1059 0.143494897959
1077 2.024872448980
1078 2.901785714268
107 0.6812551610
151 0.5573905863
154 0.1238645747
155 17.0107349298
156 12.3038810900
223 1.4657308010
224 1.4657308010
230 17.8364987614
231 15.8340214699
610 5.9661436829
612 7.2873658134
942 0.5986787779
946 0.1445086705
1009 2.7043765483
1011 3.3649876135
1033 3.8810900083
1034 2.4566473988
1035 1.8992568126
1036 0.9289843105
1077 1.3212221305
1078 2.1676300578
107 0.892857142857
151 0.765306122449
154 1.275510204082
155 24.617346938776
156 16.709183673469
223 0.382653061224
224 0.765306122449
230 11.479591836735
231 9.566326530612
610 4.591836734694
612 5.484693877551
942 0.127551020408
1009 1.785714285714
1011 3.061224489796
1033 3.061224489796
1034 3.188775510204
1035 3.826530612245
1036 3.316326530612
1059 0.255102040816
1077 2.040816326531
1078 2.806122448980
151 0.2207505519
155 17.8807947020
156 13.2450331126
224 0.4415011038
230 18.7637969095
231 16.3355408389
610 7.9470198675
612 7.9470198675
942 0.2207505519
1009 2.4282560706
1011 3.5320088300
1033 4.4150110375
1034 1.7660044150
1035 2.4282560706
1036 0.8830022075
1077 0.2207505519
1078 1.3245033113
107 0.800220750552
151 0.303532008830
155 11.699779249448
156 8.747240618102
223 1.600441501104
224 0.579470198675
230 23.040838852097
231 20.722958057395
610 7.809050772627
612 9.023178807947
942 0.717439293598
946 0.193156732892
1009 3.118101545254
1011 3.283664459161
1033 4.635761589404
1034 1.352097130243
1035 1.131346578366
1036 0.220750551876
1077 0.165562913907
1078 0.855408388521
107 0.8002207506
151 0.3035320088
155 11.6997792494
156 8.7472406181
223 1.6004415011
224 0.5794701987
230 23.0408388521
231 20.7229580574
610 7.8090507726
612 9.0231788079
942 0.7174392936
946 0.1931567329
1009 3.1181015453
1011 3.2836644592
1033 4.6357615894
1034 1.3520971302
1035 1.1313465784
1036 0.2207505519
1077 0.1655629139
1078 0.8554083885
151 0.220750551876
155 17.880794701987
156 13.245033112583
224 0.441501103753
230 18.763796909492
231 16.335540838852
610 7.947019867550
612 7.947019867550
942 0.220750551876
1009 2.428256070640
1011 3.532008830022
1033 4.415011037528
1034 1.766004415011
1035 2.428256070640
1036 0.883002207506
1077 0.220750551876
1078 1.324503311258
151 0.2207505519
155 17.8807947020
156 13.2450331126
224 0.4415011038
230 18.7637969095
231 16.3355408389
610 7.9470198675
612 7.9470198675
942 0.2207505519
1009 2.4282560706
1011 3.5320088300
1033 4.4150110375
1034 1.7660044150
1035 2.4282560706
1036 0.8830022075
1077 0.2207505519
1078 1.3245033113
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment