nipy / nibabel

Python package to access a cacophony of neuro-imaging file formats
http://nipy.org/nibabel/
Other
634 stars 258 forks source link

Update data_per_streamline capabilities #1291

Closed skoudoro closed 3 months ago

skoudoro commented 5 months ago

The goal of this PR is to allow inhomogeneous array for data_per_streamlines in a Tractogram.

I encounter this case when I wanted to save the labels of a cluster using Quickbundles from DIPY.

All saved centroids have a different number of streamlines, which make the array inhomogeneous.

data_per_streamline = {}
data_per_streamline['clusters_labels'] = np.array([c.indices
                                                   for c in clusters],
                                                  dtype=object)
data_per_streamline['clusters_sizes'] = clusters.clusters_sizes()

See the following tutorial: https://docs.dipy.org/stable/examples_built/segmentation/segment_quickbundles.html

codecov[bot] commented 5 months ago

Codecov Report

Attention: Patch coverage is 84.61538% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 92.26%. Comparing base (0e925ab) to head (c907b45).

Files Patch % Lines
nibabel/streamlines/tractogram.py 84.61% 1 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1291 +/- ## ========================================== - Coverage 92.27% 92.26% -0.01% ========================================== Files 99 99 Lines 12460 12470 +10 Branches 2561 2565 +4 ========================================== + Hits 11497 11505 +8 - Misses 641 642 +1 - Partials 322 323 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

effigies commented 4 months ago

Hi Serge, thanks, and apologies for the slow response. I'm going to look into what's going on with the pre-release tests.

skoudoro commented 4 months ago

Hi @effigies,

Thank you for the review. no worries.

I will come back on this next week. What is the ETA of the next nibabel release?

effigies commented 4 months ago

ETA April. Might aim for late March or early May, as April will be busy for me.