Closed draffelt closed 9 years ago
Great idea. If you look at the help page of any command, you see exactly that at the top on the version: last git tag on the tree, followed by the number of commits since that tag and the commit hash if it's not a clean tag, followed by 'dirty' if there were uncommitted files at compile time. I think it's available as the macro MRTRIX_VERSION or something like that... More than happy for it to be written to file too.
That's what gave me idea. And the fact that I was trying to trace what version of fixelcfestats I used for set of results.
Go for it. By the way, it doesn't need to be a comment. Give it its own entry (mrtrix_version?), it shouldn't interfere with anything else, and I have a feeling it'll also show in mrinfo.
Also worth adding the same for the track/tsf files (chuck it in the base class for these).
As I mentioned in issue #183, it might be worth modifying the NIfTI handling to output the version info into one of the NIfTI fields. The db_name
entry has 18 characters available, which is just too short for a full version string, which typically looks like 0.3.12-230-g902b3557
* - more specifically:
<most recent tag>-<commits since tag>-g<commit-hash>[-dirty]
and defaulting to the tag only if the commit is the tag.
In any case, it can be too long for the db_name
entry, so it'll probably have to go into the descrip
field, which is 80 characters.
This will mean we won't be able to store other comments in the NIfTI header, but to be honest that's not a big deal, we couldn't rely on this anyway since the amount of space available is pretty tight in NIfTI...
Sorry, felt like getting it done... I reckon the last two commits referenced above pretty much sort this one out. I'll close...
My guess is that most technical users of MRtrix will use the latest Git version instead of upgrading when a new version is released. Given that some of these users will also be developing their own commands, it could be useful to store the Git commit hash in the image header, so that you can always work out what version of code you used to generate a set of results.
In fact we could store the version number instead if the hash corresponds to a tag.
What do you think?