Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 09:34
    dulietina commented #2314
  • 04:03
    arokem commented #2405
  • Jun 14 11:22
    codecov[bot] commented #2405
  • Jun 14 09:37
    RafaelNH commented #2405
  • Jun 14 09:22
    codecov[bot] commented #2405
  • Jun 14 09:22
    codecov[bot] commented #2405
  • Jun 14 09:22
    RafaelNH synchronize #2405
  • Jun 13 18:39
    arokem commented #2407
  • Jun 13 08:12
    codecov[bot] commented #2407
  • Jun 13 06:08
    skoudoro labeled #2407
  • Jun 13 06:08
    skoudoro opened #2407
  • Jun 13 06:08
    skoudoro milestoned #2407
  • Jun 12 02:05
    skoudoro review_requested #2406
  • Jun 12 02:05
    skoudoro labeled #2392
  • Jun 12 02:05
    skoudoro milestoned #2392
  • Jun 12 02:05

    skoudoro on master

    Update gradients.py Decompose … Update gradients.py Add test for shear in reorient_… and 3 more (compare)

  • Jun 12 02:05
    skoudoro closed #2392
  • Jun 12 02:05
    skoudoro commented #2392
  • Jun 11 21:37
    codecov[bot] commented #2392
  • Jun 11 19:34
    skoudoro commented #718
Chandana Kodiweera
@kodiweera
pathos can be used to multiprocess any model function ( class or not), not just msmt-csd.
Eleftherios Garyfallidis
@Garyfallidis
Nice one @kodiweera
Chandana Kodiweera
@kodiweera
Given the mask, what's the best tool to extract the region covered by the mask?
Ariel Rokem
@arokem
@kodiweera : if mask is a binary 3d array (True/False for within/outside the region of interest) and data is a 4D array containing diffusion data, then data[np.where(mask)] should be a 2D array with each row being a voxel and each column being a direction of measurement.
Chandana Kodiweera
@kodiweera

@kodiweera : if mask is a binary 3d array (True/False for within/outside the region of interest) and data is a 4D array containing diffusion data, then data[np.where(mask)] should be a 2D array with each row being a voxel and each column being a direction of measurement.

@arokem Thanks. Also for 3D : fslmaths <input> -mas <mask> <ouput>

cjwbeyond
@cjwbeyond
hello, why the performance is lower in linux os than mac os ?
any ideas to avoid the performance issue ?
Shreyas Fadnavis
@ShreyasFadnavis
Hi @cjwbeyond ! Can you explain a little more? Which algorithm/ step is slower on Linux as compared to MacOS?
rosella1234
@rosella1234
Hi. I would like to know whether dipy has RESTORE method also for Diffusion Kurtosis fitting, since I can find it only for DTI in the example documentation. thanks
Serge Koudoro
@skoudoro

Hello @/all ,

Dr. Leevi Kerkelä (UCL) will discuss today (Thursday 15 April at 1pm EST / 7pm CET / 10am PT) his project on integrating Q-Space Trajectory Imaging in DIPY.

The zoom link for the open meeting is https://iu.zoom.us/j/84926066336.

We hope to see you online!

Cheers !

Chandana Kodiweera
@kodiweera
Hi All, are you aware of a software that can do automated DWI QC? We are looking for something to bypass visual inspection as it's a very large dataset. Thank you!
Conor Owens-Walton
@ConorOW

Hi DIPY team. Wanted to ask about a memory error I am getting when running dipy_track on a linux server.

File "~/cowenswalton/conda-envs/envs/buan_env/lib/python3.8/site-packages/dipy/tracking/utils.py", line 881, in transform_tracking_output yield np.dot(sl, lin_T) + offset MemoryError
Super grateful for any advice, or where i can find some.

Conor Owens-Walton
@ConorOW
OK I am trying to run dipy_track again on our grid but requesting a bit more memory. Hopefully this works out.
Ariel Rokem
@arokem
@ShreyasFadnavis : what do you think about running patch2self on data that has already been denoised using another method (mp-pca in this case)?
Shreyas Fadnavis
@ShreyasFadnavis
@arokem That is a great question! It is definitely possible and should work. MPPCA for instance is doing a local low-rank approximation which does not change the assumption that Patch2Self relies on. In fact, P2S can also be applied to data that has undergone other types of pre-processing such as Eddy, Motion, Susceptibility, etc. As long as the pre-processing step applied does not start adding correlation artefacts across volumes, Patch2Self can be applied after!
Also from a denoising standpoint, Patch2Self (standalone) should do as good as Patch2Self + MPPCA. Any noise that persists due to MPPCA will anyways be suppressed by P2S.
Ariel Rokem
@arokem
Thanks @ShreyasFadnavis!
Gemmavdv
@Gemmavdv
Hello all,
Does anyone have experience tracking using DSI reconstructed data? I have a dataset of 145x174x145, so I can't fit all the data since that uses too much RAM. I tried using a memmap, but this still needs too much memory (134 GB).
I can construct the model and fit the data to the model using nindex and saving to a memmap, but using that memmap in e.g. the ClosestPeakDirectionGetter causes a memory error. Does anyone know a solution to this? Thank you very much in advance!
rosella1234
@rosella1234
Hi all,
I have a theoretical question about DKI minimum number of independent directions. Indeed, we are acquiring neonatal SC diffusion images at hospital but we are limited by acquisition time constraints: the clinical protocol is already quite long and we have to put the spine DKI sequence at the end since it is for research. We set up a protocol made up of 6b=0; 13 b=700; 13 b=2100 b values for a duration of 4 min 30 s thanks to multi band technique. I know it is low as a protocol for DKI but I tried increasing directions to 15 (minimum theoretically required for DKT estimation) and it lasts 1 minute more , and it often happens the neonate wakes up from the slight sedation just during the end of that sequence, so the clinicians opted for the 13-direction sequence.
Now, I am here to ask you a suggestion about which choice to take. I have read about protocol using just 9 directions per b-value for fast DKI protocol. If I use 13 directions, would DKI measures I compute in dipy be still reliable ? Or should I use another estimation method in case of so low directions ?
thank you very much in advance
Matt Cieslak
@mattcieslak
Hi @Gemmavdv I've been using DSI for a long time, have you tried DSI Studio?
Ariel Rokem
@arokem
@rosella1234 : theoretically, I believe that this should be enough to estimate DKI. I would recommend using the msdki method, which should be generally more robust to low SNR situations https://dipy.org/documentation/1.0.0./examples_built/reconst_msdki/
Eleftherios Garyfallidis
@Garyfallidis
@Gemmavdv something is unexpected. There should be no issues in tracking with DSI data. But can you explain more what you do here? Also the shape of the data is 3D but your data should be 4D.
rosella1234
@rosella1234
@arokem thank you! so do you suggest extracting just MSDKI as a DKI metric, and not the standard ones (MK;AK;RK;KFA..)?
Gemmavdv
@Gemmavdv
Thank you @mattcieslak and @Garyfallidis . I solved the problem, I didn't actually need to use memmaps. Sorry to waste your time!
Serge Koudoro
@skoudoro

Hello @/all ,

Quick reminder for the meeting today at 1pm EST / 7pm CET / 10am PT!

@gabknight will talk about the new Tractography competition.
We will have a brief talk about our Tracking framework
@skoudoro will make a quick overview of the future Release. Let us know if there is any request.
Cheers!

ps: same link as usual: https://iu.zoom.us/j/84926066336

Steven Meisler
@smeisler
I am trying to run Recobundles on an MrTrix tractogram (.tck) using only command line tools. I am able to use SLR to get it to MNI space as a .trk. Then I segment that into bundles (recobundles), but when I try to move it back to native space (labelbundles) I get an error since my original tck file does not have a proper header like a trk file. Is there a way to include a reference image in the labelbundles command line function? If so, should I use the diffusion image, t1 image, or something else? Thanks.
Bramsh Q Chandio
@BramshQamar

Hi @smeisler
Currently, dipy_labelsbundles does not take reference files as input. However, you can write a simple python script to bring bundles into the native space. Here's the bundle segmentation tutorial https://dipy.org/documentation/1.4.0./examples_built/bundle_extraction/#example-bundle-extraction
at the end of this tutorial after extracting the bundle, we are saving the bundle in the native space. Something like this:

 `reco_af_l = StatefulTractogram(target[af_l_labels], target_header,
                           Space.RASMM)     `
 `save_trk(reco_af_l, "AF_L.trk", bbox_valid_check=False)     `

You can use the labels.npy file saved by RecoBundles command line.

Steven Meisler
@smeisler
@BramshQamar got it, thanks! Ended up using a nibabel implementation https://github.com/nipy/nibabel/blob/master/nibabel/cmdline/tck2trk.py
rosella1234
@rosella1234

When trying to apply cross-validation for dki model on 7T adult HCP data the following error arises:

(```
base) synapsi@charlie:/media/synapsi/dkeTest/new_version/code$ python goodness_of_fit.py
/home/synapsi/anaconda3/lib/python3.8/site-packages/dipy/core/gradients.py:295: UserWarning: b0_threshold (value: 50) is too low, increase your b0_threshold. It should be higher than the lowest b0 value (55.0).
warn("b0_threshold (value: {0}) is too low, increase your \
Data & Mask Loaded!
Traceback (most recent call last):
File "goodness_of_fit.py", line 21, in <module>
dki_cc = xval.kfold_xval(dki_model, cc_vox, 2)
File "/home/synapsi/anaconda3/lib/python3.8/site-packages/dipy/reconst/cross_validation.py", line 107, in kfold_xval
raise ValueError(msg)
ValueError: np.mod(143, 2) is 1

rosella1234
@rosella1234
Hi all, is there a way to visualize Diffusion Kurtosis Tensor 3D geometry in a single voxel in dipy? thank you
amwink
@amwink
Hi, I sent this question as a mail but it bounced. Does anyone know how to do this? Thanks!

I'm computing affine transforms for co-registering anatomical MRI scans.

Sometimes I would like to re-use those transforms, so in a case similar to the example here
https://dipy.org/documentation/1.2.0./examples_built/affine_registration_3d/#example-affine-registration-3d

my final transform is the result of this command:
rigid = affreg.optimize ( static, moving, transform, params0,
static_affine, moving_affine,
starting_affine = translation.affine );
final = rigid;
after first having aligned the centres of gravity.

After this command I can call
resampled = final.transform ( moving );
and then I get the desired result.

What I don't understand is how to store the transform and re-use it later.
I have tried to just save the object 'final' with
np.savez ( 'transformation.npz', final );
and then load it later with
with np.load ( 'transformation.npz', allow_pickle = True ) as npzfile:
final = npzfile [ 'arr_0' ];
and then re-run
resampled = final.transform ( moving );
but that returns the following error:
resampled = final.transform ( moving );
AttributeError: 'numpy.ndarray' object has no attribute 'transform'

So what I understand from this is that the output 'rigid' from the affreg.optimize() command has an attribute
'transform', but when I save it and then load it again it does not any more.

Is there a(nother) way to save and (re)load transforms?

HusBunia
@HusBunia

Hi, all. I have some problems when fit the free water components. Does anyone know how to fix this? Thanks a lot!

I having using the fwdtimodel and fwdtifit to map the free water compartment.

The test data is download from HCP, with 288 directions and 2 b-values:
The code is as follows:
fwdtimodel = fwdti.FreeWaterTensorModel(gtab)
fwdtifit = fwdtimodel.fit(data, mask=mask)
fwvolume = fwdtifit.f

But there are some warning information:
/usr/local/lib64/python3.6/site-packages/scipy/optimize/minpack.py:475: RuntimeWarning: Number of calls to function has reached maxfev = 1800.
warnings.warn(errors[info][0], RuntimeWarning)
/usr/local/lib64/python3.6/site-packages/dipy/reconst/fwdti.py:311: RuntimeWarning: overflow encountered in exp
SIpred = (1-FS)np.exp(np.dot(W, all_new_params)) + FSS0*SFW.T

/usr/local/lib64/python3.6/site-packages/dipy/reconst/fwdti.py:312: RuntimeWarning: overflow encountered in square
F2 = np.sum(np.square(SI - SIpred), axis=0)

/usr/local/lib64/python3.6/site-packages/dipy/reconst/fwdti.py:458: RuntimeWarning: overflow encountered in exp
y = (1-f) * np.exp(np.dot(design_matrix, tensor[:7])) + \

I wonder whether these warnings have influenced the output images and anyway to fix them?

Many thanks for your help!

David Romero-Bascones
@drombas
Hi @amwink

To save/load the transformation object you can try using pickle instead of numpy:
import pickle
filehandler = open('transform.obj', 'wb')
pickle.dump(final, filehandler)

filehandler = open('transform.obj', 'rb')
final = pickle.load(filehandler)

amwink
@amwink

Hi @drombas, thanks very much! pickle does the trick :)

I thought that np.save with "allow pickle" would work, assuming that it would do the same as pickle (it doesn't) or that using JSON would be possible -- unfortunately it isn't (I tried to do the nested serialisation but failed). The reason for that is that many people have reservations about pickle.

For me it does the job perfectly.

Serge Koudoro
@skoudoro
Also, @amwink, you can look at the functions write_mapping and read_mapping in https://github.com/dipy/dipy/blob/master/dipy/align/_public.py#L218
from dipy.align import write_mapping, read_mapping we use the nifti format to save this
amwink
@amwink
Thanks @skoudoro ! I guess you can save the results of a rigid or affine registration as a mapping (though it would be a bit of overkill to store them in 3 3D images when 6 or 16 floats would do :). The versions of read_mapping and write_mapping for rigid and affine transforms would just need to store 3 translations + 3 rotations or a homogeneous coordinate transformation, respectively?
willi3by
@willi3by
Hi, is DBSI fitting available in dipy? and, if not, are there any plans to include it? Thanks!
Troudi-Abir
@Troudi-Abir
Dear all, I want to calculate the volume of a fiber bundle in each hemisphere apart, is it possible to do that in DIPY? If yes how can I do it ?
I will appreciate any help, and any ideas.
Thank you very much.
Priscilla Galinié
@priscilla-galinie
Hello everyone! I am currently trying to use dipy to process DTI data, I would like to do fiber tracking. Because it is DTI data and not HARDI data, I want to use the FACT method. I read in previous messages that I can use LocalTracking(..., fixedstep = False) and then provide the DTI directions as a direction getter. And there is my issue... I tried using tenfit.directions or even tenfit.evecs but it doesn't work. Maybe it is simple but I have been looking for a while and I don't find a solution.
I would really appreciate your help, thank you in advance for your time.
David Romero-Bascones
@drombas
Hi @Troudi-Abir ,
As a simple approach, assuming you have already reconstructed the streamlines, you could try:
  • Use density_map to build a density map of each bundle in voxel space
  • Binarize the density map to obtain a bundle mask (set to 1 all voxels !=0)
  • Compute the bundle volume as the product between the number of voxels in the mask and the volume of a single voxel
Troudi-Abir
@Troudi-Abir
hello @drombas thank you very much for your help.
Troudi-Abir
@Troudi-Abir
I want to know how to calculate the volume in each hemisphere, in other words,
how I can divide the brain to calculate the volume of the bundle in each hemidphere apart?
Troudi-Abir
@Troudi-Abir
Hello again, please could you privide me with an exemple to calculate mean_curvature with DIPY? I will appreciate your help. Thank you
Yun Wang
@wangyuncolumbia
Hi All, I wonder if the slides in the workshop are available ?
Serge Koudoro
@skoudoro
Hi @wangyuncolumbia, no they are not available but you can always ask directly the speaker by sending an email
Hi @Troudi-Abir, I recommend you to look at the documentation concerning the mean_curvature, it should be straight forward: https://dipy.org/documentation/1.4.0./reference/dipy.tracking/#mean-curvature
Troudi-Abir
@Troudi-Abir
Dear @skoudoro thank you very much for the information, It's well appreciated.