IdentityFeature
instead of VectorOfEndpointsFeature()
and then I will remove shape1[0] == 1
on your function are_compatible
. You do not need vector in your case for MAM. Let me know if it works, otherwise create an issue on DIPY, it will be easier to help you
to_xxxx
methods after loading, but without success. They shift the tracks, but not into the space my ROI coordinates are in.I would be grateful for your thoughts on what could be wrong when feeding labels in utils.connectivity.matrix: M, grouping = utils.connectivitymatrix(streamlines, labels.astype(int), affine_labels,
return_mapping=False,
mapping_as_streamlines=False)
File "/Users/alex/py3/lib/python3.7/site-packages/dipy/tracking/utils.py", line 157, in connectivity_matrix
raise ValueError("label_volume must be a 3d integer array with labelvolume must be a 3d integer array withnon-negative label values
labels.shape= (200, 400, 200) when labels.max() = 332 and labels.min() = 0. Thanks much!
affine_labels
and labels
in your function arguments. To make sure that is correct, be explicit on your function: utils.connectivitymatrix(streamlines, label_volume=labels.astype(int), affine=affine_labels,
return_mapping=False,
mapping_as_streamlines=False)
@robertl1996
Does anybody know where the source code for this denoise library can be found: https://dipy.org/documentation/1.0.0./reference/dipy.denoise/. Particularly the nl means filters
The source code is found here: https://github.com/nipy/dipy/blob/master/dipy/denoise/
@zlf123-marker
I have a look, but I want to display my TRK file and t1 data, I don't know what to change?Can you help me @arokem
DIPY examples/tutorials use data that is fetched directly from a few sites that host the data of interest. If you want to adapt the examples to use your own data, then, instead of using the fetch_*
and read_ *
commands, you will need to read your local files.
In order to read your t1, you will need to use NiBabel as in
https://nipy.org/nibabel/nibabel_images.html
something like
import nibabel as nib
t1_img = nib.load(your_t1_filename)
t1 = t1_img.get_data()
fig = plt.figure()
plt.imshow(t1, cmap="gray")
Similarly, to show your TRK file, you can do something similar to this
from dipy.io.streamline import load_tractogram
from fury import window, actor
tractogram = load_tractogram(your_trk_filename, your_t1_filename)
streamlines = tractogram.streamlines
renderer = window.Renderer()
stream_actor = actor.line(streamlines)
renderer.add(stream_actor)
window.record(renderer)
If you want to display your streamlines and your T1 at the same time, you will need to add both actors to the same scene, adding to the above something like
t1_actor = actor.slicer(t1)
renderer.add(t1_actor)