Hi Drew,
There’s quite a few points here; let’s see how I go disentangling it all…
… and would like to sample from thresholded data (i.e., FA > .2) to restrict sampling to white matter. However, tcksample outputs a lot of non-zero values below the threshold. Can you tell me why this might be and if there’s anything to do to avoid this? Similarly, is there any way to limit sampling to non-zero values?
Firstly, I’m going to interpret from this that you are not calculating a streamline-wise statistic using the -stat_tck
option, and therefore having tcksample
output one value for every vertex point along each streamline.
Now if you are “sampling from thresholded data”, i.e. you have set the image value to 0 for any voxel where FA<0.2
, then yes, the sampled value underneath some streamline points will still be non-zero but less than 0.2. This is because of the use of interpolation: if a vertex lies precisely in between one voxel with a value of 0.0 and another voxel with a value of 0.2, then that vertex will be assigned a value of 0.1. It would be technically possible to provide a command-line option in tcksample
to disable this interpolation, but this may not be the best solution to what you’re trying to achieve (let’s see).
One possible alternative way of doing this is to mask the streamlines rather than the image data. If you derive a mask image containing voxels with FA>0.2
, you can use this in tckedit
with the -mask
option, and any streamline vertex outside the mask image will be discarded. Note that by doing this, depending on your mask image it’s possible for one input streamline to be ‘split’ into multiple output streamlines; so if this were to be problematic for your analysis something would need to be done about it (for which there’s a few possible solutions). Also, even once this masking is performed there may still be some streamline vertices where the sampled value is less than your FA threshold (since the mask is a binary image and therefore streamline cropping is performed without interpolation, but the sampling will use interpolation).
Another alternative, which may or may not be of any use to you depending on exactly what you’re wanting to do with the sampled data subsequently, is to simply apply the FA>0.2
threshold directly to the output from tcksample
. This is only an option because you are using the image that you are sampling (FA) to also define your ‘white matter mask’; the advantage of the previous suggestion is that the masking of areas to be sampled is independent of the image that you intend to sample from.
And last, I’m wondering if the order of values per line in the tcksample output corresponds to some anatomical orientation.
In the absence of the -stat_tck
option, the values provided by tcksample
are literally the sampled values underlying each streamline vertex. Importantly, this means that depending on how the streamlines corresponding to your pathway of interest were generated / extracted, for some streamlines the sample values may be in the reverse order with respect to those from other streamlines.
If you are looking to derive image values underlying streamlines according to some anatomical orientation or pre-defined path, that functionality is now provided by the tckresample
command.
Cheers
Rob