I think I got it. trk files save the coordinate system convention in the header (RAS/LPS). By default I set this to LPS, since this is the MITK coordinate convention. Trackvis expects RAS. I added an option that allows to save trk files as RAS. SO if you save a trk file in the GUI now, it will ask you if you want to use LPS or RAS.
Let me know if everything works as expected. Peter ? ________________________________ Von: Alexandre Dupoint <[email protected]> Gesendet: Mittwoch, 5. April 2017 17:12 An: Neher, Peter Betreff: Re: AW: [mitk-users] Convert tractography tracts to trk / tck formats I'm using nibabel 2.1.0 too. Indeed the nib.trackvis.read(filename) worked, I got the error when using the nibabel.streamlines.load("fibers.trk") I have cloned and compiled the MITK github for 2 versions: MITK_v2016.11 and the master branch (cloned at the end of march). You are right, it appears not aligned in TrackVis and did not display anything in FreeSurfer. To make the tractogram displayable in FreeSurfer and loadable by nibabel.streamlines.load I used TractConverter which provides an option to provide a spatial reference, it seems to write a matrix in the TRK file header. If you want to look at it I have sent you a snapshot of TrackVis with the original TRK, and a snapshot of FreeSurfer freeview after running tractconverter (python TractConverter.py -i fibers.trk -o fibers2.trk -a nodif_brain.nii.gz) along with the fibers. Thank you Sent: Wednesday, April 05, 2017 at 3:50 PM From: "Neher, Peter" <[email protected]> To: "Alexandre Dupoint" <[email protected]>, "[email protected]" <[email protected]> Subject: AW: [mitk-users] Convert tractography tracts to trk / tck formats ?I just tested it using the current MITK master and nibabel ?2.1.0. Everything works fine when either saving directly as .trk or using MitkFileFormatConverter. I simply used "nib.trackvis.read(filename)". What version of nibabel and MITK are you using? As for your alignment issues, I did not test mrview because MITK can not save .tck files. I tried freeview, but there the fibers did not display at all, while throwing no error. I am currently downloading trackvis (waiting for the registration email) for further testing. Peter ? ________________________________ Von: Neher, Peter Gesendet: Mittwoch, 5. April 2017 14:52 An: Alexandre Dupoint; [email protected] Betreff: AW: [mitk-users] Convert tractography tracts to trk / tck formats ?Hi Alexandre, simply saving the results as .trk files should work. I did not encounter the nibabel issue with a missing voxel_to_ras matrix yet, but I will look into it. Could you send me a sample trk file that I can use to reproduce the error? Cheers, peter ? ________________________________ Von: Alexandre Dupoint <[email protected]> Gesendet: Mittwoch, 5. April 2017 14:12 An: [email protected] Betreff: [mitk-users] Convert tractography tracts to trk / tck formats Hi I have tractograms (.fib) generated with MITK Gibbs Tracking that I would like to convert to TRK (or TCK) to be able to look at them with other tools. I have tried many things but I haven't been able to generate TRK files where tracks align with the associated diffusion data when opening with tools like Freeview (FreeSurfer), mrview (MRtrix) or TrackVis Some of the things I tried: - converting with TractConverter (https://github.com/MarcCote/tractconverter) using the diffusion data as spatial reference - converting to TRK with MitkFileFormatConverter.sh: when loading with nibabel it complains about a missing voxel_to_ras matrix - converting the .fib to a parsable text file with Paraview, parsing this text file to generate a Nibabel tractogram and associating it with affine matrix of the diffusion data to create a TRK file I also tried to apply transformations on the streamlines and tried to edit header informations like RAS to LPS but I don't have a good enough understanding of the subject to get the tracks aligned with diffusion. I hope someone can give me a hint. Thank you. ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ mitk-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mitk-users
