Hi David,
My brain clearly failed to register this issue when I made some changes to 5tt2gmwmi
and the relevant streamline seeding code quite a while back.
What I did is change the GM-WM interface seeding ‘mask’ from a genuine binary mask image to a floating-point image. The relative values within different voxels result in different densities of ‘initial’ streamline seeds prior to the interface optimisation. By allowing the interface image calculated by 5tt2gmwmi
to be ‘smooth’ rather than a blocky voxelised mask, the resulting seed point density on the interface is much more homogeneous.
However this was done to improve the seed distribution in whole-brain seeding. By doing so, I’ve presumably removed the additional check that following optimisation the seed point still be within the input mask (which I think was there initially), since the input is in fact no longer a mask. This means that if your seed image only covers a subset of the interface rather than the entire brain, it’s possible for streamlines to move outside the mask during the optimisation.
I can think of a few different ways that I could approach this from a code perspective; I’m not quite sure which is the best approach in terms of user-friendliness (anyone feel free to comment):
-
Detect that the input provided to tckgen -seed_gmwmi
is either a binary image, or only contains ones and zeros, and when this is the case additionally check that the final seed point still lies within the mask;
-
Have two different options in tckgen
: one for whole-brain interface seeding and one for mask-based interface seeding.
Secondly I would like to ask if you have any suggestion about how I could discard these fibers, to ensure in the end i have N fibers statrting from within my mask.
The simplest way would be to use tckedit
, providing your ROI using the -include
option, and additionally specifying the -ends_only
option. This will only compare streamlines endpoints against your ROI. The disadvantage of this approach is that if a streamline is seeded outside of your ROI, but then terminates inside your ROI, it will be included (since both endpoints will be tested, not just the seed point).
A more robust check would be to capture the streamline seeds using tckgen -output_seeds
and test those, but it’d take some coding to extract the streamlines of interest based on testing those seeds.
I have thought of generating an exclude mask with the 1-voxel neighborhood of the roi withing the overal gmwmi mask, but I fear this might be too strict.
The disadvantage here (even if you were to perform it in a subsequent step using tckedit -exclude <image> -ends_only
) would be the rejection of streamlines that terminate within that mask, but were not seeded within that mask (e.g. very short streamlines, or those that go into WM then loop back toward the seed region).
Cheers
Rob