skoudoro on master
added SDPdc functions to qti.py… almost ready for first review. … added links to cvxpy and Mosek and 24 more (compare)
Is there a project outline for dipy such as a module connections graph?
Such as these I created for fmriprep and qsiprep: https://github.com/nipreps/fmriprep/discussions/2517 and https://github.com/PennLINC/qsiprep/discussions/289
nodes
and therefore does not need a dataflow graph. However, I do know it is trivial to build these pipelines with DIPY and would like to know what exactly you need. Are you using vanilla DIPY to build pipelines?
@kodiweera ! That is a great question. The graph that you are mentioning typically comes from NiPype -- which I believe is how the nodes are connected for a dataflow style of computation. DIPY on the other hand is a package that provides tools for what happens inside those
nodes
and therefore does not need a dataflow graph. However, I do know it is trivial to build these pipelines with DIPY and would like to know what exactly you need. Are you using vanilla DIPY to build pipelines?
Not a nipype node grape. I was mentioning a modules connection graph. I alrady created them for fmri and qsiprep. they simply show the dependancy on the packages etc.
@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
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)
indx
has segment number/label per point
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!
Links at the bottom of page https://dipy.org/documentation/1.4.1./documentation/ ("index" and "search page") are broken! Thanks!
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?