TractSeg icon indicating copy to clipboard operation
TractSeg copied to clipboard

3d plots - Tract appearing outside of glass brain

Open jgburg opened this issue 3 years ago • 5 comments

Hi there,

I am having some trouble with the 3d visualisation as attached when running the following command: tractometry_result_CC_1_3D

plot_tractometry_results -i /subjects.txt -o tractometry_result.png --mc --alpha 0.05 --plot3D pval --tracking_dir /TOM_trackings --tracking_format trk

Please could I get some guidance on how to address this?

jgburg avatar Oct 08 '21 22:10 jgburg

Were your input data rigidly aligned to MNI, and is the tracking_format you specified the same as when you ran Tracking?

smeisler avatar Oct 11 '21 01:10 smeisler

Hi @smeisler thank you for your prompt response. I aligned the data to MNI space using the following commands:

for subject in cat subList.txt; do cd <ABSOLUTEPATH> /Users/Downloads/TractSeg-master/build/scripts-3.8/calc_FA -i Diffusion.nii.gz -o FA.nii.gz --bvals Diffusion.bvals --bvecs Diffusion.bvecs --brain_mask nodif_brain_mask.nii.gz /usr/local/fsl/bin/flirt -ref MNI_FA_template.nii -in FA.nii.gz -out FA_MNI.nii.gz -omat FA_2_MNI.mat -dof 6 -cost mutualinfo -searchcost mutualinfo /usr/local/fsl/bin/flirt -ref MNI_FA_template.nii -in Diffusion.nii.gz -out Diffusion_MNI.nii.gz -applyxfm -init FA_2_MNI.mat -dof 6 /usr/local/fsl/bin/flirt -ref MNI_FA_template.nii -in nodif_brain_mask.nii.gz -out nodif_brain_mask_MNI.nii.gz -applyxfm -init FA_2_MNI.mat -dof 6 cp Diffusion.bvals Diffusion_MNI.bvals /Users/Downloads/TractSeg-master/bin/rotate_bvecs -i Diffusion.bvecs -t FA_2_MNI.mat -o Diffusion_MNI.bvecs done

These look fine in FSL.

I have just seen the following for rigidly aligning them to MNI space as follows:

"# in first step --raw_diffusion_input has to be used together with --preprocess TractSeg -i Diffusion.nii.gz -o tractseg_output --output_type tract_segmentation --raw_diffusion_input --preprocess TractSeg -i tractseg_output/peaks.nii.gz -o tractseg_output --output_type endings_segmentation --preprocess TractSeg -i tractseg_output/peaks.nii.gz -o tractseg_output --output_type TOM --preprocess Tracking -i tractseg_output/peaks.nii.gz -o tractseg_output"

I ran tracking as follows:

/usr/local/bin/docker run -v ${pathData}:/data -t wasserth/tractseg_container:master Tracking -i /data/tractseg_output/peaks.nii.gz -o /data/tractseg_output --nr_fibers 5000

I did not specify the tracking_format but the output of the TOM_Trackings are .trk files.

Can I run the rigidly align to MNI space with the -preprocess commands again through the docker with the current output already in each subject's folder? and if so do will the output overwrite my current TOM_Trackings folder? If possible are there some example scripts for use with docker commands as it appears only the --preprocess flag is different?

jgburg avatar Oct 11 '21 14:10 jgburg

When you do the manual transformation to MNI space as you have described (using flirt) then you do not need to use the --preprocess option. --preprocess will simply do the same thing with flirt as you did manually.

Do you have the lastest docker container? In June I fixed a bug related to alignment of the streamlines. So make sure your docker container is from after this fix. Also you could try if it works with --tracking_format tck.

All the normal commands in the documentation can be used with docker. Therefore there is no separate documentation for docker.

wasserth avatar Oct 12 '21 08:10 wasserth

Hi @wasserth I've made sure I am using the latest docker container.

Using the following command:

/usr/local/bin/docker run -v ${pathData}:/data -t tractseg_container1:latest plot_tractometry_results -i /data/subjects.txt -o /data/tractometry_result.png --mc --alpha 0.05 --plot3D pval --tracking_format trk

I now get the followings error:

0%| | 0/50 [00:00<?, ?it/s] /usr/local/lib/python3.7/site-packages/fury/utils.py:235: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray. cols_arr = np.asarray(colors)

Everything looks like it is running as before but doesn't get past 0/50.

Is there anything else I could try?

jgburg avatar Oct 12 '21 22:10 jgburg

In version 2.4 I made another bug fix for alignment of the trackings. You could try again with this version.

wasserth avatar Mar 14 '22 10:03 wasserth