# Piping going wrong

**URL:** <https://community.mrtrix.org/t/piping-going-wrong/4163>\
**Category:** Uncategorized\
**Created:** [October 8, 2020, 12:08am UTC](https://community.mrtrix.org/t/piping-going-wrong/4163 "2020-10-08T00:08:13Z")\
**Posts on this page:** 8\
**Page:** 2

<div class="post-metadata">

**Author:** ![mschira](https://community.mrtrix.org/user_avatar/community.mrtrix.org/mschira/32/2917_2.png) [@mschira](https://community.mrtrix.org/u/mschira)\
**Post date:** [October 9, 2020, 5:10am UTC](https://community.mrtrix.org/t/piping-going-wrong/4163/21 "2020-10-09T05:10:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jdtournier](https://community.mrtrix.org/user_avatar/community.mrtrix.org/jdtournier/32/2594_2.png) [@jdtournier](https://community.mrtrix.org/u/jdtournier)\
**Post date:** [October 9, 2020, 7:55am UTC](https://community.mrtrix.org/t/piping-going-wrong/4163/22 "2020-10-09T07:55:14Z")

</div>

Now that’s what I call a hack… 🤪

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:

```auto
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…):

```auto
mrmath b0_PA/ mean mean_b0_PA.mif -axis 3

```

* * *

> [@mschira](#):
>
> no solution yet for the eddy\_options " " problem yet

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:

```auto
... -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!

---

<div class="post-metadata">

**Author:** ![mschira](https://community.mrtrix.org/user_avatar/community.mrtrix.org/mschira/32/2917_2.png) [@mschira](https://community.mrtrix.org/u/mschira)\
**Post date:** [October 9, 2020, 10:19am UTC](https://community.mrtrix.org/t/piping-going-wrong/4163/23 "2020-10-09T10:19:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mschira](https://community.mrtrix.org/user_avatar/community.mrtrix.org/mschira/32/2917_2.png) [@mschira](https://community.mrtrix.org/u/mschira)\
**Post date:** [October 9, 2020, 10:25am UTC](https://community.mrtrix.org/t/piping-going-wrong/4163/24 "2020-10-09T10:25:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rsmith](https://community.mrtrix.org/user_avatar/community.mrtrix.org/rsmith/32/2672_2.png) [@rsmith](https://community.mrtrix.org/u/rsmith)\
**Post date:** [October 12, 2020, 5:13am UTC](https://community.mrtrix.org/t/piping-going-wrong/4163/25 "2020-10-12T05:13:04Z")

</div>

> [@mschira](#):
>
> And interesting to know mrmath works with Dicom…

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](https://mrtrix.readthedocs.io/en/latest/getting_started/image_data.html#supported-image-formats)

---

<div class="post-metadata">

**Author:** ![cchin](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/c/e274bd/32.png) [@cchin](https://community.mrtrix.org/u/cchin)\
**Post date:** [October 12, 2020, 5:00pm UTC](https://community.mrtrix.org/t/piping-going-wrong/4163/26 "2020-10-12T17:00:16Z")

</div>

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):

```auto
$ 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.

---

<div class="post-metadata">

**Author:** ![jdtournier](https://community.mrtrix.org/user_avatar/community.mrtrix.org/jdtournier/32/2594_2.png) [@jdtournier](https://community.mrtrix.org/u/jdtournier)\
**Post date:** [October 12, 2020, 5:33pm UTC](https://community.mrtrix.org/t/piping-going-wrong/4163/27 "2020-10-12T17:33:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![cchin](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/c/e274bd/32.png) [@cchin](https://community.mrtrix.org/u/cchin)\
**Post date:** [October 12, 2020, 5:42pm UTC](https://community.mrtrix.org/t/piping-going-wrong/4163/28 "2020-10-12T17:42:14Z")

</div>

It was a silly error. Got it.

[Previous page](https://community.mrtrix.org/t/piping-going-wrong/4163.md?page=1)
