This script converts MRC (Microscopy Data) files to PNG format. MRC files are commonly used in electron microscopy to store 3D volume data. Converting them to PNG format makes it easier to view and share the images.
- Converts MRC files to PNG format.
- Supports specifying root directory and wildcard patterns for MRC files.
- Allows reversing the order of frames and setting the resolution of the output PNG.
-
Download the compiled executable file:
dist/mrc2png
. -
In a terminal, navigate to where you downloaded
mrc2png
, then run:./mrc2png <root_dir> [options]
Replace
<root_dir>
with the path to the root directory containing the MRC files.-r, --reverse
: Reverse the order of frames.-s, --resolution <resolution>
: Set the resolution of the output PNG. Available options: "Full", "1920x1080", "1280x720", "640x480". Default: "Full".-p, --pattern <pattern>
: Specify a wildcard pattern for MRC files. Default:"*.mrc"
. For example,-p *preview.mrc
will only convert MRC files whose names end withpreview.mrc
.
-
For convenience, you can also add the executable file PATH to the end of your
~/.bashrc
:export PATH="path_to_your_executable_file":$PATH
Then restart the terminal and just use as:
mrc2png <root_dir> [options]
- Python 3.6+
- Required Python packages:
numpy
,mrcfile
,tifffile
,Pillow
-
Clone the repository:
git clone https://github.com/elemeng/mrc2png.git
-
Navigate to the repository directory:
cd mrc2png
-
Install the Rye package manager:
curl -sSf https://rye-up.com/get | bash
Download and run the installer from Rye Releases.
-
Install dependencies:
rye sync
-
Start coding!