Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/nipyPublic

Commit427db2c

Browse files
committed
Merge branch 'patch-1'
* patch-1: Test visualization example Update doc/labs/viz.rst Cast coordinates to int
2 parents2c1cf76 +6482f49 commit427db2c

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

‎doc/labs/viz.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ An example
3636
mni_sform_inv = np.linalg.inv(mni_sform)
3737
# Color an asymmetric rectangle around Broca area:
3838
x, y, z = -52, 10, 22
39-
x_map, y_map, z_map = coord_transform(x, y, z, mni_sform_inv)
39+
x_map, y_map, z_map =[int(coord) for coord incoord_transform(x, y, z, mni_sform_inv)]
4040
map = np.zeros((182, 218, 182))
4141
map[x_map-30:x_map+30, y_map-3:y_map+3, z_map-10:z_map+10] = 1
4242

‎nipy/labs/tests/test_viz.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
""" Tests for visualization
2+
"""
3+
4+
importnumpyasnp
5+
6+
fromnipy.labs.vizimportplot_map,mni_sform,coord_transform
7+
8+
9+
deftest_example():
10+
# Example from tutorial.
11+
# First, create a fake activation map: a 3D image in MNI space with
12+
# a large rectangle of activation around Broca Area
13+
mni_sform_inv=np.linalg.inv(mni_sform)
14+
# Color an asymmetric rectangle around Broca area:
15+
x,y,z=-52,10,22
16+
x_map,y_map,z_map= [int(coord)forcoordincoord_transform(x,y,z,
17+
mni_sform_inv)]
18+
map=np.zeros((182,218,182))
19+
map[x_map-30:x_map+30,y_map-3:y_map+3,z_map-10:z_map+10]=1
20+
21+
# We use a masked array to add transparency to the parts that we are
22+
# not interested in:
23+
thresholded_map=np.ma.masked_less(map,0.5)
24+
25+
# And now, visualize it:
26+
plot_map(thresholded_map,mni_sform,cut_coords=(x,y,z),vmin=0.5)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp