Bizzare Tractogram

Hello Robert,

Thank you for the suggestion.

The tractogram post dwigradcheck can be found in the reply to Jerome.
No difference.

Looking forward to further guidance.

Best Regards,
Amit.

Hello Roey,

Thank you for your response.

PFA the FOD image for perusal and opinion.

Best Regards,
Amit.

Hey @amitjc,

Well, the orientations look fine to me. However, it seems like the CSD data is only present in some of the horizonal lices. Is that right? If you press “ctrl+i” to toggle off the interpolation, does it seem like the CSD data cover the antire voxels?

I haven’t encountered such a situation before. Could this be related to how you acquired the data?

My guess is that if you increase the step size in the tracking algorithm, you might get more sensible streamlines. Could you try this? (although you would still want to figure out why the data looks so sparse along the z axis).

Also, could you perhaps post here the output of running mrinfo on your input diffusion data file?

Best,

Roey

I agree. Can you please post the output of mrinfo? I am assuming you acquired very anisotropic data (thick slices and high in-plane resolution). There also seems to be quite a bit of noise - have you tried to use just the WM as the mask?
If you are able to, please upload the dicoms or dwi.mif to a cloud and I would be happy to have a look to work out what is going on.
Jerome

Hello Roey,

Appreciate your constant support.

Please find the mrinfo output for perusal and opinion.

Thank you.

Best Regards,
Amit.

************************************************
Image:               "dwi.nii.gz"
************************************************
  Dimensions:        256 x 256 x 48 x 21
  Voxel size:        0.9375 x 0.9375 x 3 x 9.822
  Data strides:      [ -1 2 3 4 ]
  Format:            NIfTI-1.1 (GZip compressed)
  Data type:         signed 16 bit integer (little endian)
  Intensity scaling: offset = 0, multiplier = 1
  Transform:                    1           0          -0      -130.4
                                0           1          -0      -132.3
                               -0           0           1      -74.51
  comments:          TE=75;Time=95257.000
  dw_scheme:         0,0,0,0
  [21 entries]       1,0,0,1000
                     ...
                     -0.5610779953,-0.7010974593,-0.4400611728,999.722
                     -0.4049129531,0.6308643787,-0.6618577159,1000.43

Hi Amit,

I see. Looking at you “Voxel size” field, you can see that while the in-plane resolution is high (0.9375, in fact higher than commonly used for tractography analysis, 1.5-2 mm), the slices along the z direction are large (3 mm).

I don’t have experience with anisotropic voxels in diffusion data. You can probably find some information about the issues involved with this kind of data (e.g., here).

I hope someone else might have more useful suggestions!

Best wishes,
Roey

Hello Jerome,

Appreciate your constant support.

PFA the link to the DICOM dti files for perusal and opinion.

Thank you.

Best Regards,
Amit.

http://sendanywhe.re/15UFJJHA

Hi Amit,

I have processed your data.

The data is interpolated, so the original matrix was 128x128, and interpolated to 256x256 during recon, so in-plane ends up being 0.9375x0.9375. The slices are quite thick (3mm). Do you have research mode? If yes, then you can turn off the interpolation (download CV, select “rhimsize”, and change 256 to be 128).

No axis flipping was required.

Beginning with deterministic tractography, it all looks good.

I then preprocessed the data and generated the response file, FODs and probabilistic tractography. The FODs are not very clean.

So I started at the beginning and resized the data to be 3mm isotropic and then reran the pipeline. The FODs look better from coronal and sagittal (as expected), but reslicing created voxel mixing so this noise was also tracked.

Finally I ran the resized FODs through tractseg (as tractseg doesn’t like very anisotropic data) and output looks very good.

Summary: thick slices, interpolated in-plane, so very anisotropic data. Low number of diffusion directions (20).

Jerome

Amit_resized_3mm_iso Amit_response_file

Here are some tractseg outputs.
Jerome

Hello Jerome,

Thanks for those wonderful tractograms.

I will be highly obliged, if you can provide a step-by-step guide to creating the tractograms.

Do suggest ideal slice thickness and number of directions which can be acquired in reasonable duration.

pip3 installed tractseg as pip (python version 2.7)wouldn’t proceed with installation

$ pip install tractseg
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
ERROR: Could not find a version that satisfies the requirement tractseg (from versions: none)
ERROR: No matching distribution found for tractseg

Research mode not enabled on the clinical scanner.

Looking forward to further guidance.

Thanks again.

Best Regards,
Amit.

Even more beautiful!

Hi Amit,

I suggest 2.00mm slice thickness; 66 slices should be enough for whole brain coverage. 60 slices should be suffice. If you do not have hyperband (multiband) then you may want to increase the slice thickness to 2.5mm. Your 24 channel head coil should be able to cope with a hyperband factor of 2 but probably not 3. Note that getting a research license is free; just ask you local GE person or join the GE Collaboration Community https://collaborate.mr.gehealthcare.com/login.jspa?referer=%2Findex.jspa .

Some notes about tractseg:

  • Make sure to install python 2.x (best is 2.7), not python 3 (3 could cause problems with other programs).
  • Install Pytorch v1.0
  • Then install tractseg (not the container version as that can’t do probabilistic tractography)
  • Check the path where tractseg was installed. For example, on one of my computers it is here:

/home/ubvm18p04/.local/bin/TractSeg

  • So, locate where your tractseg is.
  • Then run these commands from the location of your fod.mif :

sh2peaks fod.mif peaks.nii.gz -num 3

/home/ubvm18p04/.local/bin/TractSeg -i peaks.nii.gz --bundle_specific_thr ;

/home/ubvm18p04/.local/bin/TractSeg -i peaks.nii.gz --output_type endings_segmentation --postprocess ;

/home/ubvm18p04/.local/bin/TractSeg -i peaks.nii.gz --output_type TOM --bundle_specific_thr ;

/home/ubvm18p04/.local/bin/Tracking -i peaks.nii.gz --tracking_dir TOM_trackings_filt --tracking_format tck ;

The first time you run tractseg it will download the training data set which is 140MB for about 3 of the steps.

The last step will convert the outputs (72 tractograms) to MRtrix .tck format in a directory called TOM_trackings_filt.

Regards,

Jerome

Hello Jerome

Can’t proceed with pip install tractseg.

Please advice

Thank you,

Best Regards,
Amit.

Hmmm. I’m not sure. I suggest you contact Jakob (he created Tractseg):

j.wasserthal@dkfz-heidelberg.de

Jerome

Hello Jerome,

Finally I could launch TractSeg in python3 venv after pip Install nightly version of pytorch in python3 venv.

Thanks much.

Best Regards,
Amit.

TractSeg: error: unrecognized arguments: --bundle_specific_thr

TractSeg: error: unrecognized arguments: --postprocess

Getting the errors as above and then Tracking generates empty tractograms.

PFA log below and advice.

Thank you.

Best Regards,
Amit.

(p3_env) amitjc@AMiT:~$ TractSeg -i ~/NiFTi/peaks.nii.gz --bundle_specific_thr 
usage: TractSeg [-h] -i filepath [-o directory] [--single_output_file]
                [--csd_type csd|csd_msmt|csd_msmt_5tt]
                [--output_type tract_segmentation|endings_segmentation|TOM|dm_regression]
                [--bvals filename] [--bvecs filename] [--brain_mask filename]
                [--raw_diffusion_input] [--keep_intermediate_files]
                [--preview] [--flip] [--single_orientation]
                [--get_probabilities] [--super_resolution] [--uncertainty]
                [--no_postprocess] [--preprocess] [--nr_cpus n]
                [--tract_segmentation_output_dir folder_name]
                [--TOM_output_dir folder_name] [--exp_name folder_name]
                [--tract_definition TractQuerier+|AutoPTX] [--rescale_dm]
                [--tract_segmentations_path path] [--test] [--verbose]
                [--version]
TractSeg: error: unrecognized arguments: --bundle_specific_thr
(p3_env) amitjc@AMiT:~$ TractSeg -i ~/NiFTi/peaks.nii.gz
/home/amitjc/p3_env/bin/TractSeg:251: DeprecationWarning: get_data() is deprecated in favor of get_fdata(), which has a more predictable return type. To obtain get_data() behavior going forward, use numpy.asanyarray(img.dataobj).

* deprecated from version: 3.0
* Will raise <class 'nibabel.deprecator.ExpiredDeprecationError'> as of version: 5.0
  data_img_shape = data_img.get_data().shape
/home/amitjc/p3_env/bin/TractSeg:272: DeprecationWarning: get_data() is deprecated in favor of get_fdata(), which has a more predictable return type. To obtain get_data() behavior going forward, use numpy.asanyarray(img.dataobj).

* deprecated from version: 3.0
* Will raise <class 'nibabel.deprecator.ExpiredDeprecationError'> as of version: 5.0
  data = data_img.get_data()
Loading weights from: /home/amitjc/.tractseg/pretrained_weights_tract_segmentation_v3.npz
Downloading pretrained weights (~140MB) ...
Processing direction (1 of 3)
100%|█████████████████████████████████████████| 144/144 [00:26<00:00,  5.44it/s]
Processing direction (2 of 3)
100%|█████████████████████████████████████████| 144/144 [00:29<00:00,  4.95it/s]
Processing direction (3 of 3)
100%|█████████████████████████████████████████| 144/144 [00:24<00:00,  5.79it/s]
(p3_env) amitjc@AMiT:~$ TractSeg -i ~/NiFTi/peaks.nii.gz --output_type endings_segmentation --postprocess
usage: TractSeg [-h] -i filepath [-o directory] [--single_output_file]
                [--csd_type csd|csd_msmt|csd_msmt_5tt]
                [--output_type tract_segmentation|endings_segmentation|TOM|dm_regression]
                [--bvals filename] [--bvecs filename] [--brain_mask filename]
                [--raw_diffusion_input] [--keep_intermediate_files]
                [--preview] [--flip] [--single_orientation]
                [--get_probabilities] [--super_resolution] [--uncertainty]
                [--no_postprocess] [--preprocess] [--nr_cpus n]
                [--tract_segmentation_output_dir folder_name]
                [--TOM_output_dir folder_name] [--exp_name folder_name]
                [--tract_definition TractQuerier+|AutoPTX] [--rescale_dm]
                [--tract_segmentations_path path] [--test] [--verbose]
                [--version]
TractSeg: error: unrecognized arguments: --postprocess
(p3_env) amitjc@AMiT:~$ TractSeg -i ~/NiFTi/peaks.nii.gz --output_type endings_segmentation
/home/amitjc/p3_env/bin/TractSeg:251: DeprecationWarning: get_data() is deprecated in favor of get_fdata(), which has a more predictable return type. To obtain get_data() behavior going forward, use numpy.asanyarray(img.dataobj).

* deprecated from version: 3.0
* Will raise <class 'nibabel.deprecator.ExpiredDeprecationError'> as of version: 5.0
  data_img_shape = data_img.get_data().shape
/home/amitjc/p3_env/bin/TractSeg:272: DeprecationWarning: get_data() is deprecated in favor of get_fdata(), which has a more predictable return type. To obtain get_data() behavior going forward, use numpy.asanyarray(img.dataobj).

* deprecated from version: 3.0
* Will raise <class 'nibabel.deprecator.ExpiredDeprecationError'> as of version: 5.0
  data = data_img.get_data()
Loading weights from: /home/amitjc/.tractseg/pretrained_weights_endings_segmentation_v4.npz
Downloading pretrained weights (~140MB) ...
Processing direction (1 of 3)
100%|█████████████████████████████████████████| 144/144 [00:27<00:00,  5.20it/s]
Processing direction (2 of 3)
100%|█████████████████████████████████████████| 144/144 [00:31<00:00,  4.60it/s]
Processing direction (3 of 3)
100%|█████████████████████████████████████████| 144/144 [00:28<00:00,  5.05it/s]
(p3_env) amitjc@AMiT:~$ TractSeg -i ~/NiFTi/peaks.nii.gz --output_type TOM
/home/amitjc/p3_env/bin/TractSeg:251: DeprecationWarning: get_data() is deprecated in favor of get_fdata(), which has a more predictable return type. To obtain get_data() behavior going forward, use numpy.asanyarray(img.dataobj).

* deprecated from version: 3.0
* Will raise <class 'nibabel.deprecator.ExpiredDeprecationError'> as of version: 5.0
  data_img_shape = data_img.get_data().shape
/home/amitjc/p3_env/bin/TractSeg:272: DeprecationWarning: get_data() is deprecated in favor of get_fdata(), which has a more predictable return type. To obtain get_data() behavior going forward, use numpy.asanyarray(img.dataobj).

* deprecated from version: 3.0
* Will raise <class 'nibabel.deprecator.ExpiredDeprecationError'> as of version: 5.0
  data = data_img.get_data()
Loading weights from: /home/amitjc/.tractseg/pretrained_weights_peak_regression_part1_v2.npz
Downloading pretrained weights (~140MB) ...
100%|█████████████████████████████████████████| 144/144 [00:23<00:00,  6.02it/s]
Loading weights from: /home/amitjc/.tractseg/pretrained_weights_peak_regression_part2_v2.npz
Downloading pretrained weights (~140MB) ...
100%|█████████████████████████████████████████| 144/144 [00:24<00:00,  5.99it/s]
Loading weights from: /home/amitjc/.tractseg/pretrained_weights_peak_regression_part3_v2.npz
Downloading pretrained weights (~140MB) ...
100%|█████████████████████████████████████████| 144/144 [00:23<00:00,  6.07it/s]
Loading weights from: /home/amitjc/.tractseg/pretrained_weights_peak_regression_part4_v2.npz
Downloading pretrained weights (~140MB) ...
100%|█████████████████████████████████████████| 144/144 [00:23<00:00,  6.04it/s]
(p3_env) amitjc@AMiT:~$ Tracking -i ~/NiFTi/peaks.nii.gz --tracking_dir TOM_trackings_filt --tracking_format tck
  6%|██▍                                         | 4/72 [02:58<48:05, 42.43s/it]WARNING: tract mask of CA empty. Creating empty tractogram.
WARNING: tract beginnings mask of CA empty. Creating empty tractogram.
WARNING: tract endings mask of CA empty. Creating empty tractogram.
 10%|████▎                                       | 7/72 [04:14<40:49, 37.68s/it]WARNING: tract beginnings mask of CC_3 empty. Creating empty tractogram.
WARNING: tract endings mask of CC_3 empty. Creating empty tractogram.
WARNING: tract beginnings mask of CC_4 empty. Creating empty tractogram.
 21%|████████▉                                  | 15/72 [08:45<38:32, 40.57s/it]WARNING: tract beginnings mask of CST_right empty. Creating empty tractogram.
WARNING: tract endings mask of CST_right empty. Creating empty tractogram.
 28%|███████████▉                               | 20/72 [11:44<36:24, 42.02s/it]WARNING: tract mask of FX_left empty. Creating empty tractogram.
WARNING: tract beginnings mask of FX_left empty. Creating empty tractogram.
 29%|████████████▌                              | 21/72 [11:44<25:02, 29.47s/it]WARNING: tract mask of FX_right empty. Creating empty tractogram.
WARNING: tract beginnings mask of FX_right empty. Creating empty tractogram.
WARNING: tract endings mask of FX_right empty. Creating empty tractogram.
WARNING: tract endings mask of ICP_left empty. Creating empty tractogram.
 32%|█████████████▋                             | 23/72 [11:44<16:52, 20.65s/it]WARNING: tract endings mask of ICP_right empty. Creating empty tractogram.
^CProcess ForkPoolWorker-2617:
Process ForkPoolWorker-2619:
Process ForkPoolWorker-2620:
 33%|██████████████▎                            | 24/72 [12:25<24:51, 31.08s/it]
Process ForkPoolWorker-2618:
Traceback (most recent call last):

Try putting a space and semi-colon at the end. e.g. – bundle_specific_thr ;

Jerome

Hello Jerome,

Can’t get it to work.

PFA the log below and advice.

Thanks,

Best Regards,
Amit.

(p3_env) amitjc@AMiT:~$ TractSeg -i ~/NiFTi/peaks.nii.gz --bundle_specific_thr ;
usage: TractSeg [-h] -i filepath [-o directory] [--single_output_file]
                [--csd_type csd|csd_msmt|csd_msmt_5tt]
                [--output_type tract_segmentation|endings_segmentation|TOM|dm_regression]
                [--bvals filename] [--bvecs filename] [--brain_mask filename]
                [--raw_diffusion_input] [--keep_intermediate_files]
                [--preview] [--flip] [--single_orientation]
                [--get_probabilities] [--super_resolution] [--uncertainty]
                [--no_postprocess] [--preprocess] [--nr_cpus n]
                [--tract_segmentation_output_dir folder_name]
                [--TOM_output_dir folder_name] [--exp_name folder_name]
                [--tract_definition TractQuerier+|AutoPTX] [--rescale_dm]
                [--tract_segmentations_path path] [--test] [--verbose]
                [--version]
TractSeg: error: unrecognized arguments: --bundle_specific_thr

I think Tractseg has been updated/revised recently so there are new commands (https://github.com/MIC-DKFZ/TractSeg):

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

Jerome

The tractogram post dwigradcheck can be found in the reply to Jerome.

dwigradcheck does not automatically modify the gradient table, and will therefore not have influenced your results in any way. If you wish to utilise the permutation that it estimates to be the most likely correct, you would need to explicitly export that gradient table to file, and then either utilise that table explicitly in subsequent commands or explicitly load it into your image header for subsequent automatic use.

The primary result of this script should be considered to be the summary information that is produced on the terminal. That information needs to be assessed critically, hence why it does not modify the gradient table information in-place.