# Package request: MRC file reader and writer

**URL:** https://discourse.julialang.org/t/package-request-mrc-file-reader-and-writer/60121
**Category:** Package Announcements
**Tags:** question, packages
**Created:** [April 27, 2021, 6:40pm UTC](https://discourse.julialang.org/t/package-request-mrc-file-reader-and-writer/60121 "2021-04-27T18:40:30Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Guillawme](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/guillawme/32/30025_2.png) [@Guillawme](https://discourse.julialang.org/u/Guillawme)
#### Post date: [April 27, 2021, 6:40pm UTC](https://discourse.julialang.org/t/package-request-mrc-file-reader-and-writer/60121/1 "2021-04-27T18:40:30Z")

</div>

Hello there,

First of all, I hope package requests are appropriate here. I will try my best to make this request as constructive as can be. If requests are not appropriate, I apologize, and I won’t take it personally if the discussion gets closed.

I think it would be very beneficial to have a Julia package implementing reading and writing of files in the [MRC format](https://www.ccpem.ac.uk/mrc_format/mrc2014.php). One application of this format is to store 2D and 3D images from [cryogenic electron microscopy](https://en.wikipedia.org/wiki/Cryogenic_electron_microscopy). Since MRC files are images, it would probably make sense to integrate this package with [ImageIO.jl](https://github.com/JuliaIO/ImageIO.jl). Reading an MRC file should ideally give a simple 2D or 3D array, compatible with the image processing packages [already available in Julia](https://juliaimages.org/latest/).

There is a Python package to read MRC files into numpy arrays and write such arrays out to MRC files: [mrcfile](https://github.com/ccpem/mrcfile). So, I anticipate people will recommend using this package through PyCall.jl. This is probably possible, I have not tried, but it would be far from ideal since it entails having to manage a Python installation. The good part though is that this package’s license (3-clause BSD) allows drawing inspiration from it as much as one would need.

I would try to build a Julia package to read/write MRC files myself, but I am much too ignorant about too many things for this to be a tractable project: I don’t know enough Python to understand how the `mrcfile` package works, nor enough Julia to implement all this. So, if anybody would like to take on this project, I will be very happy to help: I can help design an API; I can provide MRC files for testing purposes (the [EMDB](https://www.ebi.ac.uk/pdbe/emdb/) is also a good resource); maybe I can even do some coding if you can walk me through the logic of the implementation like I’m 5 and give me pointers (happy to read documentation any time, if it helps accomplishing this).

Thank you in advance!

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [April 28, 2021, 12:18pm UTC](https://discourse.julialang.org/t/package-request-mrc-file-reader-and-writer/60121/2 "2021-04-28T12:18:01Z")

</div>

> [@Guillawme](#):
>
> give me pointers (happy to read documentation any time, if it helps accomplishing this).

The format looks fairly simple (header + data), search for [read binary file](https://discourse.julialang.org/search?q=read%20binary%20file) and similar. Just define a `struct` for the header, read that, etc.

---

<div class="post-metadata">

### Author: ![Guillawme](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/guillawme/32/30025_2.png) [@Guillawme](https://discourse.julialang.org/u/Guillawme)
#### Post date: [April 28, 2021, 6:43pm UTC](https://discourse.julialang.org/t/package-request-mrc-file-reader-and-writer/60121/3 "2021-04-28T18:43:44Z")

</div>

@Tamas_Papp thank you, but I posted this precisely because the file format and design of a reader, however simple they may be, are way beyond my programming skills. I have no formal background in computer science: I can use existing packages to do things at a high level, but not much else. And this is not the main thing I do for a living, so the time I can dedicate to learning this is unfortunately very limited; but I would be more than happy to be involved and learn if someone is interested in driving this project.

Since you quoted me partially, let me emphasize what came just before this quote in a way that better reflects my programming abilities:

> [@Guillawme](#):
>
> **maybe** I can even do some coding **if [someone] can walk me through** the logic of the implementation **like I’m 5**

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [April 29, 2021, 7:34am UTC](https://discourse.julialang.org/t/package-request-mrc-file-reader-and-writer/60121/5 "2021-04-29T07:34:25Z")

</div>

> [@Guillawme](#):
>
> this quote in a way that better reflects my programming abilities

I know some very bright kids around the age of 5–6, but none of them program in languages like Julia (they use Lego Mindstorms and Scratch). So if this truly reflects your programming skills, you may be in an impossible position.

I imagine that a package like this will be written if someone needs it, or is paid to do it. You will of course get help here if you ask questions.

---

<div class="post-metadata">

### Author: ![Guillawme](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/guillawme/32/30025_2.png) [@Guillawme](https://discourse.julialang.org/u/Guillawme)
#### Post date: [April 29, 2021, 9:20am UTC](https://discourse.julialang.org/t/package-request-mrc-file-reader-and-writer/60121/6 "2021-04-29T09:20:39Z")

</div>

I will try to get this started and will ask questions as I go, but it will be slow.

---

<div class="post-metadata">

### Author: ![feanor12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/feanor12/32/8212_2.png) [@feanor12](https://discourse.julialang.org/u/feanor12)
#### Post date: [April 29, 2021, 10:22am UTC](https://discourse.julialang.org/t/package-request-mrc-file-reader-and-writer/60121/7 "2021-04-29T10:22:48Z")

</div>

[Hyperspy](https://hyperspy.org/) can read/write it. I wrote a small wrapper using PyCall for a similar case to read DM3 files.

Supported formats: [Loading and saving data — HyperSpy 1.7.1 documentation](https://hyperspy.org/hyperspy-doc/current/user_guide/io.html)

Also [TiffImages.jl](https://github.com/tlnagy/TiffImages.jl) might provide some insights on how to write a file reader/writer.

---

<div class="post-metadata">

### Author: ![Guillawme](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/guillawme/32/30025_2.png) [@Guillawme](https://discourse.julialang.org/u/Guillawme)
#### Post date: [April 29, 2021, 1:04pm UTC](https://discourse.julialang.org/t/package-request-mrc-file-reader-and-writer/60121/8 "2021-04-29T13:04:53Z")

</div>

Very helpful, thank you.

---

<div class="post-metadata">

### Author: ![sethaxen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sethaxen/32/35604_2.png) [@sethaxen](https://discourse.julialang.org/u/sethaxen)
#### Post date: [January 25, 2023, 10:27pm UTC](https://discourse.julialang.org/t/package-request-mrc-file-reader-and-writer/60121/9 "2023-01-25T22:27:33Z")

</div>

I know this is a bit late, but I just registered [MRCFile.jl](https://github.com/sethaxen/MRCFile.jl), a Julia parser for MRC files.

---

<div class="post-metadata">

### Author: ![Guillawme](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/guillawme/32/30025_2.png) [@Guillawme](https://discourse.julialang.org/u/Guillawme)
#### Post date: [January 26, 2023, 8:18am UTC](https://discourse.julialang.org/t/package-request-mrc-file-reader-and-writer/60121/10 "2023-01-26T08:18:56Z")

</div>

Wonderful, thank you for letting me know! I am interested in reading MRC files to play around and learn, but didn’t have time to learn how to write a reader.
