Skip to content
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

dtiImportFibersMrtrix fails to parse track.tck header #86

Closed
soichih opened this issue Aug 26, 2017 · 8 comments
Closed

dtiImportFibersMrtrix fails to parse track.tck header #86

soichih opened this issue Aug 26, 2017 · 8 comments

Comments

@soichih
Copy link
Contributor

soichih commented Aug 26, 2017

I am trying to run app-life on output track.tck generated by brain-life/app-dipy-tracking (multishell tractograph with CSA) app.

When I run LiFE, I get following error message.

{�Error using dtiImportFibersMrtrix (line 76)
Unable to parse header for file ../59a09712682fb20024ca9af8/track.tck


Error in fgRead (line 39)
        fg = dtiImportFibersMrtrix(fgFile);

Error in feConnectomeInit (line 49)
  fg = fgRead(fgFileName);

Error in life (line 10)
fe = feConnectomeInit(config.dwi, ...

Here is the header contained inside the output track.tck.

$ head ../59a09712682fb20024ca9af8/track.tck
mrtrix tracks
count: 0000272259
datatype: Float32LE
file: . 67

It's short, but the structure looks OK? It could be missing some parameters that LiFE needs?

The brain-life/app-dipy-tracking creates track.tck by doing following.

https://github.com/brain-life/app-dipy-tracking/blob/master/main.py#L108

    tractogram = Tractogram(streamlines, affine_to_rasmm=affine)
    save(tractogram, 'track.tck')

It am not sure if this issue needs to be fixed by the tractography app, or the .tck file header parser used by LiFE.

@soichih
Copy link
Contributor Author

soichih commented Sep 15, 2017

@ccaiafa @Garyfallidis Please comment.

@ccaiafa
Copy link
Collaborator

ccaiafa commented Sep 16, 2017

Not clear idea what is happening. dtiImportFibersMrtrix is a VISTASOFT function, not part of LiFE.

@francopestilli
Copy link
Contributor

@soichih This is actually a trick question. I do not think Dipy can save .tck files. @Garyfallidis (I just realized this is all within Python/Dipy, so it is relevant to you.)

@soichih
Copy link
Contributor Author

soichih commented Sep 18, 2017

@francopestilli Here is the nibabel method that app-dipy-tracking is using to save the .tck file

http://nipy.org/nibabel/reference/nibabel.streamlines.html

app-life app then tries to load the .tck using Vistasoft dtiImportFiberMrtrix() and it fails with the error message.

My hunch is that, dtiImportFiberMrtrix() is having trouble parsing the count

count: 0000272259

I think nibabel should output this in following format instead.

count: 272259

So I think this could be nibabel issue. OR.. vistasoft can be updated to trim the leading 0000 and be able to handle such format.

@soichih
Copy link
Contributor Author

soichih commented Sep 18, 2017

Actually, I was wrong about the count format. vistasoft can parse it just fine.

The real issue is that dtiImportFiberMrtrix() requires step_size field to be present in the header, but nibabel is not outputting this field (and it looks like that's the only field that's missing)

I will open an issue with nibabel to see if they can add this field.

nipy/nibabel#553

@soichih
Copy link
Contributor Author

soichih commented Sep 19, 2017

Marc from nibabel says that step_size is an optional field, and I saw this issue was already addressed by Vistasoft (vistalab/vistasoft#164). They made it so that it assumes step_size to be 1 if it's not set, although I am not sure how safe that is..

Anyway, I just pulled the latest master branch of vistasoft, and tested it. I also just realized that, app-life needs dtiInit output (single shell) and app-dipy-tracking needs multi-shell dwi input.. So I can no longer run app-life against app-dipy-tracking output.

@soichih soichih closed this as completed Sep 19, 2017
@francopestilli
Copy link
Contributor

Do we need to make any in the code here?

@soichih
Copy link
Contributor Author

soichih commented Sep 19, 2017

No, I think everything should work fine as far as encode/app-life goes. I am recompiling the msa binary and docker container for app-life.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants