navis 1.4.0
  • Install
  • Quickstart
  • Tutorials
  • API
  • Changelog
  • Github
  • Ecosystem
  • Site
    • Page
        • navis.write_precomputed
          • write_precomputed()

    navis.write_precomputed¶

    navis.write_precomputed(x, filepath=None, write_info=True, write_manifest=False, radius=False)[source]¶

    Export skeletons or meshes to neuroglancer’s (legacy) precomputed format.

    Note that you should not mix meshes and skeletons in the same folder!

    Follows the formats specified here.

    Parameters:
    • x (TreeNeuron | MeshNeuron | Volume | Trimesh | NeuronList) – If multiple neurons, will generate a file for each neuron (see also filepath). For use in neuroglancer coordinates should generally be in nanometers.

    • filepath (None | str | list, optional) – If None, will return byte string or list of thereof. If filepath will save to this file. If path will save neuron(s) in that path using {x.id} as filename(s). If list, input must be NeuronList and a filepath must be provided for each neuron.

    • write_info (bool) – Whether to also write a JSON-formatted info file that can be parsed by e.g. neuroglancer. This only works if inputs are either only skeletons or only meshes!

    • write_manifest (bool) – For meshes only: whether to also write manifests. For each mesh we will create a JSON-encoded {id}:0 file that contains a “fragments” entry that maps to the actual filename. Note that this will not work on Windows because colons aren’t allowed in file names and on OSX the colon will show up as a / in the Finder.

    • radius (bool) – For TreeNeurons only: whether to write radius as additional vertex property.

    Return type:

    None

    Returns:

    • None – If filepath is not None.

    • bytes – If filepath is None.

    See also

    navis.read_precomputed()

    Import neurons from neuroglancer’s precomputed format.

    navis.write_mesh()

    Write meshes to generic mesh formats (obj, stl, etc).

    Examples

    Write skeletons:

    >>> import navis
    >>> n = navis.example_neurons(3, kind='skeleton')
    >>> navis.write_precomputed(n, tmp_dir)
    

    Write meshes:

    >>> import navis
    >>> n = navis.example_neurons(3, kind='mesh')
    >>> navis.write_precomputed(n, tmp_dir)
    

    Write directly to zip archive:

    >>> import navis
    >>> n = navis.example_neurons(3, kind='skeleton')
    >>> navis.write_precomputed(n, tmp_dir / 'precomputed.zip')
    

    Back to top

    Source

    © Copyright 2018, Philipp Schlegel.
    Created using Sphinx 5.3.0.