Apply TractSeg to the study specific population template using the peaks of the spherical harmonic function at each voxel as input
Hi, I want to apply TractSeg to the study specific population template using the peaks of the spherical harmonic function at each voxel as input. I have peaks.nii.gz after running this command: sh2peaks wmfod_template_MNI.mif peaks.nii.gz But, when I try to run the following command, I get the following error:
TractSeg -i peaks.nii.gz -o template/tract_segmentation/ --output_type tract_segmentation
Error: Loading weights from: /home/gha/.tractseg/pretrained_weights_tract_segmentation_v3.npz Downloading pretrained weights (~140MB) ... Traceback (most recent call last): File "/home/gha/miniconda3/lib/python3.9/site-packages/urllib3/connection.py", line 174, in _new_conn conn = connection.create_connection( File "/home/gha/miniconda3/lib/python3.9/site-packages/urllib3/util/connection.py", line 95, in create_connection raise err . . . . . raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='zenodo.org', port=443): Max retries exceeded with url: /record/3518348/files/best_weights_ep220.npz?download=1 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f7750f9c8b0>: Failed to establish a new connection: [Errno 111] Connection refused'))
Thanks in advance for your help
The code is having problems downloading the model weights from zenodo. Sometimes zenodo is having download issues. I would suggest to try it again another time and/or from another internet network.
Thanks a lot! I fixed the problem. The following commands runned correctly: TractSeg -i peaks.nii.gz -o template/tract_segmentation/ --output_type tract_segmentation TractSeg -i peaks.nii.gz -o template/endings_segmentation/ --output_type endings_segmentation
But, when I try to run "TractSeg -i peaks.nii.gz -o template/TOM/ --output_type TOM" , There is no file in TOM folder and I get the following error:
Error:
Loading weights from: /home/gha/.tractseg/pretrained_weights_peak_regression_part1_v2.npz 100%|█████████████████████████████████████████| 144/144 [00:22<00:00, 6.44it/s] joblib.externals.loky.process_executor._RemoteTraceback: """ Traceback (most recent call last): File "/home/gha/miniconda3/lib/python3.9/site-packages/nibabel/loadsave.py", line 42, in load stat_result = os.stat(filename) FileNotFoundError: [Errno 2] No such file or directory: 'template/TOM/bundle_segmentations/AF_left.nii.gz'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/gha/miniconda3/lib/python3.9/site-packages/joblib/externals/loky/process_executor.py", line 428, in _process_worker r = call_item() File "/home/gha/miniconda3/lib/python3.9/site-packages/joblib/externals/loky/process_executor.py", line 275, in call return self.fn(*self.args, **self.kwargs) . . . . FileNotFoundError: No such file or no access: 'template/TOM/bundle_segmentations/AF_left.nii.gz'
Is this the complete error message? There seems to be missing something.
This is the complete error message:
TractSeg -i peaks.nii.gz -o template/TOM/ --output_type TOM
Loading weights from: /home/gha/.tractseg/pretrained_weights_peak_regression_part1_v2.npz Downloading pretrained weights (~140MB) ... downloaded in 913.93s 100%|████████████████████████████████████████| 144/144 [00:23<00:00, 6.24it/s] joblib.externals.loky.process_executor._RemoteTraceback: """ Traceback (most recent call last): File "/home/gha/miniconda3/lib/python3.9/site-packages/nibabel/loadsave.py", line 42, in load stat_result = os.stat(filename) FileNotFoundError: [Errno 2] No such file or directory: 'template/TOM/bundle_segmentations/AF_left.nii.gz'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/gha/miniconda3/lib/python3.9/site-packages/joblib/externals/loky/process_executor.py", line 428, in _process_worker
r = call_item()
File "/home/gha/miniconda3/lib/python3.9/site-packages/joblib/externals/loky/process_executor.py", line 275, in call
return self.fn(*self.args, **self.kwargs)
File "/home/gha/miniconda3/lib/python3.9/site-packages/joblib/_parallel_backends.py", line 620, in call
return self.func(*args, **kwargs)
File "/home/gha/miniconda3/lib/python3.9/site-packages/joblib/parallel.py", line 288, in call
return [func(*args, **kwargs)
File "/home/gha/miniconda3/lib/python3.9/site-packages/joblib/parallel.py", line 288, in
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/gha/miniconda3/bin/TractSeg", line 420, in
For the previous commands (output type tract_segmentation and endings_segmentations) you have to specify the same output folder. And for output_type TOM as well. The correct subfolders are automatically generated. Just do it the same way as it is stated in the documentation.
Problem solved. Thank you very much for your help.
Hi,
I met the same problem as yours, could you please tell me how did you solve the Failed to establish a new connection: [Errno 111] Connection refused'))? Just changed the internet network?
Hi, Yes, we just changed the internet network.
Thanks! I solved the problem. I also try to apply TractSeg to the study specific population template. I've done whole brain fixel-based analysis according to the MRtrix3 document. And I got some significant FC, FD, FDC fixels between 3 of my groups. Now I would like to label those tracts which have significant fixels. I followed this scripts https://osf.io/9ch6a, ran the following commands
sh2peaks wmfod_template_MNI.mif peaks.nii.gz TractSeg -i peaks.nii.gz -o tractseg/ --output_type tract_segmentation TractSeg -i peaks.nii.gz -o tractseg/ --output_type endings_segmentation TractSeg -i peaks.nii.gz -o tractseg/ --output_type TOM Tracking -i peaks.nii.gz -o tractseg/ --tracking_format tck --nr_fibers 10000
The given scripts is an Tract-of-interest analysis, I"d to do whole brain analysis, and I want to know what's the next step according to my goal?
Seems you are also doing the FBA, I would appreciate it if you could give me some guidance.
Yuting