Repository navigation
Conversation
- add dependency explicitly (previously included implicitly via properties->roi->image->header), - and remove duplicate include.
…and adapt commands accordingly.
…ion from streamline-reading. Introduce properties_consensus method, based on tckedit's current implementation, to find a consensus between multiple header information. Extend Tractography::Reader to support multiple tracks files by default (and associated weights files).
|
Apparently the syntax test failed; not sure what this entails or how to fix it? |
This is the relevant info: Also, I'm not sure you were entirely aware, but we add new features first via the |
|
@thijsdhollander I created a new PR #1571 to merge with the |
|
You can actually change the base branch of the existing pull request to obtain more or less the same result. No worries though; the new pull request will work just as well. If everything's sitting there now, feel free to close this pull request to avoid confusion. |
|
...I'll simply already go ahead and close this one; but feel free to re-open if I missed something. |
This PR is an enhancement of the existing code to support multiple input
.tckfiles for commands that currently accept.tckfiles:.lst(for "list"), containing one filename per line. These can be used either in place of.tckarguments, or in place of weights files (e.g. option-tck_weights_in)..lstfiles are not involved.Implementation
The changes mainly consist in a re-write of the class
Tractography::Reader, which now holds astd::vectorof tracks filenames (and optionally of weights filenames too). TheReaderInterfaceis preserved: theoperator()method implemented inReadersimply reads the data off the currently open file(s), and switches to the next file(s) when reaching EOF.The main challenge in this implementation is to find a consensus between the headers of the multiple
.tckfiles. The proposed implementation mimicks the strategy currently found intckedit, namely:countandtotal_count;"variable"in case of conflict.In addition, the proposed consensus fails if the datatypes varies across files.
Limitations
The intention behind the changes introduced is to avoid unnecessary merge operations, and to provide a seamless capability to handle multiple tracks sources in input. This does not apply to the output;
.lstfiles will not be recognised as output arguments, and any output will still be written to a single file (as before).This can be seen as a limitation, espectially when the output is meant to be used as an input to a subsequent command. For example, in the case of
tcksift2followed bytck2connectome, when the output weights are used to compute a structural connectome matrix. In that case, at present, the weights file must be manually split into as many files as present in the.lstfile; and a new.lstfile must be created, listing the previous split weights files, and fed to the-tck_weights_inoption. This is relatively easy to implement in Python, and I would be happy to provide an example if needed.Alternatively, a split-output behaviour could potentially be implemented within the
Writerclass, by specifying output names within an.lstfile as well (although this might not be relevant for all commands, and implementing a distinction might be cumbersome).Possible future work
The consensus implemented in
tckeditshould be replaced with the new implementation intractography/file_base.The changes introduced make the implementations of
Tractography::Editing:LoaderandTractography::Mapping::Loadersomewhat redundant. I think these loader-classes should be merged into a single implementation, in order to assess whether or not they are really needed, given the new capabilities ofTractography::Reader.