Open Lestropie opened 4 years ago
Given the difficulty of the dwi2mask
task, having a script algorithm interface probably makes sense; the existing algorithm would not I expect be hard to re-implement in Python. For a registration-based method, having cross-correlation in mrregister
would be preferable. DeepBrain looks like it's T1w only; HD-BET apparently works on high-resolution T2-weighted, but would want to test it manually on some difficult DWIs before committing to wrapping it.
I should at some point try to write down the algorithm in my head, see if it's got any chance of working...
Bumping as registration just opened.
Bumping again as the hackathon repository is open for project proposals. It would be preferable for people to be able to read any proposals prior to the event next week.
Other things that came in from Twitter:
FC Yeh's bundle shape analysis
Vanderbilt MASI Lab WM atlases, preprocessing, labeling
Vertex-wise cortical similarity from a tractogram
Personally I'm concerned about the scope of most of the suggestions that have been listed: I'm limited in how much I can do myself in a given period of time, and a lot of proposals don't give a whole lot of opportunity for those not already developing with MRtrix3 to contribute.
Whether or not any other @MRtrix3/mrtrix3-devs are taking part may have an influence here.
mrcheckerboardmask
and integrate into mredit
Good to get to know API & nice new command (maybe more exciting than integration in existing commands? I don't know, just an idea.): mrnew
, a command to create a new empty image. Would e.g. come with a range of options to set basic properties (dimensions, sizes of dimensions, voxel size, transform, any other header entry, etc.. similar to the range of things you can change with mrconvert
for existing images), and option(s) to adopt these or some of these from header of a given other existing image. Maybe also option(s) to fill the new image with a single intensity. Guessing that would be the scope of it, as beyond that, you could imagine mredit
"takes over".
I can imagine a lot of useful applications of such a command in scripting; so it would be a nice addition to the toolkit. From hackathon point of view: it's pretty generic, doesn't require too much intricate or arcane diffusion MRI knowledge; also pretty flexible scope for hackathon, as there's a basic functionality but also a range of improvements possible, depending on time. Hope it helps.
Actually, now that I think of it, mrcheckerboardmask
's pattern could be one of the options to set the initial intensity.
mrnew
, a command to create a new empty image. Would e.g. come with a range of options to set basic properties (dimensions, sizes of dimensions, voxel size, transform, etc.), and option(s) to adopt these or some of these from header of a given other existing image.
When you have an existing "template" header, you can achieve this in a one-liner with mrcalc in.mif 0 -mult new.mif
, followed by the appropriate mrconvert
/ mrgrid
/ mredit
calls.
I can imagine a lot of useful applications of such a command in scripting; so it would be a nice addition to the toolkit.
Can you think of any where you would not already have a template header to start from?
mredit
: add an ODF simulation interface that uses a .csv file as input: location, amplitude and orientation to map SH delta functions to create ODFs. can be used to make pretty images or for debugging, research, DWI signal simulation, ...
- brain masking.
This could be a good "educational" project, and very useful given the issues we encounter regularly.
- not very exciting application but good to get to know the API: deprecate
mrcheckerboardmask
and integrate intomredit
It's a nice idea and very manageable in scope, but I agree it's not particularly thrilling.
Other things that came in from Twitter:
- FC Yeh's bundle shape analysis
- Vanderbilt MASI Lab WM atlases, preprocessing, labeling
- Vertex-wise cortical similarity from a tractogram
It sounds fun if there's already community interest for these. Do you have a preference and can you elaborate on the scope? Sorry I missed the Twitter discussion you refer to.
Personally I'm concerned about the scope of most of the suggestions that have been listed: I'm limited in how much I can do myself in a given period of time, and a lot of proposals don't give a whole lot of opportunity for those not already developing with MRtrix3 to contribute.
Whether or not any other @MRtrix3/mrtrix3-devs are taking part may have an influence here.
I would be happy to take part, but also limited in the time I can commit. I'm not sure I understand how it's going to work with the time zones. Presumably, you will sign up in the Asia/Pacific time "hacktrack"?
When you have an existing "template" header, you can achieve this in a one-liner with mrcalc in.mif 0 -mult new.mif, followed by the appropriate mrconvert / mrgrid / mredit calls.
Sure, as is the case for a lot of other functionality as well. The argument comes up every once in a while, and can be used at one's convenience to argue either way: "it's technically also possible with..." versus discoverability and common sense. Distracts from what could be a constructive exploration of an idea.
Can you think of any where you would not already have a template header to start from?
Many. I'll provide an example contributed by Max:
an ODF simulation interface that uses a .csv file as input: location, amplitude and orientation to map SH delta functions to create ODFs. can be used to make pretty images or for debugging, research, DWI signal simulation, ...
More broadly, anything to do with research and testing things via artificial data or similar experiments. Either an mrnew
(alternative name: mrcreate
, maybe fits better thematically with existing mredit
) command could create the empty image only, or it could come with categories of options to create (mrcreate
does sound nice) stuff. E.g. SH delta functions from .csv
file, tensors from .csv
file, raw intensities from .csv
file, etc... etc... When providing some data from .csv
files, it could in some cases even not (have to) require either template image or given dimensions (they might sometimes be implied from the .csv
data, e.g. simple conversion of intensities from .csv
to a new .mif
. People could leverage it to write scripts to generate entire phantoms, etc...
Similar to e.g. commands like mrcalc
, it's also naturally very extendable towards the future.
Each and every time I have to do this or get the question, I (recommend to) resort to the matlab export tool to generate a "new" image. Or work with pre-generated "new" images that are kept around just for this purpose; quite messy.
Finally, mrcheckerboardmask
fits nicely in it. Most straightforward way to see why it fits better with an mrcreate
rather than in mredit
is to read its synopsis.
I think that would address your questions. It's just a suggestion, because suggestions were welcomed..
brain masking.
FSL BET on the average b=0, for datasets where dwi2mask
doesn't work well. This works quite well for a lot of datasets.
(side note: can also be used to initialise dwibiascorrect
, if bias fields were the cause of dwi2mask
struggling, and then follow up with dwi2mask
)
You could make a dwifslbet
script. Then again, this is also possible with a one-liner followed by a BET call. Not sure if that matters though.
Visual QA.
Topic has come up a couple of times on the forum, with people looking for something akin to FSL's slicesdir
; more recently I'm thinking of fmriprep
's HTML output, and eddyqc
.
With 3.0.0
, the ability to export directly to PNG means that there's a reasonable amount that could be done even on a headless system without ever invoking mrview
; there are however more advanced things that could be done with mrview
if possible.
Unfortunately this sort of thing would be much better posed if the outputs of processing were stored in a BIDS Derivatives format, such that it'd be easy to find all the various bits of data. Without that you're relying on the command-line interface to provide whatever data are deemed requisite.
This topic could also be viewed at two different analysis levels:
Single-subject: Assessing DWI data directly, potentially ODF data.
Group: Generating metrics in population template space; things like mask coverage (maybe some way to identify which subjects are contributing to incomplete intersection mask coverage), variance in spatial warps, detection of outliers, maybe some kind of post-hoc assessment of mtnormalise
by warping the bias fields to template space and looking for correlations between per-subject bias field estimates and differences to FOD template
Even for those not adept at coding there's potentially a fair bit of scope here for coming up with different ideas.
.mif
or any other supported file directly in the terminal via the existing png export. Somewhat of an adaptation/extension of https://github.com/MIC-DKFZ/niicat (GPL2) for MRtrix?a tool to view .mif or any other supported file directly in the terminal
That would be very useful.
I must admit before my eyes got to the "existing png support" bit I thought you were talking about spitting out ASCII art from image data :man_facepalming:
Would be fractionally concerned about stepping on the shoes of niicat
, it's not that old and a unique idea. Plus eventually people would ask for it to be interactive :grimacing:
Yes, don't want to step on any shoes either. On the other side, niicat inherits key parts from other packages as well https://github.com/vnckppl/niipre https://github.com/fastai/fastai/blob/master/fastai/sixel.py. I think for us the step to display a png on the terminal is quite small as we have the file type and plotting support already built-in. In any case, I'd ask Jakob how he feels about incorporating this into MRtrix.
Alternatively, niicat supports displaying png. So a thin wrapper around niicat would also work, in particular as niicat currently has no options on what to display (centre of first volume) so that could be done with the wrapper. This makes it slightly harder to maintain and bundle though.
Another alternative is to add .mif support to nibabel. That'd make niicat compatible with .mif
Plus eventually people would ask for it to be interactive
That's an expectation management problem and if people need more functionality, adding options to the script would be a relatively easy way to contribute to MRtrix.
In any case, I'd ask Jakob how he feels about incorporating this into MRtrix.
@wasserth, how do you feel about incorporating this into MRtrix?
I am happy to hear that you find niicat useful. I also started using niicat a lot more since I am in home office.
Generally speaking it would be really nice to add .mif
support to nibabel. Then niicat could easily load it. I am working a lot in python and using nibabel to load images. If I come across a .mif
I always have to convert first which is a bit painful. So support in nibabel would be awesome.
If you want to wrap niicat in Mrtrix I am fine with that (as long as you mention where it comes from). You can also copy the code. It is not a lot. But I would still maintain the niicat pip package. If I am on a new server and want to view an image it is just a lot easier to quickly do pip install niicat
instead of having to install complete mrtrix.
Interactivity would be amazing but I do not really know how to do that. I guess that's not so easy.
Converting a mif to a png does not look too difficult. I could integrate this into niicat. But then it would only show one volume. Plotting from three different orientations and getting all the metadata from a mif would be a bit more work since I am not so familiar with mif. If you create a pull request or send me some code I would be happy to look over it. I guess the cleanest approach would be to add mif loading to nibabel. Not sure how much work that is.
@dchristiaens has implemented a .mif
IO python package https://github.com/dchristiaens/mrtrix3-pyio. It is currently not integrated into nibabel and from a quick glance at their code, I'd say it requires some time to figure out and adapt to nibabel's class structure.
Branching based on filetype is somewhat cumbersome but if you wanted to support .mif
with Daan's package, it is pretty straightforward to use:
image = load_mrtrix(iFile)
data = image.data # numpy array
lX, lY, lZ = data.shape[:3]
sX, sY, sZ = image.vox[:3]
transform = np.round(image.transform, decimals=2)
@dchristiaens has implemented a
.mif
IO python package https://github.com/dchristiaens/mrtrix3-pyio. It is currently not integrated into nibabel and from a quick glance at their code, I'd say it requires some time to figure out and adapt to nibabel's class structure.
I agree that having .mif
support in nibabel
would be nice. I briefly looked into this at the time I wrote the IO package (this must have been 2012/13), but ultimately opted for an independent package modelled on the MRtrix Matlab read/write functions. I remember also finding the class structure in nibabel
difficult to wrap my head around (entirely my fault, I am sure), and I was concerned about supporting custom header fields. The nibabel
code has probably evolved a great deal since, so it could be worth having another look.
I'm hoping to again attend the hackathon that runs prior to OHBM. This time around, I'd like to pre-register project ideas on their site well ahead of the event, to hopefully attract some interest and have some team members essentially ready to go from the start of the event.
Ideal projects would be those that:
Do not strictly rely on prior experience with either diffusion MRI or MRtrix3 (I can teach a little initially if necessary, but there's limited time);
That could nevertheless be contributed to by anyone who knows a little Python;
That is not so stale / esoteric that it would bore people;
That would hopefully have some measurable output in three days, even if not complete.
Open to ideas for either assignment of existing issues, or new ideas.
Initial list:
1868 (custom
tckgen
defaults)1741 (expand
dwicat
to account for within-protocol signal drift; might not be worth the effort if such correction is to be embedded within the SHARD recon, or would it still be of utility within that recon @dchristiaens?)1625 (keep
command_history
provenance when invoking a non-MRtrix3 command)Update deprecated FBA BIDS App (probably too optimistic)