Function write_json

pub fn write_json<P>(posvol: &Posvol, path: P) -> Result<(), Error>
where P: AsRef<Path>,
Expand description

Write Posvol data to a JSON file

Any posvol file read into a Posvol type may be written to JSON formats for inspection or analysis.

This is a direct serialization to a JSON string of the dimensions extracted from the file header, and a list of every cell for every sub-voxel region.

For a human readable text version see write_ascii_pretty(), or use for a direct conversion see write_ascii().

// Read the example file
let posvol = read_posvol_file("./data/posvol_example.bin").unwrap();

// Write a direct translation of the binary data to ASCII
write_json(&posvol, "./posvol.json");