{"id":24563074,"url":"https://github.com/polarbean/deepslice","last_synced_at":"2025-04-19T17:43:52.437Z","repository":{"id":38799359,"uuid":"274122364","full_name":"PolarBean/DeepSlice","owner":"PolarBean","description":"A python package which aligns histology to the Allen Brain Atlas and Waxholm rat atlas using deep learning.","archived":false,"fork":false,"pushed_at":"2025-04-10T16:42:48.000Z","size":29888,"stargazers_count":91,"open_issues_count":8,"forks_count":21,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-10T18:01:00.385Z","etag":null,"topics":["automation","brain-imaging","brainmap","brainmaps","deep-learning","histological-images","histology","machine-learning","neuroscience","python"],"latest_commit_sha":null,"homepage":"https://www.deepslice.com.au","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PolarBean.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-22T11:47:07.000Z","updated_at":"2025-04-10T16:42:52.000Z","dependencies_parsed_at":"2022-07-11T19:54:45.801Z","dependency_job_id":"e1ea426a-925c-47b2-9ac5-3faa02961d9e","html_url":"https://github.com/PolarBean/DeepSlice","commit_stats":{"total_commits":126,"total_committers":6,"mean_commits":21.0,"dds":0.4841269841269841,"last_synced_commit":"f9bf3be4c6f3cc4811957ee9393585d28a389ef0"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolarBean%2FDeepSlice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolarBean%2FDeepSlice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolarBean%2FDeepSlice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolarBean%2FDeepSlice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PolarBean","download_url":"https://codeload.github.com/PolarBean/DeepSlice/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249751767,"owners_count":21320370,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","brain-imaging","brainmap","brainmaps","deep-learning","histological-images","histology","machine-learning","neuroscience","python"],"created_at":"2025-01-23T09:20:20.112Z","updated_at":"2025-04-19T17:43:52.430Z","avatar_url":"https://github.com/PolarBean.png","language":"Python","readme":"\n\n[![DOI](https://zenodo.org/badge/274122364.svg)](https://zenodo.org/badge/latestdoi/274122364)\n![PyPI - Version](https://img.shields.io/pypi/v/DeepSlice)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/DeepSlice)\n![Pepy Total Downloads](https://img.shields.io/pepy/dt/DeepSlice)\n\n\n![Alt](docs/images/DeepSlice_github_banner.png \"DeepSlice Banner\")\nDeepSlice is a python library which automatically aligns mouse histology with the allen brain atlas common coordinate framework (and now rat brain histology to the Waxholm rat brain atlas, though this is in beta).\nThe alignments are viewable, and refinable, using the [QuickNII](https://www.nitrc.org/projects/quicknii \"QuickNII\") software package.\nDeepSlice requires no preprocessing and works on any stain, however we have found it performs best on brightfield images.\nAt present one limitation is that it only works on Coronally cut sections, we will release an update in the future for sagittal and horizontally cut histology.\n![Alt](docs/images/process.PNG) \nDeepSlice automates the process of identifying exactly where in the brain a section lies, it can accomodate non-orthogonal cutting planes and will produce an image specific annotation for each section in your brain.  \n## Citation\nIf you use DeepSlice in your work please cite [Carey et al, 2023](https://www.nature.com/articles/s41467-023-41645-4). It may also be useful if you mention the version you use :)\n\nIn addition, you should also remember to cite [Wang et al, 2020](https://doi.org/10.1016/j.cell.2020.04.007) if you use the Allen CCFv3 atlas for the Mouse model and [Kleven et al, 2023](https://www.nature.com/articles/s41592-023-02034-3) if you use the Waxholm Atlas of the Sprague Dawley Rat for the Rat model.\n\n## Workflow \nDeepSlice is fully integrated with the \u003ca href=\"https://quint-workflow.readthedocs.io/en/latest/QUINTintro.html\" \u003eQUINT workflow.\u003c/a\u003e  Quint helps you register, segment and quantify brain wide datasets! \u0026nbsp; 🐭🧠🔬💻🤖\n\n## Web Application\nIf you would like to use DeepSlice but don't need your own personal installation, check out [**DeepSlice Flask**](https://www.DeepSlice.com.au), a web application which will allow you to upload your dataset and download the aligned results. Some more advanced options are only available in the Python package. The web interface was developed by [Michael Pegios](https://github.com/ThermoDev/).\n## [Installation: How to install DeepSlice](#installation)\n\n## [Usage: How to align using DeepSlice](#basic-usage)\n## [For a jupyter notebook example check out](examples/example_notebooks/DeepSlice_example.ipynb)\n\n**Happy Aligning :)**\n\n\n\u003cbr\u003e\n\n\n\u003ca name='Installation'\u003e\u003c/a\u003e \n\u003ch1\u003e Installation \u003c/h1\u003e\n\u003c!-- This h2 must be bold  --\u003e\n\n\u003ch2 style=\"font-weight: bold; text-decoration: underline\"\u003e From PIP  \u003c/h2\u003e\nThis is the easy and recommended way to install DeepSlice, first make sure you have Python 3.11 installed and then simply:\n\n```bash\npip install DeepSlice\n```\nAnd you're ready to go! 🚀 Check out the PyPi package [here](https://pypi.org/project/DeepSlice/)\n\nIf you run into any problems create a github issue and I will help you solve it.\n\n\u003cbr\u003e\n\n\u003ca name='BasicUsage'\u003e\u003c/a\u003e    \n# Basic Usage                                                                                                         \n## On start                                                                                                                         \nAfter cloning our repo and navigating into the directory open an ipython session and import our package.                 \n```python                                                                                                                \nfrom DeepSlice import DSModel     \n```                                                                                                                      \nNext, specify the species you would like to use and initiate the model.                                                                    \n```python                                                                                                                \nspecies = 'mouse' #available species are 'mouse' and 'rat'\n\nModel = DSModel(species)\n```                                                                             \n\n---\n**Important**\n\n* Sections in a folder must all be from the same brain\n\n* DeepSlice uses all the sections you select to inform its prediction of section angle. Thus it is important that you do not include sections which lie outside of the Allen Brain Atlas. This include extremely rostral olfactory bulb and caudal medulla. **If you include these sections in your selected folder it will reduce the quality of all the predictions**.\n* If you are not using the web version and would like to include these sections in your alignment, you can now label them as \"bad sections\" (see below), which will tell DeepSlice not to weight these sections in the propagation.\n\n* The sections do not need to be in any kind of order. \n\n* The model downsamples images to 299x299, you do not need to worry about this but be aware that there is no benefit from using higher resolutions.\n\n------\n\n## Predictions\n\nNow your model is ready to use, just direct it towards the folder containing the images you would like to align.            \n\u003cbr/\u003e eg:                                                                                                                \n```bash                                                                                                              \n    \n ├── your_brain_folder\n │   ├── brain_slice_1.png \n │   ├── brain_slice_2.png     \n │   ├── brain_slice_3.png\n```                                                                                                                      \nIn this parent directory there should be only one sub folder, in this example this is \"your_brain_folder\".               \n\u003cbr /\u003eTo align these images using DeepSlice simply call                                                                  \n```python                                                                                                                \nfolderpath = 'examples/example_brain/GLTa/'\n#here you run the model on your folder\n#try with and without ensemble to find the model which best works for you\n#if you have section numbers included in the filename as _sXXX specify this :)\nModel.predict(folderpath, ensemble=True, section_numbers=True)    \n#This is an optional stage if you have damaged sections, or hemibrains they may negatively effect the \n#propagation for the entire dataset simply set the bad sections here using a string which is unique to \n#those each section you would like to label as bad. DeepSlice will not include it in the propagation \n#and instead it will infer its position based on neighbouring sections.\nModel.set_bad_sections(bad_sections=[\"_s094\", \"s199\"])\n#If you would like to normalise the angles (you should)\nModel.propagate_angles()                     \n#To reorder your sections according to the section numbers \nModel.enforce_index_order()    \n#alternatively if you know the precise spacing (ie; 1, 2, 4, indicates that section 3 has been left out.    \n#Furthermore if you know the exact section thickness in microns this can be included instead of None\n#if your sections are numbered rostral to caudal you will need to specify a negative section_thickness      \nModel.enforce_index_spacing(section_thickness = None)\n#now we save which will produce a json file which can be placed in the same directory as your images \n#and then opened with QuickNII. \nModel.save_predictions(folderpath + 'MyResults')                                                                                                             \n\n\n\n```\n## Acknowledgements\nWe are grateful to Ann Goodchild for her time-saving blunt assessments of many failed prototypes, for the motivation provided by Dr William Redmond, and especially to Veronica Downs, Freja Warner Van Dijk and Jayme McCutcheon, whose Novice alignments were instrumental to this work. We would like to thank Gergely Csúcs for providing his expertise and many atlasing tools. Work in the authors’ laboratories is supported by the National Health \u0026 Medical Research Council of Australia, the Hillcrest Foundation, and Macquarie University (SMcM), and from the European Union’s Horizon 2020 Framework Program for Research and Innovation under the Specific Grant Agreement No. 945539 (Human Brain Project SGA3) and the Research Council of Norway under Grant Agreement No. 269774 (INCF, JGB). We are grateful to Macquarie University for access to their HPC resources, essential for production of early DeepSlice prototypes.\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolarbean%2Fdeepslice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolarbean%2Fdeepslice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolarbean%2Fdeepslice/lists"}