flywire_leaves | R Documentation |
This workhorse function underlies the ability to define synaptic connections and neurotransmitter predictions for flywire neurons.
flywire_leaves(
x,
cloudvolume.url = NULL,
integer64 = FALSE,
mip = 0L,
bbox = NULL,
cache = TRUE,
...
)
x |
One or more FlyWire segment ids |
cloudvolume.url |
URL for CloudVolume to fetch segmentation image data. The default value of NULL chooses the flywire production segmentation dataset. |
integer64 |
Whether to return ids as integer64 type (the default, more
compact but a little fragile) rather than character (when |
mip |
The mip level for the segmentation (expert use only) |
bbox |
The bounding box within which to find supervoxels (default =
|
cache |
Whether to cache the results of flywire_leaves calls. See details. |
... |
Additional arguments passed to |
By default repeated calls to flywire_leaves
are cached on
disk. This functionality is provided by the cachem
package now used
by the memoise
package. By default the cache will expand up to 1.5GB
and then start pruning on a least recently used basis (LRU). 1.5GB might
store 10-20,000 results for flywire_leaves
calls depending on the
size of the corresponding neurons.
Since each root id can map to hundreds of thousands of supervoxel ids, there are space implications. In order to save space, the results are stored as compressed 64 bit integers (which are ~30x smaller than character vectors). The compression step does add an extra ~ 5 but is 100x + faster on a cache hit. The default compression is based on the suggested brotli library if available, gzip otherwise.
There is functionality for a memory cache on top of the disk cache, but this is not currently exposed as the disk read time appears small compared with the time for uncompressing and other overheads.
The cache can be controlled by two package options:
fafbseg.cachedir
The location on disk. If not previously set,
it is set to an appropriate user folder on package load using
rappdirs::user_data_dir
. Note that the cache for
this function will be located inside a folder called flywire_leaves
.
fafbseg.flcachesize
The maximum cache size in bytes. When the
storage space exceeds this results are pruned using a LRU algorithm.
Defaults to 1.5 * 1024^3
when unset.
Note that the default configuration means that the cache will be shared for
a given user across R sessions. It is worth bearing in mind the possibility
of race conditions if multiple applications are writing/pruning the cache.
For example if the fafbseg.flcachesize
has different values in
different sessions, the session with the smallest value will start pruning
files on disk before the other session.
Other flywire-ids:
flywire_islatest()
,
flywire_last_modified()
,
flywire_latestid()
,
flywire_rootid()
,
flywire_updateids()
,
flywire_xyz2id()
kcid="720575940623755722"
length(flywire_leaves(kcid))
## Not run:
# developer function to check cache status
fafbseg:::flywire_leaves_cache_info()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.