Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tissue Classifier tracking example - changed seeding mask to wm only voxels #851

Merged
merged 2 commits into from
Feb 10, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions doc/examples/tracking_tissue_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@

This example is an extension of the
:ref:`example_deterministic_fiber_tracking` example. We begin by loading the
data, fitting a Constrained Spherical Deconvolution (CSD) reconstruction
data, creating a seeding mask from white matter voxels of the corpus callosum,
fitting a Constrained Spherical Deconvolution (CSD) reconstruction
model and creating the maximum deterministic direction getter.
"""

import numpy as np

from dipy.data import read_stanford_labels, default_sphere
from dipy.data import (read_stanford_labels,
default_sphere,
read_stanford_pve_maps)
from dipy.direction import DeterministicMaximumDirectionGetter
from dipy.io.trackvis import save_trk
from dipy.reconst.csdeconv import (ConstrainedSphericalDeconvModel,
Expand All @@ -37,12 +40,14 @@
ren = fvtk.ren()

hardi_img, gtab, labels_img = read_stanford_labels()
_, _, img_pve_wm = read_stanford_pve_maps()
data = hardi_img.get_data()
labels = labels_img.get_data()
affine = hardi_img.get_affine()
white_matter = img_pve_wm.get_data()

seed_mask = np.logical_and(labels == 2, white_matter == 1)

seed_mask = labels == 2
white_matter = (labels == 1) | (labels == 2)
seeds = utils.seeds_from_mask(seed_mask, density=2, affine=affine)

response, ratio = auto_response(gtab, data, roi_radius=10, fa_thr=0.7)
Expand Down Expand Up @@ -154,7 +159,7 @@

from dipy.tracking.local import BinaryTissueClassifier

binary_classifier = BinaryTissueClassifier(white_matter)
binary_classifier = BinaryTissueClassifier(white_matter == 1)

fig = plt.figure()
plt.xticks([])
Expand Down Expand Up @@ -222,7 +227,6 @@
- 'INVALIDPOINT': exclude_map > 0.5.
"""

from dipy.data import read_stanford_pve_maps
from dipy.tracking.local import ActTissueClassifier

img_pve_csf, img_pve_gm, img_pve_wm = read_stanford_pve_maps()
Expand Down