MIC-DKFZ / TractSeg

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

Questions about Tractseg #30

Closed AntoineBouyeure closed 5 years ago

AntoineBouyeure commented 5 years ago

Thanks a lot for this tool, it's just great! I have a few dumb questions.

  1. I already did CSD estimation on my data with mrtrix's dwi2fod command. So I guess I need to convert the ODF images into peaks images with mrtrix's sh2peaks command?

I tried to generate the CSD peaks with TractSeg, but doing so gave the following error:

TractSeg -i diffusion.nii --bvals diffusion_bvals --bvecs diffusion_bvecs --raw_diffusion_input 
--preprocess --output_type tract_segmentation --csd_type csd

Creating brain mask...
Moving input to MNI space...
Creating brain mask...
Creating peaks (1 of 3)...

Traceback (most recent call last):
  File "/usr/local/bin/dwi2response", line 102, in <module>
    if int(image.statistic('mask.mif', 'count', '-mask mask.mif')) == 0:
ValueError: invalid literal for int() with base 10: '327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n327328 \n3

Creating peaks (2 of 3)...
dwi2fod: [ERROR] no data in matrix file "tractseg_output/response.txt"
dwi2fod: [ERROR] CSD algorithm expects second argument to be the input response function file

Creating peaks (3 of 3)...
sh2peaks: [ERROR] failed to open key/value file "tractseg_output/WM_FODs.mif": No such file or directory
sh2peaks: [ERROR] error opening image "tractseg_output/WM_FODs.mif"
Traceback (most recent call last):
  File "//anaconda/lib/python3.6/site-packages/nibabel/loadsave.py", line 40, in load
    stat_result = os.stat(filename)
FileNotFoundError: [Errno 2] No such file or directory: 'tractseg_output/peaks.nii.gz'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "//anaconda/bin/TractSeg", line 303, in <module>
    main()
  File "//anaconda/bin/TractSeg", line 201, in main
    data_img = nib.load(peak_path)
  File "//anaconda/lib/python3.6/site-packages/nibabel/loadsave.py", line 42, in load
    raise FileNotFoundError("No such file or no access: '%s'" % filename)
FileNotFoundError: No such file or no access: 'tractseg_output/peaks.nii.gz'

So it seems to be caused by a mask generation error from mrtrix? As I already encountered issues on my data when using dwi2mask, I am now using masks computed with fsl bet.

  1. Are the two bits of code below performing the same thing, i.e. probabilistic tracking on TOM, or is there a difference?
TractSeg -i peaks.nii.gz --output_type TOM 
Tracking -i peaks.nii.gz

and

TractSeg -i peaks.nii.gz --output_type TOM --track --only_track

  1. Just to make sure: if i use the preprocess option, then I don't need to align my images with the MNI space before using TractSeg?

Thanks a lot.

wasserth commented 5 years ago

1: Yes you have to use sh2peaks in this case. Regarding the mrtrix error: What version of Mrtrix do you have? Do you have Mrtrix 3.0 RC3? If you have an older version that might be the reason for the error.

2: TractSeg -i peaks.nii.gz --output_type TOM --track --only_track is the old API. I forgot to remove that from the Readme. You should use

TractSeg -i peaks.nii.gz --output_type TOM 
Tracking -i peaks.nii.gz

3: Yes. TractSeg will automatically do rigid registration of your input image to MNI space. Please note: The TractSeg output will NOT be transformed back to subject space automatically.

AntoineBouyeure commented 5 years ago

Thanks. I fed TractSeg with the already computed peaks and it works fine. I have the latest Mrtrix version. I might post a message about this on the Mrtrix github as I often encounter issues with dwi2mask (e.g., the mask has holes)