question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Index out of bound during Tractometry

See original GitHub issue

I am getting an error when running tractometry that reads: UserWarning: Thedipy.stats module is still under heavy development and functionality, as well as the API is likely to change in future versions of the software warnings.warn(w_string) 0%| | 0/50 [00:00<?, ?it/s] Traceback (most recent call last): File "/usr/local/bin/Tractometry", line 138, in <module> main() File "/usr/local/bin/Tractometry", line 109, in main predicted_peaks=predicted_peaks, affine=scalar_image.affine) File "/usr/local/lib/python3.5/dist-packages/tractseg/libs/tractometry.py", line 64, in evaluate_along_streamlines streamlines = _orient_to_same_start_region(streamlines, beginnings) File "/usr/local/lib/python3.5/dist-packages/tractseg/libs/tractometry.py", line 42, in _orient_to_same_start_region if beginnings[int(startpoint[0]), int(startpoint[1]), int(startpoint[2])] == 0: IndexError: index 178 is out of bounds for axis 1 with size 174

Steps taken to replicate on TractSeg 2.1.1: 0) Preprocessed dwi (Diffusion.nii.gz, single shell acquisition, has undergone denoising, eddy, and N4 bias correction), along with the b0 mask (nodif_brain_mask.nii.gz) and FA map (FA.nii.gz) are copied to the working directory.

  1. Create peaks from preprocessed data (not rigidly aligned to MNI, but in the same orientation) TractSeg -i Diffusion.nii.gz -o tractseg_output --raw_diffusion_input --brain_mask nodif_brain_mask.nii.gz --output_type tract_segmentation

  2. Remove the recently created bundle segmentations because I have to flip the peaks over X axis (discovered this primarily through trial-and-error). Is there a wrapper function in TractSeg just to produce the MrTrix peaks so I can avoid creating the bundles twice? rm -r tractseg_output/bundle_segmentations

  3. Flip peaks and recreate bundle segmentations flip_peaks -i tractseg_output/peaks.nii.gz -o tractseg_output/peaks_flip_x.nii.gz -a x TractSeg -i tractseg_output/peaks_flip_x.nii.gz -o tractseg_output --output_type tract_segmentation The peaks and bundle segmentations look correct after this step (can provide images if needed)

  4. Create Ending Segmentation, TOM, and TOM trackings TractSeg -i tractseg_output/peaks_flip_x.nii.gz -o tractseg_output --output_type endings_segmentation TractSeg -i tractseg_output/peaks_flip_x.nii.gz -o tractseg_output --output_type TOM Tracking -i tractseg_output/peaks_flip_x.nii.gz -o tractseg_output --tracking_format trk (should I specify --nr_fibers here?)

There are no errors up until this point, and the .trk fibers look great!

  1. Attempt tractometry Tractometry -i TOM_trackings/ -o FA.csv -e endings_segmentations/ -s FA.nii.gz

This is where the error occurs. If it’s of any help, I am using the Brainlife singularity container . Please let me know if anymore information would be helpful.

Thanks, Steven

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
smeislercommented, Jul 8, 2020

Looking through the documentation of Tractometry, I did not know that there was a --tracking_format argument for that as well. I changed it to trk to match the format of Tracking, and now it seems to work.

0reactions
smeislercommented, Jul 8, 2020

The following outputs from the fslhd command show the sform and qform affine matrices. While the offset did not seem to be in those matrices, there was an image_offset output which was constantly 352.

FA.nii.gz

image OFFSET: 352

peaks_flip_x.nii.gz

image OFFSET: 352

bundle_segmentations/CST_right.nii.gz

image OFFSET: 352

endings_segmentations/CST_right_b.nii.gz

image OFFSET: 352

TOM/CST_right.nii.gz

image OFFSET: 352

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix the Array Index Out Of Bounds Excepiton in Java
The ArrayIndexOutOfBoundsException in Java is a runtime exception that occurs when an array is accessed with an illegal index.
Read more >
Array Index Out Of Bounds Exception in Java - GeeksforGeeks
The index of an array is an integer value that has value in the interval [0, n-1], where n is the size of...
Read more >
Array Index Out Of Bounds Exception - java - Stack Overflow
Each item in an array is called an element, and each element is accessed by its numerical index. As shown in the preceding...
Read more >
indexerror: index 60 is out of bounds for axis 0 with size 60
Here comes the problem, as your array is always going to be of a given size, determined by taille , let's say taille...
Read more >
Detecting microstructural deviations in individuals with deep ...
To this end, Detect was developed to advance diffusion magnetic resonance imaging tractometry towards single-patient analysis.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found