Skip to content

Commit

Permalink
Merge pull request dipy#1502 from skoudoro/fix-doc-issue
Browse files Browse the repository at this point in the history
[DOC] Fix doc generation
  • Loading branch information
Garyfallidis committed Apr 30, 2018
2 parents f7afc8f + 55515db commit 13ebb61
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 12 deletions.
2 changes: 2 additions & 0 deletions doc/examples/bundle_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def show_both_bundles(bundles, colors=None, show=True, fname=None):

show_both_bundles([cb_subj1, cb_subj2],
colors=[window.colors.orange, window.colors.red],
show=False,
fname='before_registration.png')

"""
Expand All @@ -78,6 +79,7 @@ def show_both_bundles(bundles, colors=None, show=True, fname=None):

show_both_bundles([cb_subj1, cb_subj2_aligned],
colors=[window.colors.orange, window.colors.red],
show=False,
fname='after_registration.png')

"""
Expand Down
7 changes: 5 additions & 2 deletions doc/examples/linear_fascicle_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import numpy as np
import os.path as op
import nibabel as nib
from dipy.io.streamline import load_trk
import dipy.core.optimize as opt
if not op.exists('lr-superiorfrontal.trk'):
from streamline_tools import *
Expand All @@ -39,8 +40,10 @@
t1_data = t1.get_data()
data = hardi_img.get_data()
# Read the candidates from file in voxel space:
candidate_sl = [s[0] for s in nib.trackvis.read('lr-superiorfrontal.trk',
points_space='voxel')[0]]

candidate_sl, hdr = load_trk('lr-superiorfrontal.trk')
# candidate_sl = [s[0] for s in nib.trackvis.read('lr-superiorfrontal.trk',
# points_space='voxel')[0]]

"""
Expand Down
2 changes: 1 addition & 1 deletion doc/examples/sfm_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
color = line_colors(streamlines)

# Enables/disables interactive visualization
interactive = True
interactive = False

"""
To speed up visualization, we will select a random sub-set of streamlines to
Expand Down
8 changes: 4 additions & 4 deletions doc/examples/streamline_length.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def simulated_bundles(no_streamlines=50, n_pts=100):
ax.hist(lengths, color='burlywood')
ax.set_xlabel('Length')
ax.set_ylabel('Count')
plt.show()
# plt.show()
plt.legend()
plt.savefig('length_histogram.png')

Expand Down Expand Up @@ -132,7 +132,7 @@ def simulated_bundles(no_streamlines=50, n_pts=100):
ren.add(bundle_actor3)

ren.set_camera(position=(0, 0, 0), focal_point=(30, 0, 0))
window.record(out_path='simulated_cosine_bundle.png', size=(900, 900))
window.record(ren, out_path='simulated_cosine_bundle.png', size=(900, 900))
if interactive:
window.show(ren)

Expand All @@ -157,7 +157,7 @@ def simulated_bundles(no_streamlines=50, n_pts=100):
ax.hist(n_pts_ds2, color='b', histtype='step', label='approx_polygon_track (0.25)')
ax.set_xlabel('Number of points')
ax.set_ylabel('Count')
plt.show()
# plt.show()
plt.legend()
plt.savefig('n_pts_histogram.png')

Expand All @@ -180,7 +180,7 @@ def simulated_bundles(no_streamlines=50, n_pts=100):
ax.plot(lengths_downsampled2, color='b', label='approx_polygon_track (0.25)')
ax.set_xlabel('Streamline ID')
ax.set_ylabel('Length')
plt.show()
# plt.show()
plt.legend()
plt.savefig('lengths_plots.png')

Expand Down
8 changes: 4 additions & 4 deletions doc/examples/streamline_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,10 @@
# Move streamlines to "trackvis space"
voxel_size = labels_img.header.get_zooms()
trackvis_point_space = utils.affine_for_trackvis(voxel_size)
lr_sf_trk = utils.move_streamlines(lr_superiorfrontal_track,
trackvis_point_space, input_space=affine)
# lr_sf_trk = utils.move_streamlines(lr_superiorfrontal_track,
# trackvis_point_space, input_space=affine)

lr_sf_trk = Streamlines(lr_sf_trk)
lr_sf_trk = Streamlines(lr_superiorfrontal_track)

# Save streamlines
save_trk("lr-superiorfrontal.trk", lr_sf_trk, shape=shape, vox_size=voxel_size, affine=affine)
Expand Down Expand Up @@ -262,7 +262,7 @@
as long as we specify the right coordinate system.
"""

dm_trackvis = utils.density_map(lr_sf_trk, shape, affine=trackvis_point_space)
dm_trackvis = utils.density_map(lr_sf_trk, shape, affine=np.eye(4))
assert np.all(dm == dm_trackvis)

"""
Expand Down
2 changes: 1 addition & 1 deletion doc/examples/valid_examples.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
tissue_classification.py
bundle_registration.py
tracking_tissue_classifier.py
tracking_comparison_direction_getters.py
tracking_bootstrap_peaks.py
# piesno.py
viz_advanced.py
viz_slice.py
Expand Down
2 changes: 2 additions & 0 deletions doc/examples/viz_roi_contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
a decimal between zero and one. Here, we set the color as blue/green with
50% opacity.
"""

surface_opacity = 0.5
surface_color = [0, 1, 1]

Expand All @@ -82,6 +83,7 @@
If you uncomment the following line, the rendering will pop up in an
interactive window.
"""

interactive = False
if interactive:
window.show(ren)
Expand Down
1 change: 1 addition & 0 deletions doc/examples/viz_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
First, a bunch of imports.
"""

import os

from dipy.data import read_viz_icons, fetch_viz_icons
Expand Down

0 comments on commit 13ebb61

Please sign in to comment.