MIC-DKFZ / TractSeg

Automatic White Matter Bundle Segmentation
Apache License 2.0
227 stars 76 forks source link

error message when tracking #231

Open LenaOestreich13 opened 1 year ago

LenaOestreich13 commented 1 year ago

Hi there,

I have been able to process my data according to the tutorial. The output files look good, but I get the following error when running tracking:

Tracking -i tractseg_output/peaks.nii.gz -o tractseg_output

0%| | 0/72 [00:05<?, ?it/s] multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "/Users/uqloestr/anaconda3/lib/python3.10/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, *kwds)) File "/Users/uqloestr/anaconda3/lib/python3.10/multiprocessing/pool.py", line 48, in mapstar return list(map(args)) File "/Users/uqloestr/anaconda3/lib/python3.10/site-packages/tractseg/libs/tractseg_prob_tracking.py", line 157, in process_seedpoint streamline_part1, length_1 = process_one_way(peaks, streamline1, max_nr_steps, step_size, probabilistic, File "/Users/uqloestr/anaconda3/lib/python3.10/site-packages/tractseg/libs/tractseg_prob_tracking.py", line 52, in process_one_way dir_raw = get_at_idx(peaks, (last_point[0], last_point[1], last_point[2])) File "/Users/uqloestr/anaconda3/lib/python3.10/site-packages/tractseg/libs/tractseg_prob_tracking.py", line 43, in get_at_idx return img[int(idx[0]), int(idx[1]), int(idx[2])] TypeError: 'NoneType' object is not subscriptable """

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/Users/uqloestr/anaconda3/bin/Tracking", line 168, in main() File "/Users/uqloestr/anaconda3/bin/Tracking", line 158, in main tracking.track(bundle, input_path, Config.PREDICT_IMG_OUTPUT, File "/Users/uqloestr/anaconda3/lib/python3.10/site-packages/tractseg/libs/tracking.py", line 220, in track streamlines = tractseg_prob_tracking.track(tom_peaks, max_nr_fibers=nr_fibers, smooth=5, File "/Users/uqloestr/anaconda3/lib/python3.10/site-packages/tractseg/libs/tractseg_prob_tracking.py", line 263, in track streamlines_tmp = pool.map(partial(process_seedpoint, next_step_displacement_std=next_step_displacement_std, File "/Users/uqloestr/anaconda3/lib/python3.10/multiprocessing/pool.py", line 367, in map return self._map_async(func, iterable, mapstar, chunksize).get() File "/Users/uqloestr/anaconda3/lib/python3.10/multiprocessing/pool.py", line 774, in get raise self._value TypeError: 'NoneType' object is not subscriptable

Any help would be hugely appreciated!

Thanks, Lena

wasserth commented 1 year ago

What are the commands you are using for processing your data?

LenaOestreich13 commented 1 year ago

Copied and pasted below. I tried it with and without flipping the peaks:

calc_FA -i ${subj}_dwi_b1000.nii.gz -o ${subj}_FA.nii.gz --bvals ${subj}_dwi_b1000.bval --bvecs ${subj}_dwi_b1000.bvec \ --brain_mask nodif_brain_mask.nii.gz

flirt -ref /Users/uqloestr/anaconda3/lib/python3.10/site-packages/tractseg/resources/MNI_FA_template.nii.gz -in ${subj}_FA.nii.gz -out ${subj}_FA_MNI.nii.gz -omat FA_2_MNI.mat -dof 6 -cost mutualinfo -searchcost mutualinfo

flirt -ref /Users/uqloestr/anaconda3/lib/python3.10/site-packages/tractseg/resources/MNI_FA_template.nii.gz -in ${subj}_dwi_b1000.nii.gz -out ${subj}_dwi_b1000_MNI.nii.gz -applyxfm -init FA_2_MNI.mat -dof 6 cp ${subj}_dwi_b1000.bval MNI.bvals rotate_bvecs -i ${subj}_dwi_b1000.bvec -t FA_2_MNI.mat -o MNI.bvecs

TractSeg -i ${subj}_dwi_b1000_MNI.nii.gz -o tractseg_output --raw_diffusion_input --preprocess

TractSeg -i tractseg_output/peaks.nii.gz -o tractseg_output --output_type endings_segmentation

TractSeg -i tractseg_output/peaks.nii.gz -o tractseg_output --output_type TOM

flip_peaks -i tractseg_output/peaks.nii.gz -o tractseg_output/peaks_flipped.nii.gz -a y

Tracking -i tractseg_output/peaks_flipped.nii.gz -o tractseg_output

wasserth commented 1 year ago

Can you try again without the --preprocess option (because you basically did that yourself with the flirt commands) and without the line flip_peaks -i tractseg_output/peaks.nii.gz -o tractseg_output/peaks_flipped.nii.gz -a y. Do the binary masks from the first TractSeg call already look good?

LenaOestreich13 commented 1 year ago

I just did but it's not working either. The binary maps look good to me. Here 2 examples of the left arcuate and CC1: AF_left

CC_1

I also managed to reconstruct white matter tracts using tckgen in MRtriX, so the endpoints seem to be fine, too.

I tried running it by installing Cython first with pip install https://github.com/MIC-DKFZ/TractSeg/archive/cython_tracking.zip but that made everything worse, so that I couldn't run any of the tractseg command with the options anympre.

I was also wondering if it's an access issue to anaconda scripts, so I reinstalled it with homebrew, but that also gave me an error when trying to run tracking:

Screenshot 2023-04-12 at 7 44 27 am

wasserth commented 1 year ago

If you send me the data for one subject where the error occurs I can try to reproduce the issue.

LenaOestreich13 commented 1 year ago

Thanks! Here is a link to the data for 1 pp. I included the raw data and the folders with the processed data, as far as I got: https://www.dropbox.com/scl/fo/5fjuprjtnkpj7gsv37kqo/h?dl=0&rlkey=ze4jtoqdkjraox746evde3mr7

From: Jakob Wasserthal @.> Reply to: MIC-DKFZ/TractSeg @.> Date: Friday, 14 April 2023 at 4:59 pm To: MIC-DKFZ/TractSeg @.> Cc: Lena Oestreich @.>, Author @.***> Subject: Re: [MIC-DKFZ/TractSeg] error message when tracking (Issue #231)

If you send me the data for one subject where the error occurs I can try to reproduce the issue.

— Reply to this email directly, view it on GitHubhttps://github.com/MIC-DKFZ/TractSeg/issues/231#issuecomment-1508020032, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMHPIYVI2ETT3WNVFZHLNQLXBDYVVANCNFSM6AAAAAAWX52DDQ. You are receiving this because you authored the thread.Message ID: @.***>

wasserth commented 1 year ago

Thanks for sending the data. If you run the following commands, it works for me.

TractSeg -i dwi_b1000_MNI.nii.gz -o tractseg_output --raw_diffusion_input
TractSeg -i tractseg_output/peaks.nii.gz -o tractseg_output --output_type endings_segmentation
TractSeg -i tractseg_output/peaks.nii.gz -o tractseg_output --output_type TOM
Tracking -i tractseg_output/peaks.nii.gz -o tractseg_output
LenaOestreich13 commented 1 year ago

Thanks, I just tried that but still get the same error when I run tracking:

@.***

Do you have any idea what it might cause this? Should I try reinstalling tractseg and all dependencies? Would that be anaconda3, pytorch, MRtriX3 and FSL or am I missing anything?

Thanks ,Lena

From: Jakob Wasserthal @.> Reply to: MIC-DKFZ/TractSeg @.> Date: Monday, 17 April 2023 at 10:55 pm To: MIC-DKFZ/TractSeg @.> Cc: Lena Oestreich @.>, Author @.***> Subject: Re: [MIC-DKFZ/TractSeg] error message when tracking (Issue #231)

Thanks for sending the data. If you run the following commands, it works for me.

TractSeg -i dwi_b1000_MNI.nii.gz -o tractseg_output --raw_diffusion_input

TractSeg -i tractseg_output/peaks.nii.gz -o tractseg_output --output_type endings_segmentation

TractSeg -i tractseg_output/peaks.nii.gz -o tractseg_output --output_type TOM

Tracking -i tractseg_output/peaks.nii.gz -o tractseg_output

— Reply to this email directly, view it on GitHubhttps://github.com/MIC-DKFZ/TractSeg/issues/231#issuecomment-1511285453, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMHPIYWW4T35XG5B4LFHLCDXBU4VDANCNFSM6AAAAAAWX52DDQ. You are receiving this because you authored the thread.Message ID: @.***>

wasserth commented 1 year ago

I would try again on a different computer

LenaOestreich13 commented 1 year ago

That worked. I ran it on a computer that had miniconda instead of anaconda, but I think the other software and versions were the same. It’s odd cause the one I ran it on previously is brand new and I only installed everything about 3 weeks ago, so should have the most up to date versions.

Anyway, I’ll try reinstalling and using miniconda instead.

Thanks for your help and sorry for essentially wasting your time.

Cheers, Lena

From: Jakob Wasserthal @.> Date: Tuesday, 18 April 2023 at 4:46 pm To: MIC-DKFZ/TractSeg @.> Cc: Lena Oestreich @.>, Author @.> Subject: Re: [MIC-DKFZ/TractSeg] error message when tracking (Issue #231)

I would try again on a different computer

— Reply to this email directly, view it on GitHubhttps://github.com/MIC-DKFZ/TractSeg/issues/231#issuecomment-1512529309, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMHPIYSKSCYQVGJXFDONQOTXBY2DJANCNFSM6AAAAAAWX52DDQ. You are receiving this because you authored the thread.Message ID: @.***>