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

    navis.symmetrize_brain¶

    navis.symmetrize_brain(x, template, via='auto', verbose=False)[source]¶

    Symmetrize 3D object (neuron, coordinates).

    The way this works is by:
    1. Finding the closest mirror transform (unless provided)

    2. Mirror data on the left-hand-side to the right-hand-side using the proper (warp) mirror transform to offset deformations

    3. Simply flip that data back to the left-hand-side

    This works reasonably well but may produce odd results around the midline. For high quality symmetrization you are better off generating dedicated transform (see navis-flybrains for an example).

    Parameters:
    • x (Neuron/List | Volume/trimesh | numpy.ndarray | pandas.DataFrame) – Data to transform. Dataframe must contain ['x', 'y', 'z'] columns. Numpy array must be shape (N, 3).

    • template (str | TemplateBrain) – Source template brain space that the data is in. If string will be searched against registered template brains.

    • via ("auto" | str) – By default (“auto”) it will find and apply the closest mirror transform. You can also specify a template that should be used. That template must have a mirror transform!

    Returns:

    Same object type as input (array, neurons, etc) but hopefully symmetrical.

    Return type:

    xs

    Examples

    This example requires the flybrains library to be installed: pip3 install flybrains

    >>> import navis
    >>> import flybrains
    >>> # Get the FAFB14 neuropil mesh
    >>> m = flybrains.FAFB14.mesh
    >>> # Symmetrize the mesh
    >>> s = navis.symmetrize_brain(m, template='FAFB14')
    >>> # Plot side-by-side for comparison
    >>> m.plot3d()                                              
    >>> s.plot3d(color=(1, 0, 0))                               
    

    Back to top

    Source

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