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

ENH, WIP: Compare CSD on multishell data to DTI on downsampled data #3157

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

alexrockhill
Copy link
Contributor

Fixes #3123

@pep8speaks
Copy link

Hello @alexrockhill, Thank you for submitting the Pull Request !

Line 150:1: W391 blank line at end of file

Do see the DIPY coding Style guideline

Copy link
Member

@skoudoro skoudoro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @alexrockhill,

Thank you for starting this. See below my comments.

Furthermore, the file need to be added in doc/examples/_valid_examples.toml.

I suppose the tutorial is not finished because I do not see any comparison.

EDIT: ok I just saw the WIP + draft, so it make sense.

Comment on lines +57 to +58
bvals = gtab.bvals
bvecs = gtab.bvecs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think you need this, it is deffine above


###############################################################################
# For the sake of simplicity, we only select two non-zero b-values for this
# example.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add the number of b-value we have on this data and which one we select. it might not be obvious for some people when reading the code

Comment on lines +60 to +63
sel_b = np.logical_or(np.logical_or(bvals == 0, bvals == 1000), bvals == 2000)
data = data[..., sel_b]

gtab = gradient_table(bvals[sel_b], bvecs[sel_b])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to myself: we might need an explicity function for that in DIPY

Comment on lines +71 to +80
plt.imshow(np.rot90(maskdata[:, :, 9, 0]), cmap=plt.cm.bone)
plt.show()

denoised = mppca(data, mask=mask, patch_radius=2)

axial_slice = 10
plt.imshow(np.rot90(denoised[:, :, axial_slice, 0]), cmap=plt.cm.bone)
plt.imshow(np.rot90(data[:, :, axial_slice, 0]), cmap=plt.cm.hot,
alpha=0.25)
plt.show()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you check if we do not have already a function in dipy.viz.plottingfor that. if yes, use it, if no, create it and just call it in the tutorial

Comment on lines +91 to +92
plt.imshow(np.rot90(ap[:, :, axial_slice]), cmap=plt.cm.bone)
plt.show()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above and explain what we see

Comment on lines +94 to +109
hmrf = TissueClassifierHMRF()
initial_segmentation, final_segmentation, PVE = hmrf.classify(
ap, nclasses=3, beta=0.1)

csf = np.where(final_segmentation == 1, 1, 0)
gm = np.where(final_segmentation == 2, 1, 0)
wm = np.where(final_segmentation == 3, 1, 0)

plt.imshow(np.rot90(denoised[:, :, axial_slice, 0]), cmap=plt.cm.bone)
plt.imshow(np.rot90(np.where(gm[:, :, axial_slice], 0.5, np.nan)),
cmap=plt.cm.bone_r, vmin=0, vmax=1, alpha=0.5)
plt.imshow(np.rot90(np.where(wm[:, :, axial_slice], 0.9, np.nan)),
cmap=plt.cm.bone, vmin=0, vmax=1, alpha=0.5)
plt.imshow(np.rot90(np.where(csf[:, :, axial_slice], 1, np.nan)),
cmap=plt.cm.cool, alpha=0.5)
plt.show()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above and explain what we see

@alexrockhill
Copy link
Contributor Author

I think I might just add this to the end of the existing tutorial instead

@alexrockhill
Copy link
Contributor Author

I'm having a bit of issues with this deciding what's the best way for comparison, I feel like just visualizing the corpus callosum like the other tutorials isn't really that telling about how much better having multishell data is. Is there phantom data to use to compare? Just thinking out loud and sharing in case anyone had advice, I haven't searched the tutorials but I will soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENH: Add tutorial comparing vanilla DTI with warping a high-quality scan back to lower resolution dMRI data
3 participants