Saving to disk#

VoxelImage objects support both importing from and exporting to common digital rock formats, ensuring flexibility in data handling. These functionalities facilitate compatibility with other software tools, enable seamless data sharing, and support further analysis outside the RockVerse framework.

rockverse.voxel_image.VoxelImage.save(self, store, **kwargs)#

Parallel CPU

Save a copy of the voxel image to the local file system.

This method supports rechunking by passing chunks in **kwargs. Notice that while data access is parallel, data writing is serial to ensure correct rechunking.

Parameters:
  • store (str) – Path to the exported file in the file system.

  • **kwargs – Additional keyword arguments to be passed to the underlying creation function.

Returns:

The function does not return any objects; it writes a copy to the file system.

Return type:

None

rockverse.voxel_image.VoxelImage.export_raw(self, filename, dtype=None, order='F', byteorder='=', write_fiji_macro=False)#

Parallel CPU

Export a voxel image to a raw file and corresponding metadata to a JSON file.

This method exports the voxel image data into a raw binary file specified by filename. Corresponding metadata is saved in a JSON file with the same name as the raw file but with a .json extension.

Parameters:
  • filename (str) – Path to the exported raw file in the file system.

  • dtype ({None, Numpy dtype}, optional) –

    Data type to be used in the exported raw file. If None, the original image data type will be used. Boolean types will be cast to unsigned 8-bit integers in the exported file.

    Warning

    Pay attention when setting dtype, as there is no internal check to ensure that the exported data will be correctly cast from the original array dtype.

  • order ({'C', 'F'}, optional) – The order of the exported raw array layout: ‘C’ for C-style (most rapidly changing index last), ‘F’ for Fortran-style (most rapidly changing index first). Use ‘F’ when exporting to Fiji/ImageJ. Default is ‘F’.

  • byteorder ({'<', '>', '='}, optional) – Byte order for the exported raw data. This parameter has precedence over the dtype parameter. Use '<' to force little-endian, '>' to force big-endian, or '=' to keep the original byte order. Default is '='.

  • write_fiji_macro (bool, optional) – If True, writes a convenience macro file (<filename>.ijm) for opening the exported raw file in ImageJ/Fiji. In this case, byte size in dtype must be up to 64 bits, and array order must be in Fortran-style. Default is False.

Raises:

ValueError – If the array order is not ‘F’ when write_fiji_macro is True. If the byte size in dtype exceeds 64 bits when write_fiji_macro is True.