Problem of "masks" in Mrtrix

Hi, Mrtrixers,

I have some questions about “tckgen” and “masks” in Mrtrix.

1. About tckgen:

The command is as shown:
`tckgen -algorithm SD_Stream HARDI_fod.mif HARDI_StreamTracking.tck -seed_grid_per_voxel HARDI_mask.nii 2 -mask HARDI_mask.nii  -select 10000`

My aim is to set the desired number of streamlines to 10,000. However, it seems the option “-select” doesn’t work. The output file is extremely large. Usually, I use the option “-number”, but it seems disappeared in new version Mrtrix.:roll_eyes:

2. About “masks” in Mrtrix

I test those fiber tracking methods in two datasets and develop a visualization system to render the results.

1).

Here is an example HARDI data(without T1 image), the results should shown as Fig 1, we can see the sulcus clearly. However, when the results of the streamline tracking method are shown as Fig 2 - Fig 4. Figure 5 is streamline tracking method with the mask through FSL. It seems a bit better than Fig 2 on the top of the figure.

For Fig 1, we modify the masks hand-by-hand, slice-by-slice. For Fig 2 - Fig 4, we use the command "dwi2mask" and use FA value for terminating tracks. However, it seems not a smart way.

Fig 1:
HARDI_csa_prob_1_pervoxel_01

Fig 2 (default FA value)
HARDI150_mrtrix_StreamTracking_sift_01

Fig 3(FA = 0.4)

Fig 4(FA = 0.3)

Fig 5(default FA, fsl_mask)


2).

I also use another DTI data (with T1 image) to test the methods.
Fig 6 is the result of Streamline tracking method, there are still some horizontal fibers at the bottom of the brain. Fig 7 is the result of Anatomically-Constrained Tractography. The fiber seems twisted compared with the other figures, but it may be correct? for ACT is a kind of probabilistic tracking method and I compared it with Fig 8, which comes from the homepage of MRtrix

Fig 6(FA = 0.25):
25_ang45_01

Fig 7 (ACT)

Fig 8(Come from MRtrix homepage)


Above all, I guess, the problem may list of the mask. For the current masks, they contain white matter and gray matter. when I do fiber tracking, it also goes to gray matter.
So I tried to use the mask of freesurfer, but the out put :"Error: dimension mismatch".
Can Mrtrix produce" white matter mask" with gray matter removed? I have no idea right now.:no_mouth:

Also, I am considering about Global Tractography, it seems quite fantastic on the homepage, I’ll try it then.

Thank you for your help~. :kissing:
Chaoqing

I’ll quickly add a bit on this figure, since I’ve generated that one myself. :wink:

What you see playing out there, is the “magic” of multi-tissue CSD (it was actually single-shell 3-tissue CSD, SS3T-CSD, in this case), combined with nothing more than the default parameters of tckgen. The (default) stopping criterion in this case is by default based on the white matter FOD amplitude. To make those FOD amplitudes sensible and informative though, a form of multi-tissue CSD is best applied; which then filters out contributions from other tissue types (grey matter, CSF, and some other stuff). Note this tractography result did not use anatomically constrained tractography (ACT) at all. What you see in terms of cortical structure, naturally arose from the multi-tissue FODs combined with the default threshold.

Apart from that, I should note this dataset was upsampled to 1.25mm isotropic spatial resolution before performing SS3T-CSD. This gives a sharper result, since the constraints in the CSD inform the fit (i.e. as a prior) for each individual voxel. Furthermore, this matters for this tractogram’s perceived quality while using the defaults in tckgen, because the default step size is set in function of the voxel size. Feeding an FOD image with a higher resolution, will by default result in a smaller step size, which may result in, perceptionally less erroneous local behaviour of streamlines. It also results in a different probabilistic behaviour (and properties) of the final tractogram.

Thank you for your patient reply.
Fig 8 is a really cool result! I love it very much.:star_struck:

Do you mean my problem may not only list on the mask, but also FOD?

My bval file is as follows:

In my case, it seems a single-shell DWI, As shown here, ss3t_csd is not available yet. do you mean that I can use "msmt_csd" instead of "csd" when I use dwi2fod to fiber orientation distribution estimation? Just like the document, so that I can strike out the gray matter.

By the way, Figure 9 is really fantastic. However, Global Tractography seems to run on a cohort of images. I just test one single DWI data, does Global Tractography fit me? I want to try it then. :hushed:

Fig 9: (Global Tractography)

Many Thanks,
Chaoqing

Hi Chaoqing,

Global tractography (as in Fig. 9) is run for a single subject, not a cohort. However, to get these results, you’ll need multi-shell data.

Cheers,
Daan

The command is as shown:
tckgen -algorithm SD_Stream HARDI_fod.mif HARDI_StreamTracking.tck -seed_grid_per_voxel HARDI_mask.nii 2 -mask HARDI_mask.nii -select 10000
My aim is to set the desired number of streamlines to 10,000. However, it seems the option “-select” doesn’t work. The output file is extremely large. Usually, I use the option “-number”, but it seems disappeared in new version Mrtrix.:roll_eyes:

The command-line option -number was replaced by option -select in version 3.0_RC1; this was mentioned in the changelog here.

The -select option cannot work in this instance, due to use of the -seed_grid_per_voxel option. In tckgen, the different seeding mechanisms can be broken into two groups:

  • Finite” seeds (-seed_random_per_voxel and -seed_grid_per_voxel): With these mechanisms, the number of streamline seeds (and hence the maximum possible number of streamlines) is bound by the number of voxels in the mask image, and the number of seeds per voxel. Once the requested number of seeds have been drawn from a particular voxel in the input mask image, no more streamlines are seeded from that voxel.

  • Infinite” seeds (all other -seed_* options): These mechanisms can theoretically continue to generate streamlines for the life of the universe. As such, it is generally recommended to restrict the total number of streamlines selected using the -select option.

Mixing a “finite” seeding mechanism with the -select option therefore doesn’t make sense: You’d either reach the requested number of streamlines before fully sampling from the input seeding mask image (resulting in a bias depending on the direction in which the seeding algorithm sweeps through the mask image), or fully exhaust your requested seed points before reaching your requested number of selected streamlines. Either way, you’re asking the command to satisfy two (almost) mutually exclusive constraints with respect to the number of streamlines / seeds you want it to produce.

For Fig 2 - Fig 4, we use the command “dwi2mask” and use FA value for terminating tracks. However, it seems not a smart way.

If you have a better technique for terminating streamlines in the absence of ACT / multi-tissue CSD, we’re all ears. :expressionless:

Fig 7 is the result of Anatomically-Constrained Tractography. The fiber seems twisted compared with the other figures, but it may be correct? for ACT is a kind of probabilistic tracking method …

ACT is a framework that is applicable to both probabilistic and deterministic streamlines algorithms. One contributor to the effect you’re seeing is that the default minimum length criterion is decreased from 5 voxels to 2 voxels when using ACT. So not only do you have more short “noisy-looking” streamlines just superficial to the cortex, but the total “amount” of streamlines (sum of streamline lengths) is less for a fixed streamline count, contributing to the “noisy” appearance.

So I tried to use the mask of freesurfer, but the out put :“Error: dimension mismatch”.

We’d need to see the full error message to figure out what’s going wrong here. tckgen should be fully capable of handling mask images with different voxel grids to the input FODs.

Hi, Daan,

Thank you for your explanation!

For my dataset currently are single-shell data, I have to give up Global Tractography right now.

Thanks,
Chaoqing

`Hi, Rob,

If you have a better technique for terminating streamlines in the absence of ACT / multi-tissue CSD, we’re all ears. :expressionless:

Sorry, my expression is confusing. I think it will not be a smart way for me to automatically do fiber tracking by using FA value for terminating tracks, for I got a set of DWI data and probably should not use stable FA value as stopping condition.

ACT is a framework that is applicable to both probabilistic and deterministic streamlines algorithms. One contributor to the effect you’re seeing is that the default minimum length criterion is decreased from 5 voxels to 2 voxels when using ACT. So not only do you have more short “noisy-looking” streamlines just superficial to the cortex, but the total “amount” of streamlines (sum of streamline lengths) is less for a fixed streamline count, contributing to the “noisy” appearance.

I have added the streamline to 1M, and the output seems cool. See as follows:

Fig.10 (ACT with DWIdenoise, preproc and biascorrect)
(but however, I didn’t detailly test whether it is correct when going through prproc step)




Fig.11: (ACT without DWI denoise,preproc and bias-correct)




They look similar to each other, however, they seem right by naked eyes.
Can I just discard the "denoise","preproc", and "bias-correct" steps?

Thanks,
Chaoqing

`

They look similar to each other, however, they seem right by naked eyes.

There needs to be exceptionally severe issues with your data for differences between the two reconstructions to be clearly visible using an image of each whole-brain tractogram alone. So it’s not really an appropriate marker for evaluating reconstruction methods.

Having said that: Are you sure that the top image is the one without pre-processing steps? The bottom one looks cleaner and the brain is more conventionally shaped :-/

Can I just discard the"denoise",“preproc”, and “bias-correct” steps?

Obviously they’re all beneficial; we wouldn’t go to the effort of creating, implementing, releasing and recommending these methods if they were worthless. In the context of ACT, while dwidenoise and dwibiascorrect are preferable, dwipreproc is more like a prerequisite: Without correcting the DWIs for geometric distortions (including B0 inhomogeneity), you cannot achieve adequate alignment between DWIs and T1 images, and hence can’t trust that the fibre orientation information and tissue segmentation information at a particular point in space correspond to the same biological location.

Hi, Rob,

Having said that: Are you sure that the top image is the one without pre-processing steps? The bottom one looks cleaner and the brain is more conventionally shaped :-/

I’m pretty sure that Fig11 is the one without pre-processing steps. I just want to see what the figures will be if I discard the “dinoise”, “preproc”, and “bias-correct” steps, because these three steps take a lot of time. However, the results seems quite cool and unbelievalbe.

Also, as Donald said this data may not suitable for pre-processing ,as they are not reversed phase-encoded EPI images.

I’m sorry I should indicate in the post that Fig 10 and Fig 11 are the results of different subjects. The data is problematic, as shown in re-edited figures. They have been cut-off which may have a great influence on registration from T1 image to DWI image, especially the data of Fig 10.

As I think, It explains why Fig 11 looks cleaner and the brain is more conventionally shaped.

I don’t know why ACT works well with unpreprocessed Single-Shell DWI data. Anyway, it seems works.:sweat_smile:
Also, I’m curious about the reason for this phenomenon.

By the way, does ACT work with Multi-Shell DWI data?
I’ve test on a problematic Multi-Shell data, as Fig 12 shows. It seems also works.

Fig 12:(Multi-Shell DWI data)




Problematic Datasets… :sweat_smile::sweat_smile::sweat_smile:

Many Thanks,
Chaoqing

Also, as Donald said this data may not suitable for pre-processing ,as they are not reversed phase-encoded EPI images.

You can certainly perform “pre-processing”; it’s just that you can’t do EPI inhomogeneity distortion correction if you don’t have at least one b=0 image with a different phase encoding, which in turn precludes the use of ACT.

By the way, does ACT work with Multi-Shell DWI data?

There’s no reason why it wouldn’t. I ensured that the ACT framework was applied entirely independent of both the tracking algorithm used, and any algorithm used prior to that in estimating fibre orientations / fibre orientation distributions. Indeed as shown in the ACT paper it can even be applied in conjunction with a deterministic tensor tracking algorithm; not that that’s a good idea, but it just shows that the two mechanisms (determining which direction to track in, and determining when to terminate / reject streamlines) are in fact separate mechanisms.