Piping going wrong

no solution yet for the eddy_options " " problem yet, but there is a fix for the [VGL error when piping.

mrconvert b0_PA/ - | grep -v [VGL] | mrmath - mean mean_b0_PA.mif -axis 3

Yea, it’s more of a hotfix, but better than nothing.
M.

Now that’s what I call a hack… :crazy_face:

Bear in mind you don’t technically need to use piping, it’s just there to avoid storing temporary images that you then need to delete later. You can easily just run:

mrconvert b0_PA/ tmp.mif
mrmath tmp.mif mean mean_b0_PA.mif -axis 3

Although I must admit, I’m not sure why piping was ever required for this particular set of commands, given that mrmath will happily accept the DICOM input directly (along with all other MRtrix commands) – dunno how I’ve missed that bit till now (we’ll add it to the list of things to fix…):

mrmath b0_PA/ mean mean_b0_PA.mif -axis 3

Assuming the issue is that the wrapper script fails to insert the requisite quotes, then you could try double-escaping that leading whitespace, e.g. something like:

... -eddy_options "\\ --slm=linear"

There’s a chance that might get around it.

Also worth noting that if that is indeed the issue, then that script will also cause problems with any filenames that contain spaces (or other characters that are normally interpreted by the shell). It would definitely be worth fixing!

The m3 help team wrote me they think they solved the “ problem. It does run now. But if read their email correct so far they only fixed for the 3.0.1 but haven’t applied it to the 3.0.2 version, but promised to do so on Monday.
So looks like that one is fixed,
Though for 3.0.2 has CUDA working on M3, so it’s much more attractive for me.
So think early next week it should finally all work properly…

Somewhat unrelated bragging of why I do all that: The second attempt of the ANTs non linear template alignment running over the last few days should complete sometime over the weekend, too.
Looking forward to see how integrating 5h of DWI scanning looks like …
I guess all in all a good outcome for mid term break.
M.

1 Like

And interesting to know mrmath works with Dicom…
Yea of course piping can be circumvented. But I just wanted to be sure all is working o.k. and the failure of piping could either me doing it wrong or something broken.
Neither good options…
Same with the eddy options and “. I could have circumvented it. But again, that could have cost me later.
M.

We quite often see people immediately running mrconvert on their DICOMs as the very first step. Maybe it’s due to familiarity with using other packages, where one tool is used to get from DICOM to “something else” and then the image processing operations operate on the “something else”. But with MRtrix3, all commands are compatible with all image formats that MRtrix3 has the code to support; DICOM just happens to be one of those formats.
https://mrtrix.readthedocs.io/en/latest/getting_started/image_data.html#supported-image-formats

Hi

I am trying to work through the BATMAN tutorial and got stuck on this screenshot.

First I ran,
dwiextract dwi_den_unr.mif - -bzero | mrmath - mean mean_b0_AP.mif -axis 3
That works.

Then I proceeded with the command above (took your edits into account and getting the following):

$ mrconvert b0_PA/ - | mrmath - mean mean_b0_PA.mif -axis 3
mrconvert: [ERROR] unknown format for image "b0_PA/"
mrconvert: [ERROR] error opening image "b0_PA/"
mrmath: [ERROR] no filename supplied to standard input (broken pipe?)
mrmath: [ERROR] error opening image "-"

Not sure what I am doing wrong. Any suggestions?

Thank you,
Cherise.

:thinking: no idea – other than there being no b0_PA folder in your current working directory…?

It was a silly error. Got it.

1 Like