-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tck file format #18
Comments
Hello @gelazari ! Tract_querier supports VTK as well as TRK (trackvis). If you want to add tck format, you should add two functions similar to with in the same file as these. Then, modify the functions tract_querier.tractography.tractography_from_file(filename) to add handling for the third data format transparently. The NIPy people have developed a MRTRix to TrackVis converter. You can probably use this as an example: Let me know if this is helpful! |
All of the above operations should be done in the tractography.py file right?Also, in the WMQL documentation, only the support for VTK file format is mentioned i.e "A full-brain tractography in VTK format: It must be a vtkPolyData object where all the cells are lines". Anyhow, I'm only interested in the .tck format from Mrtrix and not the .trk (TrackVis) format unless needed. But what do you think is better? To incorporate the .tck format or to pre-convert my .tck files to .vtk or .trk (since you say it's supported by the querier) format? I don't know if i have the required programming skills to mess with your code. |
I also saw that the Nipy code is available in Github so the .tck functions needed to do the job are already implemented. |
Regarding tck and trk, file formats in medical imaging are all but simple with many nuances. So I wouldn't mess with the code if that's not your priority. But, you are willing to make a contribution to a software package, I will be glad to help! Also, I will update the documentation soon! Thanks for noticing.
|
Of course I am willing to contribute as long as we can do it together so as to learn and at the same time improve the software for everyone. :) |
Guys, If I may jump in, we've been developing a TractConverter tool that can save You can get it here: You can convert from trk to tck to vtk to etc... Maxime Descoteaux, PhD Scientific director On Tue, Feb 17, 2015 at 12:57 PM, gelazari [email protected] wrote:
|
True @mdesco ! I forgot! Thanks for jumping in! Demian Wassermann, PhD |
Once in NiBabel, I will be happy to provide a patch to the TractQuerier so it can read any streamlines format. You can watch PR nipy/nibabel#243 for updates. |
So, to sum up, by using the TractConverter to do the conversion .tck->.trk would be more than enough for using the tracts in Tract_querier, right? |
Yes. Let me know how it goes. |
Results in track conversion from Mrtrix3 format .tck to .vtk are perfect. After the conversion, I check if the output is similar with the input with: And it's always good in my case. |
OK @gelazari . So you are proposing to directly incorporate this code into tract_querier? |
i think that since code for conversion from one format to another exists, I find no reason for tract_querier not to incorporate direct Mrtrix (.tck) format reading and an option -o to specify the output the format of the output of the tracks. Of course it is not necessary but it would be nice, because all the necessary modules are up and running. What does @MarcCote think? |
I'm not sure if I understood correctly. You want to add code for loading tck directly in tract_querier instead of using a third party library (e.g. NiBabel or TractConverter)? Personally, I think tract_querier should continue using NiBabel to load streamlines. Once my PR (nipy/nibabel#243) for supporting multiple streamlines file format is merged, it would be really easy to use. For example, import nibabel as nib
fa = nib.load('fa.nii.gz')
streamlines = nib.streamlines.load('tractography.tck', ref=fa)
# Streamlines are in voxel space by default, send them to world space
streamlines = streamlines.to_world_space() |
I agree with @MarcCote . The issue with incorporating working code, is that the largest cost in code is not having a working version but doing the maintenance. As there's already a compatible project in the community handling this, NiBabel, which is already used in tract_querier. I think it's better to wait for Marc's PR to be accepted. (And btw, great work on that @MarcCote !) |
As the software only supports the .vtk format, I would like to ask suggestions/proposals to incorporate the usage of .tck format as follows: For example, is it possible to modify the code so as to give as input .tck format, then .tck to be converted to .vtk format within the code and then continue with the execution as normally. I am asking this because the code is not very easily understood for a non professional coder without the proper documentation and i would really appreciate any help/hints.
Thanks in advance for your time and consideration
The text was updated successfully, but these errors were encountered: