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

    navis.read_nrrd¶

    navis.read_nrrd(f, threshold=None, include_subdirs=False, parallel='auto', output='voxels', errors='log', **kwargs)[source]¶

    Create Neuron/List from NRRD file.

    See here for specs of NRRD file format including description of the headers.

    Parameters:
    • f (str | iterable) – Filename(s) or folder. If folder, will import all .nrrd files.

    • threshold (int | float | None) – For output='dotprops' only: a threshold to filter low intensity voxels. If None, no threshold is applied and all values > 0 are converted to points.

    • include_subdirs (bool, optional) – If True and f is a folder, will also search subdirectories for .nrrd files.

    • parallel ("auto" | bool | int,) – Defaults to auto which means only use parallel processing if more than 10 NRRD files are imported. Spawning and joining processes causes overhead and is considerably slower for imports of small numbers of neurons. Integer will be interpreted as the number of cores (otherwise defaults to os.cpu_count() - 2).

    • output ("voxels" | "dotprops" | "raw") – Determines function’s output. See Returns for details.

    • errors ("raise" | "log" | "ignore") – If “log” or “ignore”, errors will not be raised but instead empty neuron will be returned.

    • **kwargs – Keyword arguments passed to navis.make_dotprops() if output='dotprops'. Use this to adjust e.g. the number of nearest neighbors used for calculating the tangent vector by passing e.g. k=5.

    Return type:

    Union[NeuronList, TreeNeuron, BaseNeuron, MeshNeuron]

    Returns:

    • navis.VoxelNeuron – If output="voxels" (default): requires NRRD data to be 3-dimensional voxels. VoxelNeuron will have NRRD file header as .nrrd_header attribute.

    • navis.Dotprops – If output="dotprops": requires NRRD data to be either:

      • (N, M, K) (i.e. 3D) in which case we will turn voxels into a point cloud (see also threshold parameter)

      • (N, 3) = x/y/z points

      • (N, 6) = x/y/z points + x/y/z vectors

      • (N, 7) = x/y/z points + x/y/z vectors + alpha

      Dotprops will contain NRRD header as .nrrd_header attribute.

    • navis.NeuronList – If import of multiple NRRD will return NeuronList of Dotprops/VoxelNeurons.

    • (image, header) (np.ndarray, OrderedDict) – If output='raw' return raw data contained in NRRD file.

    Back to top

    Source

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