Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 20 15:12
    skoudoro locked #2500
  • Jan 20 15:08
    foxet closed #2500
  • Jan 20 10:39
    ShreyasFadnavis commented #2500
  • Jan 20 04:40
    foxet commented #2500
  • Jan 20 01:42
    foxet edited #2500
  • Jan 20 01:41
    foxet opened #2500
  • Jan 19 16:10
    skoudoro edited #2499
  • Jan 19 15:10
    itellaetxe edited #2499
  • Jan 19 15:10
    itellaetxe edited #2499
  • Jan 19 15:09
    itellaetxe edited #2499
  • Jan 19 15:08
    itellaetxe edited #2499
  • Jan 19 15:08
    itellaetxe edited #2499
  • Jan 19 15:07
    itellaetxe edited #2499
  • Jan 19 15:04
    itellaetxe opened #2499
  • Jan 12 19:40
    alexrockhill commented #2490
  • Jan 12 19:40
    alexrockhill closed #2490
  • Jan 12 16:55
    alexrockhill commented #2490
  • Jan 12 16:54
    alexrockhill commented #2490
  • Jan 12 07:19
    alexrockhill commented #2490
  • Jan 11 21:40
    alexrockhill commented #2490
nSpotorno
@nSpotorno
Hi all,
I am trying to fit the MAP-MRI model it looks (at least to me) that the processing takes too long.
I am running on a modern workstation with 256 GB of memory and 128 CPUs (running Ubuntu 20.04).
I am analyzing a single DWI series of 104 volumes (b-values: 0,100,1000,2500), with a resolution of 2x2x2mm3. I am following the very nice DIPY tutorial and I can successfully fit the model on a single coronal slice in about 30 mins. I am using these settings: radial_order=6, laplacian_regularization=True, laplacian_weighting=.05, positivity_constraint=True . Now I am try running the entire series and after 15 hours of computation it is still at 60%. Is it plausible or is there a problem/mistake from my side somewhere? Many thanks in advance.
Eleftherios Garyfallidis
@Garyfallidis
Hi @nSpotorno are you using peaks_from_model to call the mapmri model? If yes please specify the number of processes. Start with a small number e.g. 4 and then increase.
nSpotorno
@nSpotorno
Hi @Garyfallidis, Thanks for answering. No I am not using peaks_from_model. I am following quite literally the tutorial at https://dipy.org/documentation/1.4.1./examples_built/reconst_mapmri/#example-reconst-mapmri apart from changing the dataset. In the mean time the process is finished producing a reasonably looking rtop map, for example, but it took ~25 hours. I am quite know to both DIPY and MAP-MRI does I am assuming I missing something.
Eleftherios Garyfallidis
@Garyfallidis
And you do have cvxpy installed. Correct @nSpotorno ?
AFAIK if you run like in the tutorial it uses only one Core (CPU).
You can check that my looking at your CPU monitor.
nSpotorno
@nSpotorno
Yes, I have cvxpy installed. Interesting, when I was checking the CPU usage it looked to me it was definitively firing more than one. I have also tried using the command line wraper dipy_fit_mapmri with similar performance.
Troudi-Abir
@Troudi-Abir
hello everyone, please could you help me to compute streamlines counts with DIPY?
Eleftherios Garyfallidis
@Garyfallidis
Dear @Troudi-Abir DIPY provides multiple functions to compute counts. Start from reading this tutorial here https://dipy.org/documentation/1.4.1./examples_built/streamline_tools/#example-streamline-tools
Troudi-Abir
@Troudi-Abir
Dear @Garyfallidis thank you very much.
Behzad Golshaei
@bgolshaei
@Garyfallidis @Troudi-Abir I am using DIPY for image registration but instead of the deformed mesh, I would like to have a displacement vector field. I would like to know how can I find the displacement tensor after optimizing my images registration?
Serge Koudoro
@skoudoro
Hi @bgolshaei, I would recommend looking at this tutorial concerning the displacement vector field: https://dipy.org/documentation/1.4.1./examples_built/register_binary_fuzzy/#example-register-binary-fuzzy
Behzad Golshaei
@bgolshaei
@skoudoro Hi Serge, thank you so much. Sorry for asking maybe silly question but I have read all this toturial and even the git files but I could not extract the displacemnt from "mapping" object. I need to have the data of the object movement to use the vector field of matplot libe to drawe the displacement field.
Serge Koudoro
@skoudoro

@bgolshaei, Deforming a grid is a helpful way to visualize a displacement field. we have a function for this:

from dipy.viz import
regtools;regtools.plot_2d_diffeomorphic_map(mapping, 10, 'diffeomorphic_map.png')

if you need quiver to draw the displacement field, we do not have it yet but it would be a nice small project/contribution to do during DIPY workshop or Brainhack. You can look inside the function above to adapt it.

I hope it helps

Serge Koudoro
@skoudoro
I forgot to say that you also have mapping.get_forward_field() and mapping.get_backward_field() that return the displacement
Troudi-Abir
@Troudi-Abir
Hello, Is IT possible to split a fiber bundle into Left_Helisphere_bundle and Right_Hemisphere_bundle? Note that the type of the bundle is : nibabel.streamline array_sequence.ArraySequence. I tried to find a way but I can't. Could you help me please?
Steven Meisler
@smeisler
Hello, I know it is possible to calculate FA profiles across a tract (e.g. 100 points). However, if I want a single mean value, is there a way to do this in DIPY besides simply averaging the 100 nodes? Or rather, is the average of the 100 nodes a good approximation of the average tract FA based on how FA values are assigned to tract segments? Thanks!
Bramsh Q Chandio
@BramshQamar

Hi @smeisler,

You can assign a segment number to each point on the streamline. And calculate the mean of that segment. For example, you choose 100 segments then the points of the streamline will be assigned to the closest segment. You can then take the average per segment. You can see here how to create those segments on a bundle https://dipy.org/documentation/1.4.1./examples_built/bundle_assignment_maps/#example-bundle-assignment-maps

from dipy.stats.analysis import assignment_map
n = 100
indx = assignment_map(model_af_l, model_af_l, n)
indx = np.array(indx)
here indx has segment number/label per point
Bramsh Q Chandio
@BramshQamar
@smeisler Projecting FA values on a tract and calculating mean per segment:
import numpy as np
from dipy.tracking.streamline import transform_streamlines
from dipy.stats.analysis import assignment_map
from scipy.ndimage.interpolation import map_coordinates
from dipy.io.image import load_nifti,

bundle #load your bundle
FA, affine = load_nifti(metric_file_name)

n = 100 #this is for total number of segments and won't change the number of points per streamline
indx = assignment_map(bundle, bundle, n)
indx = np.array(indx)

affine_r = np.linalg.inv(affine)
transformed_bundle = transform_streamlines(bundle, affine_r)

values = map_coordinates(FA,  transformed_bundle._data.T, order=1)

# here  indx has segment number/label per point of all streamlines
# values has FA value per point of all streamlines

#you can take an average of FA values based on which segment its corresponding point belongs to.

fa_mean = [0]*n

for i in range(n):

    fa_mean[i] = np.mean(values[indx==i])

#plot the mean FA profile

import matplotlib.pyplot as plt
plt.plot(list(range(n)), fa_mean) 
plt.title("FA mean profile")
plt.xlabel("Segment number")
plt.ylim([0,1])
plt.ylabel("FA")

# you can also visualize your bundle with n segments 

colors = [np.random.rand(3) for si in range(n)]

disks_color = []
for i in range(len(indx)):
    disks_color.append(tuple(colors[indx[i]]))

from dipy.viz import window, actor    
scene = window.Scene()
scene.SetBackground(1, 1, 1)
scene.add(actor.line(bundle, fake_tube=True, colors=disks_color,
                     linewidth=6))

window.show(scene)
Hi @Troudi-Abir
What kind of bundle is it? Is it a whole-brain tractogram?
Steven Meisler
@smeisler
Hi @BramshQamar I don't think I was clear when explaining my question. I would like a single mean FA value across the tract. I was wondering if there was a way to do that without creating the tract profiles first. Or rather, is the average across all segments of a bundle a good way to find the average FA of the bundle? So in the code above, np.mean(fa_mean)
Bramsh Q Chandio
@BramshQamar
@smeisler yes, you can take a mean of the entire bundle profile like this np.mean(fa_mean) or you can give more weightage to some segments and less to others (eg: more weightage to mid-segments). Bundle shape and FA values change throughout the length of the bundle. I am not sure if it's a good idea to have just one FA value represent the entire bundle.
Behzad Golshaei
@bgolshaei
@skoudoro Thank you so much for your advice. I have done the implementation and find out the displacement field.
Chandana Kodiweera
@kodiweera
Started building a wrapper package to fit diffusion models conveniently. https://github.com/kodiweera/difit
Paolo Avesani
@Paolopost
In the module dipy.tracking.utils the function 'target' allows the filtering of streamlines crossing a ROI volumetric mask; does the current implementation (dipy 1.4.0) compute the filtering considering the points or the segment crossing a voxels? This detail affects the result in a meaningful way when using streamline compression.
Eleftherios Garyfallidis
@Garyfallidis
@Paolopost target uses points, target_line_based uses segments (for compressed streamlines).
Emmanuelle
@EmmaRenauld

Hi!

Links at the bottom of page https://dipy.org/documentation/1.4.1./documentation/ ("index" and "search page") are broken! Thanks!

(if you want I can add an issue on Github but I wasn't sure how you manage your doc)
Serge Koudoro
@skoudoro
Thank you @EmmaRenauld, There is already an issue with that. We will fix it asap.
tecork
@tecork

Hello everyone,
I am trying to run the following code:

from dipy.denoise.localpca import localpca
from dipy.denoise.pca_noise_estimate import pca_noise_estimate
from dipy.core.gradients import gradient_table

gtab = gradient_table(bvals, bvecs)
sigma = pca_noise_estimate(data, gtab, correct_bias=True, smooth=3)
denoised_arr = localpca(data, sigma, tau_factor=2.3, patch_radius=2)

using a dataset that is (100, 128, 3, 21) with the following bvals setup:
array([ 0., 1000., 1000., 1000., 1000., 1000., 1000., 0., 1000.,
1000., 1000., 1000., 1000., 1000., 0., 1000., 1000., 1000.,
1000., 1000., 1000.])
I keep receiving this error when I run though:

.../opt/anaconda3/lib/python3.7/site-packages/dipy/denoise/localpca.py:246: RuntimeWarning: invalid value encountered in true_divide
denoised_arr = thetax / theta

The resulting array is all np.nan's.
Any idea on how to go about this?

tecork
@tecork
Patch2Self and Non-Local Means techniques work on the same data. Local PCA via empirical thresholds and Marcenko-Pastur PCA algorithm techniques throw the same error for the said dataset.
Shreyas Fadnavis
@ShreyasFadnavis
Hey @tecork ! thanks for reaching out :) I guess I know why this error is coming. I have never encountered it personally. Can you share some data that you are getting this error with?
2 replies
Serge Koudoro
@skoudoro
Also, it will be good to create an issue concerning this warning/error. thanks @tecork
@ShreyasFadnavis Here is the dataset I was working with. Not a very impressive dataset, but I wanted to workout the denoising tools for a project I'm working on!
@skoudoro I'll create and issue as well. I just wanted to run it through the community first because I was suspecting it could very well be a user error
araikes
@araikes
@skoudoro @Garyfallidis: Two questions:
  1. Is there a way to use the tensor output from dipy_fit_dti or dipy_fit_dki to create scalar maps in a subsequent step after reorienting to a T1w image?
  2. Can I fit the RESTORE model using the CLI?
Serge Koudoro
@skoudoro
Hi @araikes, concerning your question number 2, You can not use RESTORE model using CLI. However, this is something easy to add. Can you create an issue and should be able to add it before the release in november 7-8.
Concerning your question 1, I will let @Garyfallidis answer
araikes
@araikes
@skoudoro Issue added.
@Garyfallidis: I'll clarify my question since it isn't as obvious what I'm thinking now that I'm reading it. If I use ANTs to register the the b0 to a T1w or T2w image (imaging a lot of rodents...) and then reorient the tensors (https://github.com/ANTsX/ANTs/wiki/Warp-and-reorient-a-diffusion-tensor-image), is there a DIPY way to then get the scalar maps from those reoriented tensors?
Eleftherios Garyfallidis
@Garyfallidis
@araikes in what form are the reoriented tensors saved?
araikes
@araikes
@Garyfallidis They're a NIFTI. DIPY's tensor is NIFTI-1, so it feeds directly into ANTs ReorientTensor without any manipulation.
Eleftherios Garyfallidis
@Garyfallidis
Okay can you load them back in DIPY? If yes then you can use the our dipy.reconst.dti module in a predictive way.
The question is what you want to do next.
Do you want to use these tensors to generate metrics such as FA etc?
araikes
@araikes
That's the plan (at the moment)