mrc#
Classes:
Data:
Map from EPU voxelType values to integer data types |
Functions:
|
Read a .mrc file at the given file into a numpy array. |
|
Write the given ndarray data to a file. |
- class Header#
MRC file header
Attributes:
Integer-representation of MRC data type
Number of symbols in the symbol table following the header.
Number of pixels in x dimension
Number of pixels in y dimension
Number of pixels in z dimension
Location of image origin
Total size of X axis (e.g., in Angstroms)
Total size of Y axis (e.g., in Angstroms)
Total size of Z axis (e.g., in Angstroms)
Methods:
__new__(_cls, nx, ny, nz, datatype, xlen, ...)Create new instance of Header(nx, ny, nz, datatype, xlen, ylen, zlen, origin, nsymbt)
- static __new__(_cls, nx: int, ny: int, nz: int, datatype: DT, xlen: float, ylen: float, zlen: float, origin: Tuple[float, float, float], nsymbt: int)#
Create new instance of Header(nx, ny, nz, datatype, xlen, ylen, zlen, origin, nsymbt)
- nsymbt: int#
Number of symbols in the symbol table following the header. Each symbol is 1024 bytes.
- nx: int#
Number of pixels in x dimension
- ny: int#
Number of pixels in y dimension
- nz: int#
Number of pixels in z dimension
- origin: Tuple[float, float, float]#
Location of image origin
- xlen: float#
Total size of X axis (e.g., in Angstroms)
- ylen: float#
Total size of Y axis (e.g., in Angstroms)
- zlen: float#
Total size of Z axis (e.g., in Angstroms)
- VOXEL_TYPES = {'16 BIT FLOAT': DT.FLOAT16, '32 BIT FLOAT': DT.FLOAT32, 'SIGNED 16 BIT INTEGER': DT.INT16, 'UNSIGNED 16 BIT INTEGER': DT.UINT16, 'UNSIGNED 8 BIT INTEGER': DT.UINT8}#
Map from EPU voxelType values to integer data types
- read(file: str | PurePath | IO[bytes]) Tuple[Header, NDArray]#
Read a .mrc file at the given file into a numpy array. Returns the MRC header and the resulting array.
- Parameters:
file (str | Path | IO) – MRC file path or handle.
- Returns:
The MRC header and MRC data as a numpy array.
- Return type:
tuple[Header, NDArray]
- write(file: str | PurePath | IO[bytes], data: NDArray, psize: float)#
Write the given ndarray data to a file. Specify a pixel size for the mrc file as the last argument.
- Parameters:
file (str | Path | IO) – File path or handle to write.
data (NDArray) – 2D or 3D numpy array of MRC data.
psize (float) – Pixel size to write into MRC.