This kind of conversion seems a bit inappropriate and is not directly handled: we use .tex files for textures (information mapped on a mesh, on each vertex of a mesh), whereas NIFTI files are used to store volumic information: arrays of voxels, with specified voxels sizes and voxels coordinates. I know some people or tools do use NIFTI files for "raw arrays" but there are more appropriate format for this.
You can use the GIFTI format, which has been designed in the neuroimaging community as a kind of "brother" to the NIFTI format, for meshes and mesh texture information: AimsFileConvert supports the GIFTI format (.gii extension).
I don't exactly know what fotmats does Trackvis support: doesn't it read .gii files ?
If it really requires texture information as NIFTI, then I guess some tools in the community could convert GIFTI to NIFTI... I'm just curious how would Trackvis interpret the information in such files
Otherwise you can also convert it using a home-made script, reading the .tex or .gii data and writing a 1D NIFTI file with arbitrary voxels sizes.
In Pyaims, it would look something like:
Code: Select all
from soma import aims
import numpy as np
texture = aims.read(sys.argv)
image = aims.Volume(texture.size(), dtype=type(texture))
np.asarray(image)[:, 0, 0, 0] = np.asarray(texture)
and you would call this scripy with 2 arguments: the input texture (.tex or .gii) and the output nifti file.
But also remember that NIFTI only supports 16 bits dimensions, so if the texture has more than 65535 vertices, this conversion will fail.
In any case, I'm not sure that this is really what you want to do...