Skip to content

microns

Fetch neuron meshes.

Notes

Synapses will be attached to the closest vertex on the mesh.

PARAMETER DESCRIPTION
x
        Segment ID(s). Multiple Ids can be provided as list-like.

TYPE: str | int | list-like

lod
        Level of detail. Higher ``lod`` = coarser. This parameter
        is ignored if the data source does not support multi-level
        meshes.

TYPE: int DEFAULT: 2

with_synapses
        If True will also attach synapses as ``.connectors``.

TYPE: bool DEFAULT: True

datastack
        Which dataset to query. "cortex65", "cortex35" and "layer 2/3"
        are internally mapped to the corresponding sources: for example,
        "minnie65_public" for "cortex65"

TYPE: "cortex65" | "cortex35" | "layer 2/3" | str DEFAULT: 'cortex65'

materialization
        Which materialization version to use to look up somas and synapses
        (if applicable). If "auto" (default) will try to find the most
        recent version that contains the given root IDs. If an
        integer is provided will use that version.

TYPE: auto | int DEFAULT: 'auto'

parallel
        If True, will use parallel threads to fetch data.

TYPE: bool DEFAULT: True

max_threads
        Max number of parallel threads to use.

TYPE: int DEFAULT: 4

**kwargs
        Keyword arguments are passed through to the initialization
        of the ``navis.MeshNeurons``.

DEFAULT: {}

RETURNS DESCRIPTION
navis.Neuronlist

Containing :class:navis.MeshNeuron.

Source code in navis/interfaces/microns.py
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
def fetch_neurons(
    x,
    *,
    lod=2,
    with_synapses=True,
    datastack="cortex65",
    materialization="auto",
    parallel=True,
    max_threads=4,
    **kwargs,
):
    """Fetch neuron meshes.

    Notes
    -----
    Synapses will be attached to the closest vertex on the mesh.

    Parameters
    ----------
    x :             str | int | list-like
                    Segment ID(s). Multiple Ids can be provided as list-like.
    lod :           int
                    Level of detail. Higher ``lod`` = coarser. This parameter
                    is ignored if the data source does not support multi-level
                    meshes.
    with_synapses : bool, optional
                    If True will also attach synapses as ``.connectors``.
    datastack :     "cortex65" | "cortex35" | "layer 2/3" | str
                    Which dataset to query. "cortex65", "cortex35" and "layer 2/3"
                    are internally mapped to the corresponding sources: for example,
                    "minnie65_public" for "cortex65"
    materialization : "auto" | int
                    Which materialization version to use to look up somas and synapses
                    (if applicable). If "auto" (default) will try to find the most
                    recent version that contains the given root IDs. If an
                    integer is provided will use that version.
    parallel :      bool
                    If True, will use parallel threads to fetch data.
    max_threads :   int
                    Max number of parallel threads to use.
    **kwargs
                    Keyword arguments are passed through to the initialization
                    of the ``navis.MeshNeurons``.

    Returns
    -------
    navis.Neuronlist
                    Containing :class:`navis.MeshNeuron`.

    """
    client = get_cave_client(_translate_datastack(datastack))
    return cave_utils.fetch_neurons(
        x,
        lod=lod,
        with_synapses=with_synapses,
        client=client,
        parallel=parallel,
        max_threads=max_threads,
        materialization=materialization,
        **kwargs,
    )

Get caveclient for given datastack.

PARAMETER DESCRIPTION
datastack
        Which dataset to query. "cortex65", "cortex35" and "layer 2/3"
        are internally mapped to the corresponding sources: for example,
        "minnie65_public" for "cortex65"

TYPE: "cortex65" | "cortex35" | "layer 2/3" | str DEFAULT: 'cortex65'

Source code in navis/interfaces/microns.py
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
def get_cave_client(datastack="cortex65"):
    """Get caveclient for given datastack.

    Parameters
    ----------
    datastack :     "cortex65" | "cortex35" | "layer 2/3" | str
                    Which dataset to query. "cortex65", "cortex35" and "layer 2/3"
                    are internally mapped to the corresponding sources: for example,
                    "minnie65_public" for "cortex65"

    """
    if not CAVEclient:
        raise ModuleNotFoundError(err_msg)

    # Try mapping, else pass-through
    datastack = _translate_datastack(datastack)
    client = cave_utils.get_cave_client(datastack)
    client.materialize.nucleus_table = NUCLEUS_TABLE
    return client

Fetch voxels making a up given root ID.

PARAMETER DESCRIPTION
x
        A single root ID.

TYPE: int

mip
        Scale at which to fetch voxels. Lower = higher resolution.

TYPE: int DEFAULT: 0

bounds
        Bounding box [xmin, xmax, ymin, ymax, zmin, zmax] in voxel
        space. For example, the voxel resolution for mip 0
        segmentation is 8 x 8 x 40 nm.

TYPE: list DEFAULT: None

datastack
        Which dataset to query. "cortex65", "cortex35" and "layer 2/3"
        are internally mapped to the corresponding sources: for example,
        "minnie65_public" for "cortex65"

TYPE: "cortex65" | "cortex35" | "layer 2/3" | str DEFAULT: 'cortex65'

RETURNS DESCRIPTION
voxels

In voxel space according to mip.

TYPE: (N, 3) np.ndarray

Source code in navis/interfaces/microns.py
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
def get_voxels(x, mip=0, bounds=None, datastack="cortex65"):
    """Fetch voxels making a up given root ID.

    Parameters
    ----------
    x :             int
                    A single root ID.
    mip :           int
                    Scale at which to fetch voxels. Lower = higher resolution.
    bounds :        list, optional
                    Bounding box [xmin, xmax, ymin, ymax, zmin, zmax] in voxel
                    space. For example, the voxel resolution for mip 0
                    segmentation is 8 x 8 x 40 nm.
    datastack :     "cortex65" | "cortex35" | "layer 2/3" | str
                    Which dataset to query. "cortex65", "cortex35" and "layer 2/3"
                    are internally mapped to the corresponding sources: for example,
                    "minnie65_public" for "cortex65"

    Returns
    -------
    voxels :        (N, 3) np.ndarray
                    In voxel space according to `mip`.

    """
    return cave_utils.get_voxels(
        x, mip=mip, bounds=bounds, client=get_cave_client(datastack)
    )