{"name":"neurofly","display_name":"neurofly","visibility":"public","icon":"","categories":[],"schema_version":"0.2.1","on_activate":null,"on_deactivate":null,"contributions":{"commands":[{"id":"neurofly.segs_annotator","title":"Segs Annotator","python_name":"neurofly:Annotator","short_title":null,"category":null,"icon":null,"enablement":null},{"id":"neurofly.simple_viewer","title":"Simple Viewer","python_name":"neurofly:SimpleViewer","short_title":null,"category":null,"icon":null,"enablement":null},{"id":"neurofly.skel_annotator","title":"Skeleton Annotator","python_name":"neurofly:SkelAnnotator","short_title":null,"category":null,"icon":null,"enablement":null},{"id":"neurofly.neuron_seger","title":"Neuron Seger","python_name":"neurofly:NeuronSeger","short_title":null,"category":null,"icon":null,"enablement":null}],"readers":null,"writers":null,"widgets":[{"command":"neurofly.segs_annotator","display_name":"Segs Annotator","autogenerate":false},{"command":"neurofly.simple_viewer","display_name":"Simple Viewer","autogenerate":false},{"command":"neurofly.skel_annotator","display_name":"Skeleton Annotator","autogenerate":false},{"command":"neurofly.neuron_seger","display_name":"Neuron Seger","autogenerate":false}],"sample_data":null,"themes":null,"menus":{},"submenus":null,"keybindings":null,"configuration":[]},"package_metadata":{"metadata_version":"2.4","name":"neurofly","version":"0.1.4","dynamic":["license-file"],"platform":null,"supported_platform":null,"summary":"A framework to annotate single neurons at whole-brain scale","description":"# NeuroFly: A framework for single neuron reconstruction at whole-brain scale\n\nThis package provides tools for semi-automatic neuron reconstruction. Features based on deep learning, like image segmentation and deconvolution are implemented in [tinygrad](https://github.com/tinygrad/tinygrad), which can run on almost any GPU (NVIDIA, AMD, Apple, Qualcomm, Intel).\n\n<img src=\"https://github.com/beanli161514/neurofly/raw/main/assets/main.png\" width=\"640\">\n\n## Update\n\nOur transformer-based autonomous driving model is available now!\n\n\nPress shortcut 'd' to automatically extend segments.\n\n<img src=\"https://github.com/beanli161514/neurofly/raw/main/assets/autonomous.gif\" width=\"640\">\n\n## Installation\n\nInstall the latest version\n```\npip install --upgrade git+https://github.com/beanli161514/neurofly.git\n```\nor\n```\npip install neurofly\n```\n\nYou can also install from [napari hub](https://www.napari-hub.org/plugins/neurofly), using their plugin manager with GUI.\n\n## Dataset\n\nWe provide several expert-proofread reconstruction results for testing, model training, and evaluation. [Zenodo Link](https://zenodo.org/records/13328867)\n\n\n### Content of samples\n| name           | size  | species | label type  | imaging |\n|----------------|-------|---------|-------------|---------|\n| rm009_labeled  | 629MB | macaque | skeleton    | VISoR   |\n| mouse_labeled  | 260MB | mouse   | skeleton    | VISoR   |\n| z002_labeled   | 204MB | mouse   | skeleton    | VISoR   |\n| fmost_labeled  | 370MB | mouse   | skeleton    | fMOST   |\n| RM009_noisy_1  | 65MB  | macaque | morphology  | VISoR   |\n| RM009_noisy_2  | 65MB  | macaque | morphology  | VISoR   |\n| fmost_test     | 65MB  | mouse   | morphology  | fMOST   |\n| z002_dendrites | 768MB | mouse   | morphology  | VISoR   |\n| RM009_arbor_1  | 288MB | macaque | morphology  | VISoR   |\n| RM009_axons_1  | 600MB | macaque | morphology  | VISoR   |\n| RM009_axons_2  | 600MB | macaque | morphology  | VISoR   |\n| z002           | 8.92G | mouse   | morphology* | VISoR   |\n\n$*$ annotation in progress\n### Label format\nMorphology labels are graphs saved in SQLite database with 3 tables:\n|    segments    |  nodes  |  edges  |\n|:--------------:|:-------:|:-------:|\n|       sid      |   nid   |   src   |\n|     points     |  coord  |   des   |\n| sampled_points | creator |   date  |\n|                |  status | creator |\n|                |   type  |         |\n|                |   date  |         |\n|                | checked |         |\n\nSegments are results of the segmentation stage, they are used to generate initial nodes and edges.\n\n\n## Basic usage example\n\n<img src=\"https://github.com/beanli161514/neurofly/raw/main/assets/pipeline.png\" width=\"640\">\n\nNeuroFly packaged 4 napari plugins for image browsing, image segmentation, and data annotation.\n\n<img src=\"https://github.com/beanli161514/neurofly/raw/main/assets/menu.png\" width=\"320\">\n\n### Segmentation\n\nNeuroFly supports whole brain image saved in hierarchical data structures(ims, h5, and zarr) in [Imaris File Format](https://imaris.oxinst.com/support/imaris-file-format) and small image volumes saved in single-channel tiff format. Here we use a mouse brain in our dataset named z002.zarr.zip as example.\n\nThis brain is sparsely labeled, which means only a tiny puny part of neurons are lighted and imaged. To extract these foreground singals, you can use the provided command line interface 'seg'. We provide a default weight trained on images captured by VISoR and fMOST.\n```\nseg -i z002.zarr.zip -vis -d z002.db\n```\nor use the graphical interface\n\n<img align src=\"https://github.com/beanli161514/neurofly/raw/main/assets/neuron_seger.png\" width=\"200\">\n\n\nThis process may take about 10 hours depending on your you hardware configuration. When finished, you should see the extracted segments and a database file named z002.db in your working dictionary.\n\n\nAn image block with severe contamination and the segmentation result\n\n<img align src=\"https://github.com/beanli161514/neurofly/raw/main/assets/segmentation.gif\" width=\"640\">\n\n\n### Manual connection and proofreading\n\nLaunch annotation tool from napari menu, Plugin -> neurofly -> Segs Annotator\n\n#### Load data\nLoad image file (z002.zarr.zip) and database file (z002.db), then click **refresh panorama** button to show the panorama view.\n\n<img src=\"https://github.com/beanli161514/neurofly/raw/main/assets/overall.png\" width=\"600\">\n\n\n#### Select one node as start point of annotation\nIn panorama mode, you can easily identify sparse, bright signals that are promising for reconstruction. The silde bars 'short segs filter', 'length thres', and 'point size' can be adjusted to hide noise and short segments. \n\nIf you can clearly identify foreground segments, click on one of the conspicuous segments to select it as start point of annotation. Once selected, the id of picked node will be displayed at **node selection**. Then click 'switch mode' to switch to labeling mode, and the tasks will be generated automatically.\n\n\n#### Task generation\nGiven a selected node, task generator analyses its connected component and extract all unchecked terminal nodes. The tasks are designed very simple: Connect the center node with the surrounding nodes if there should be an edge. The criterion is whether the edge aligns well with the imaged neuron fibers.\n\n<img src=\"https://github.com/beanli161514/neurofly/raw/main/assets/task_generation.png\" width=\"480\">\n\n\n#### Node operations\n<img src=\"https://github.com/beanli161514/neurofly/raw/main/assets/labeling_mode.png\" width=\"480\">\n\nIn each task, a center node and nearby segments are rendered, you can add/remove nodes and edges to get a reasonable local structure.\n\n\nLeft click on nodes to add/remove an edge between it and the center node\n\n<img src=\"https://github.com/beanli161514/neurofly/raw/main/assets/add_edges.gif\" width=\"480\">\n\nRight click to remove a node\n\n<img src=\"https://github.com/beanli161514/neurofly/raw/main/assets/remove_nodes.gif\" width=\"480\">\n\nPress 'g' or use left panel to switch to 'image' layer, then right click to add points\n\n<img src=\"https://github.com/beanli161514/neurofly/raw/main/assets/add_nodes.gif\" width=\"480\">\n\nUse dropdown selection in right panel to add type label for center node.\n\n<img src=\"https://github.com/beanli161514/neurofly/raw/main/assets/change_type.gif\" width=\"480\">\n\n#### Deconvolution\n\nPress 'i' or click on 'deconvolution' to deconvolve the image\n\n<img src=\"https://github.com/beanli161514/neurofly/raw/main/assets/deconv.gif\" width=\"640\">\n\n\n#### Proofreading\n\nIf you find something wrong when labeling, for example, two somas are connected together. You can use proofreading mode to check the neuron branch by branch.\n<img src=\"https://github.com/beanli161514/neurofly/raw/main/assets/proofreading.gif\" width=\"640\">\n\n\n\n### Performance\nNeuroFly supports rendering of more than ten million points. (tested on M3 Macbook Air and RTX 3090 workstation)\n\n<img src=\"https://github.com/beanli161514/neurofly/raw/main/assets/dense.jpg\" width=\"640\">\n\n\n\n### Export as swc file\nSwitch to panorama mode, adjust 'length_thres' to filter out short segments and keep only complete neurons. Then press 'export swc files', each neuron will be saved as one .swc file in your working dictionary.\n\n\n<img src=\"https://github.com/beanli161514/neurofly/raw/main/assets/export.jpg\" width=\"640\">\n","description_content_type":"text/markdown","keywords":null,"home_page":null,"download_url":null,"author":null,"author_email":"Rubin Zhao <beanli161514@gmail.com>","maintainer":null,"maintainer_email":null,"license":"GPL-3.0-or-later","classifier":["Framework :: napari","Programming Language :: Python :: 3"],"requires_dist":["PyQt5","napari","Rtree","networkx","tqdm","magicgui","brightest-path-lib","tifffile","scikit-image","scipy","torch","tinygrad>=0.9.2","pathlib","h5py","zarr"],"requires_python":">=3.8","requires_external":null,"project_url":["Homepage, https://github.com/beanli161514/neurofly"],"provides_extra":null,"provides_dist":null,"obsoletes_dist":null},"npe1_shim":false}