Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 08:25
    skoudoro commented #2460
  • 06:31
    arokem commented #2460
  • Oct 27 15:57

    skoudoro on master

    make it compatible when number … TST: Fixes a test that had the … Also fixes the one volume case. and 4 more (compare)

  • Oct 27 15:57
    skoudoro closed #2453
  • Oct 27 15:57
    skoudoro commented #2453
  • Oct 27 15:49
    skoudoro opened #2460
  • Oct 27 06:40
    DenebBoito commented #2342
  • Oct 26 18:11
    giulia-berto commented #2453
  • Oct 26 17:35
    arokem commented #2457
  • Oct 26 17:27
    skoudoro commented #2457
  • Oct 26 17:16
    arokem closed #2457
  • Oct 26 17:16
    arokem commented #2457
  • Oct 26 16:35
    aloofhawk opened #2457
  • Oct 26 15:10
    Garyfallidis commented #2453
  • Oct 25 16:05
    kerkelae review_requested #2342
  • Oct 25 16:05
    kerkelae review_requested #2342
  • Oct 25 16:05
    kerkelae review_requested #2342
  • Oct 25 16:04
    kerkelae commented #2342
  • Oct 25 16:02
    codecov[bot] commented #2342
  • Oct 25 16:02
    codecov[bot] commented #2342
Mohammad Hadi Aarabi
@mohammadhadiarabi
I have a question. If I have trk files of some fibers in native space, how can I extract the mean of diffusion measures( FA/MD/...) of fiber paths using dipy?
Yashvardhan Jain
@J-Yash
@ShreyasFadnavis Thank you for the response! This seems close to what I need but looking at the code it seems it takes in 1-D array. Ideally, I need something like this method in ANTs: https://antspy.readthedocs.io/en/latest/_modules/ants/registration/create_jacobian_determinant_image.html#create_jacobian_determinant_image
The ANTs method takes in a static image (3D in my case), and a transform file (created after SyN), and calculates/returns the jacobian determinant image (in my case the log jacobian). I wonder if a functionality like this exists in DIPY? If not, it would be great if someone could help me with how I should go about implementing this in DIPY :)
Paween Wongkornchaovalit
@paween:matrix.org
[m]
Hi, I am not sure if there are anyone have asked about deep learning before. As far as I know, DWIs contains four dimensions, three for i, j, k, and another for directions; so, totally there should be #number of directions images. The question is how can we use this data to be in deep learning input layer. PS. I'm working with tensorflow. Thanks a lot for your help
Eleftherios Garyfallidis
@Garyfallidis
@paween:matrix.org DL cannot easily handle 4D data. You may want to read this paper here https://www.sciencedirect.com/science/article/pii/S1361841520300943 Also we will need more information about the actual application otherwise it is very hard to provide advice.
小秦
@xiaoqinkaihua_twitter
Hi @Garyfallidis , I'm Paween. Thank you for your reply. The application that I am planning to work with is I am trying to use to DL to estimate DTI parameters, like FA, MD. From my understanding, we need to generate these DTI parameters from model fitting, which provides maps of DTI parameters. Then we can use these maps as training label. However, since DWIs always come in 4D data, so I have no idea how can I put it in DL process.
mert
@mertyergin
Hi. I am working on prostate MRI. I have diffusion-weighted images with different b values [0,50,400,800]. I need to generate DWI images that b value is 1400. I examined the documentation of dipy but I couldn't find anything about it. Do you know any python library to generate desired b-Value Diffusion-weighted from existing DWI with different b values?
6 replies
Eleftherios Garyfallidis
@Garyfallidis
So @mertyergin , you want to predict the image at b 1400?
Do you have a specific paper in mind @mertyergin /
6 replies
AlexBadea
@portokalh
being spoiled with too many options, can somebody please recommend their favorite efficient whole brain tractography method/function, hopefully using multi cpu/multithreading? thank you!
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?
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?