MIC-DKFZ / TractSeg

Automatic White Matter Bundle Segmentation
Apache License 2.0
221 stars 72 forks source link

WM_FOD.nii.gz removed by TractSeg --output_type endings_segmentation #119

Closed cclairec closed 3 years ago

cclairec commented 3 years ago

Hello ! I am updating the issue (and therfore the title) : it seems that this is the following command line, which at the end, remove the WD_FODs.nii.gz file :

TractSeg -i ${PROCESSDIR}/${s}/tractseg_output/peaks.nii.gz \
        -o ${PROCESSDIR}/${s}/tractseg_output \
        --output_type  endings_segmentation 

The other intermediate files (provided by the previous command : TractSeg --csd_type csd_msmt --output_type tract_segmentation --keep_intermediate_files) are still there as I have the following before and during the ending-segmentations estimation :

drwxr-xr-x 3 ccury users      4096 Aug 18 15:56 ./
drwxr-xr-x 3 ccury users      4096 Aug 18 15:42 ../
-rw-r--r-- 1 ccury users   2572757 Aug 18 15:52 CSF_FODs.nii.gz
-rw-r--r-- 1 ccury users   2520671 Aug 18 15:52 GM_FODs.nii.gz
-rw-r--r-- 1 ccury users        50 Aug 18 15:44 RF_CSF.txt
-rw-r--r-- 1 ccury users        51 Aug 18 15:44 RF_GM.txt
-rw-r--r-- 1 ccury users       238 Aug 18 15:44 RF_WM.txt
-rw-r--r-- 1 ccury users 116843512 Aug 18 15:52 WM_FODs.nii.gz
drwxr-xr-x 2 ccury users      4096 Aug 18 15:56 bundle_segmentations/
-rw-r--r-- 1 ccury users  23468369 Aug 18 15:53 peaks.nii.gz

and this, right after the end of the ending-segmentations estimation :

drwxr-xr-x 5 ccury users     4096 Aug 18 16:05 ./
drwxr-xr-x 3 ccury users     4096 Aug 18 15:42 ../
-rw-r--r-- 1 ccury users  2572757 Aug 18 15:52 CSF_FODs.nii.gz
-rw-r--r-- 1 ccury users  2520671 Aug 18 15:52 GM_FODs.nii.gz
drwxr-xr-x 2 ccury users     4096 Aug 18 16:05 Peaks_FACT_trackings/
-rw-r--r-- 1 ccury users       50 Aug 18 15:44 RF_CSF.txt
-rw-r--r-- 1 ccury users       51 Aug 18 15:44 RF_GM.txt
-rw-r--r-- 1 ccury users      238 Aug 18 15:44 RF_WM.txt
drwxr-xr-x 2 ccury users     4096 Aug 18 15:56 bundle_segmentations/
drwxr-xr-x 2 ccury users     4096 Aug 18 16:05 endings_segmentations/
-rw-r--r-- 1 ccury users 23468369 Aug 18 15:53 peaks.nii.gz

========================== Original message : ============================== Hello,

I have 2 questions regarding FODs images and tractography. To use the–track_FODs option of Tracking function, the -i parameter has to be a FODs image. So for this, I decided to add the option–keep_intermediate_files to the TractSeg –raw_diffusion_input function, so the FOD images are not removed. However, the image WM_FOD.nii.gz is deleted, the remaning files are : CSF_FODs.nii.gz GM_FODs.nii.gz RF_CSF.txt RF_WM.txt peaks.nii.gz RF_GM.txt. Only WM_FOD.nii.gz is missing. Q1 : Do you have an idea why ? Is it possible to retrieve it from RF_WM.txt for example ?

Once I will have my WM_FOD.nii.gz image saved (and being a beginner in diffusion images), I have another question Q2: As I can extract CSF_FOD.nii.gz, GM_FOD.nii.gz and WM_FOD.nii.gz from my multi-shell diffusion image, can I “combine” them to be used as input (-i parameter) in the Traking –track_FODs function, or it is an absurd statement and I must use WM_FOD.nii.gz only ?

Cheers ! Claire

Here is the command lines I have :

TractSeg \
            -i ${PROCESSDIR}/${s}/${s}_noddi_dir200_preprocessed_MNI.nii.gz \
            -o ${PROCESSDIR}/${s}/tractseg_output \
            --raw_diffusion_input \
            --bvecs ${PROCESSDIR}/${s}/${s}_noddi_dir200_preprocessed_mrtrixMNI.bvec \
            --bvals ${PROCESSDIR}/${s}/${s}_noddi_dir200_preprocessed_MNI.bval \
            --csd_type csd_msmt \
            --output_type tract_segmentation \
            --keep_intermediate_files \
            --brain_mask ${PROCESSDIR}/${s}/${s}_noddi_dir200_brainMask_MNI.nii.gz

echo "=========   Starting TractSeg endings_segmentation... ======="
TractSeg \
        -i ${PROCESSDIR}/${s}/tractseg_output/peaks.nii.gz \
        -o ${PROCESSDIR}/${s}/tractseg_output \
        --output_type  endings_segmentation 

echo "=========   Starting Tracking on FOD maps using mrtrix ${track_FOD_algo}... ======="
Tracking \
        ${PROCESSDIR}/${s}/tractseg_output/WM_FODs.nii.gz \     # missing file
        -o ${PROCESSDIR}/${s}/tractseg_output \
        --algorithm det \
        --nr_cpus 100 \
        --tracking_dilation 3 \
        --tracking_format trk \
        --track_best_orig \
        --track_FODs ${track_FOD_algo} \
        --nr_fibers 2000 
wasserth commented 3 years ago

You have to specify --keep_intermediate_files also when calling endings_segmentation. Then WM_FOD.nii.gz should not get deleted.

For tracking only the WM_FOD.nii.gz are of any use. It does not make sense to combine them with CSF_FOD or GM_FOD. Tracking only makes sense inside of white matter (WM) tissue, not inside of CSF or GM tissue.

cclairec commented 3 years ago

Thanks for the reply, I eventually added the option --keep_intermediate_files and it fixed my issue. However, I was wandering if the following behaviour is wanted :

Cheers

wasserth commented 3 years ago

I am happy to hear that this solved your problem. The behavior of --keep_intermediate_files is intended this way.