MIC-DKFZ / TractSeg

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

Tracking issues mac os 13.1 #224

Open LucSam opened 1 year ago

LucSam commented 1 year ago

Hi, we receive the following error messages (see below) on two different mac book pro's (mac os 13.1) with different python installs (we also tested the same data on our ubuntu system where it works without errors). The "TractSeg" commands to segment the bundles, TOMs, etc. work fine. I think I posted a similar issue before. Also, I noticed that when using "--algorithm det", it works. Any idea how to solve the problem?

Tracking -i peaks.nii.gz -o tractseg_output 0%| | 0/72 [00:02<?, ?it/s] multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "/usr/local/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, *kwds)) File "/usr/local/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/pool.py", line 48, in mapstar return list(map(args)) File "/usr/local/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 "/usr/local/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 "/usr/local/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 "/usr/local/bin/Tracking", line 168, in main() File "/usr/local/bin/Tracking", line 158, in main tracking.track(bundle, input_path, Config.PREDICT_IMG_OUTPUT, File "/usr/local/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 "/usr/local/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 "/usr/local/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/pool.py", line 367, in map return self._map_async(func, iterable, mapstar, chunksize).get() File "/usr/local/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/pool.py", line 774, in get raise self._value TypeError: 'NoneType' object is not subscriptable

and on the other machine:

multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, *kwds)) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/pool.py", line 48, in mapstar return list(map(args)) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/tractseg/libs/tractseg_prob_tracking.py", line 156, in process_seedpoint streamline_part1, length_1 = process_one_way(peaks, streamline1, max_nr_steps, step_size, probabilistic, File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/tractseg/libs/tractseg_prob_tracking.py", line 51, in process_one_way dir_raw = get_at_idx(peaks, (last_point[0], last_point[1], last_point[2])) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/tractseg/libs/tractseg_prob_tracking.py", line 42, 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 "/Library/Frameworks/Python.framework/Versions/3.8/bin/Tracking", line 169, in main() File "/Library/Frameworks/Python.framework/Versions/3.8/bin/Tracking", line 159, in main tracking.track(bundle, input_path, Config.PREDICT_IMG_OUTPUT, File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/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 "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/tractseg/libs/tractseg_prob_tracking.py", line 247, in track streamlines_tmp = pool.map(partial(process_seedpoint, next_step_displacement_std=next_step_displacement_std, File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/pool.py", line 364, in map return self._map_async(func, iterable, mapstar, chunksize).get() File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/pool.py", line 771, in get raise self._value TypeError: 'NoneType' object is not subscriptable

wasserth commented 1 year ago

Thanks for posting this error. I will get a M1 Mac Book soon and then I hopefully can reproduce this error and try to solve it. Now I do not really have an idea what the problem might be.

LucSam commented 1 year ago

Thanks, fyi, 1 tested macbook was intel, the other was M1.

warddef commented 1 year ago

I had the same issue on a Mac on 12.6.1. the issue here is that that some default changed in the multiprocessing package in python, you can read more about the specifics here https://discuss.python.org/t/multiprocessing-spawn-default-on-macos-since-python-3-8-is-slower-than-fork-method/5910. This for some reason caused an error in the code. In my case I managed to solve the issue by installing Python 3.7 as follows https://stackoverflow.com/questions/62898911/how-to-downgrade-python-version-from-3-8-to-3-7-mac. then I did a clean reinstall of tractseg and the issue was solved. I hope this helps if you want a more specific explanation you can contact me using my email ward.deferm@student.kuleuven.be