[Neuroimaging] Using RESTORE in a dti_model fit

Bago mrbago at gmail.com
Fri Dec 2 15:15:25 EST 2016


Hi Rodrigo,

I believe dipy provides a command line utility that does what you want,
dipy_reconst_dti_restore.

If you want to learn more about how to write dipy scripts take a look at
https://github.com/nipy/dipy/blob/master/dipy/workflows/reconst.py.
<https://github.com/nipy/dipy/blob/master/dipy/workflows/reconst.py> You
simply need to pass your data to the model and to get a fit, then you can
get metrics by using the fit's attributes, eg `tensor_fit.fa` or `
tensor_fit.md`. Those are arrays that can be saved as images using nibabel.

These scripts are implemented as "Workflow" classes, but you don't really
need to worry about that part. Just review the run method, witch you could
emulate to write your own scripts. The workflow classes just give us a
little more flexibility, for example the classes can be wrapped to make
nipype interfaces.

Bago

On Thu, Dec 1, 2016 at 6:37 PM Perea Camargo, Rodrigo Dennis <
RPEREACAMARGO at mgh.harvard.edu> wrote:

> Hi all,
> I am trying to reconstruct a diffusion tensor model while correcting for
> outliers using RESTORE. In the Dipy documentation I found this helpful
> link:
> http://nipy.org/dipy/examples_built/restore_dti.html
> and I follow some instructions creating a script that I copied shown below.
>
>
> The problem is that 1) I am new at Python and 2) new to Dipy. Apparently
> the link provides a comparison example for introduced noisy data but it is
> not very specific for running  RESTORE. Could anybody provide me more
> advice? My goal is to apply RESTORE to my DWIs and extract/save the FA (and
> other ) diffusivity  maps,  but I got stuck at the end…..
>
>
> Thanks in advance,
> Rodrigo
>
>
>
> HERE IS MY SCRIPT (check below for my questions, if not clearer):
>
> #!/bin/pyton
>
> #import modules
> import numpy as np
> import nibabel as nib
> from os.path import expanduser, join
>
> #data initialization
> dname=‘<NII_DATA_FOLDER>'
> fdwi=join(dname,’<SUBJ1>.nii.gz')
> print(fdwi)
> fbval=join(dname,'<SUBJ1>.bvals')
> fbvec=join(dname,'<SUBJ1>.bvecs')
> print(fbval,fbvec)
>
> #loading nii
> img=nib.load(fdwi)
> data = img.get_data()
>
> #loading bvecs/bvals
> from dipy.io import read_bvals_bvecs
> bvals, bvecs = read_bvals_bvecs(fbval, fbvec)
>
> #Creating the gradient table
> from dipy.core.gradients import gradient_table
> gtab = gradient_table(bvals, bvecs)
>
> #Reconstructing a model
> dti_wls = dti.TensorModel(gtab)
>
> #Estimate noise (or sigma) for restore
> import dipy.denoise.noise_estimate as ne
> sigma = ne.estimate_sigma(data)
>
> dti_restore = dti.TensorModel(gtab,fit_method='RESTORE', sigma=sigma)
>
> #Now how do I get my tensor outputs??
> #I believe I haven’t even apply the tensor fit…. not sure what else to do.
>
> ---
> Rodrigo Dennis Perea
> Research Fellow
> Department of Radiology
> Athinoula A. Martinos Center
> Massachusetts General Hospital
> Harvard Medical School
> rpereacamargo at mgh.harvard.edu
>
>
>
>
>
>
>
> The information in this e-mail is intended only for the person to whom it
> is
> addressed. If you believe this e-mail was sent to you in error and the
> e-mail
> contains patient information, please contact the Partners Compliance
> HelpLine at
> http://www.partners.org/complianceline . If the e-mail was sent to you in
> error
> but does not contain patient information, please contact the sender and
> properly
> dispose of the e-mail.
> _______________________________________________
> Neuroimaging mailing list
> Neuroimaging at python.org
> https://mail.python.org/mailman/listinfo/neuroimaging
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20161202/071b7669/attachment.html>


More information about the Neuroimaging mailing list