Map track start/end to label

Viewing 2 reply threads
  • Author
    Posts
    • #222
      maedoc
      Participant

      I’d like to map the start and end of tracks to their labels, and to that end I’ve run the whole cortical extraction sequence + extra regisration step, as well as the whole diffusion pipeline. Then, I saved all tracks to a dft file and loaded the tracks from that.

      I then loaded the rigid reg transform and the t1 label nii and applied the rigid reg then the inverse of the label transform, but I’m not getting voxel coordinates inside the label image.

      Can anyone provide some clues on how to do this?

    • #223
      maedoc
      Participant

      After some playing around, it seems tracks are saved in t1 space, not diffusion space. As a interesting twist, one has to apply the inverse of the affine w/o translation, i.e. just the 3×3 not 4×4 affine.

      Knowing this, obtaining voxel coords & label values is easy.

      It would be nice if this were documented somewhere in the file formats section.

      • #224
        Anonymous
        Inactive

        Hi Maedoc, diffusion modeling outputs (diffusion tensor, ODFs etc.) are always saved in T1-space. So, usual tractography would results into tracks being generated and saved in T1-space. An exception to this would be if diffusion outputs from diffusion_coord_outputs directory is used for tractography (this directory is only generated if --output-diffusion-coordinate flag was used).

        As a interesting twist, one has to apply the inverse of the affine w/o translation, i.e. just the 3×3 not 4×4 affine.

        Above statement is not entirely accurate. BDP supports wide variety of data transformation across T1 and diffusion space, and so users do not have to do it themselves. Please take a look at “TRANSFORMATION FLAGS” section on flags documentation, in particular flags: --transform-t1-volume, --transform-interpolation, --transform-data-only. This is the recommended way to transfer data from one space to another.

        Flag documentation: http://brainsuite.org/processing/diffusion/flags/#fullflaglist

    • #227
      maedoc
      Participant

      I was aware of the transformation flags which is how I ruled out that the tracks were in the DWI space.

      My question was, how can I recover voxel coordinates of tracks? If the coordinates of the curves in the dft file are in T1 space, normally one inverts the 4×4 T1 affine and applies it to the curve coordinates, but this produced a translation that was not correct. Rather, I had to invert take the inverse of affine(1:3, 1:3) and apply it to curve coordinates.

      I verified this by plotting a slice of the T1 space label image with imagesc (transposed & with upside down) and plotting the seeds of all the curves within that slice. The seed points line up nicely with the image, whereas this fails completely with the full 4×4 affine.

      I repeat, it would be nice to have confirmation on this as I did not read enough of the source code to confirm 100%.

      • #230
        Anonymous
        Inactive

        The coordinates in the BrainSuite’s surface-space (which is same space as the curves’ space) are related to voxel-coordinates simply by scaling with voxel-dimension (and not by 3×3 inverse affine-matrix). For x-coordinates this would be: voxel_coord_x = curve_coord_x/pixdim[1]; and likewise for y and z — Note that this expression uses c-based indexing, i.e. array (and voxel) indexing start from 0.

        Another similar question: https://forums.brainsuite.org/forums/topic/surface-mesh-space/

Viewing 2 reply threads
  • You must be logged in to reply to this topic.