Science Score: 59.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 3 DOI reference(s) in README -
✓Academic publication links
Links to: zenodo.org -
✓Committers with academic emails
1 of 2 committers (50.0%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (9.8%) to scientific vocabulary
Keywords
fdg
mri
neuroimaging
pet-mr
volume-rendering
Last synced: 7 months ago
·
JSON representation
Repository
BrainWeb: Multimodal models of 20 normal brains
Basic Info
Statistics
- Stars: 34
- Watchers: 1
- Forks: 11
- Open Issues: 22
- Releases: 9
Topics
fdg
mri
neuroimaging
pet-mr
volume-rendering
Created almost 7 years ago
· Last pushed 10 months ago
Metadata Files
Readme
Zenodo
README.ipynb
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# BrainWeb-based multimodal models of 20 normal brains\n",
"\n",
"This project was initially inspired by \"[BrainWeb: 20 Anatomical Models of 20 Normal Brains][RawData].\"\n",
"\n",
"However there are a number of generally useful tools, image processing & display functions included in this project. For example, this includes `volshow()` for interactive comparison of multiple 3D volumes, `get_file()` for caching data URLs, and `register()` for image coregistration.\n",
"\n",
"[![PyPI]][PyPI-target]|[![CI]][CI-target]|[![Quality]][Quality-target]|[![DOI]][DOI-target]|[![LICENCE]][LICENCE-target]\n",
"-|-|-|-|-\n",
"\n",
"**Download and Preprocessing for PET-MR Simulations**\n",
"\n",
"This notebook will not re-download/re-process files if they already exist.\n",
"\n",
"- Output data\n",
" + `~/.brainweb/subject_*.npz`: dtype(shape): `float32(127, 344, 344)`\n",
"\n",
"- [Raw data source][RawData]\n",
" + `~/.brainweb/subject_*.bin.gz`: dtype(shape): `uint16(362, 434, 362)`\n",
"\n",
"- Install\n",
" + `pip install brainweb`\n",
"\n",
"----\n",
"\n",
"- Author: Casper da Costa-Luis <>\n",
"- Date: 2017-2020\n",
"- Licence: [MPLv2.0](https://www.mozilla.org/MPL/2.0)\n",
"\n",
"[RawData]: http://brainweb.bic.mni.mcgill.ca/brainweb/anatomic_normal_20.html\n",
"[PyPI]: https://img.shields.io/pypi/v/brainweb.svg\n",
"[PyPI-target]: https://pypi.org/project/brainweb\n",
"[CI]: https://travis-ci.org/casperdcl/brainweb.svg?branch=master\n",
"[CI-target]: https://travis-ci.org/casperdcl/brainweb\n",
"[Quality]: https://api.codacy.com/project/badge/Grade/cdad13693b0141199c31d5b44c7ab185\n",
"[Quality-target]: https://www.codacy.com/app/casper-dcl/brainweb\n",
"[DOI]: https://zenodo.org/badge/DOI/10.5281/zenodo.3269888.svg\n",
"[DOI-target]: https://doi.org/10.5281/zenodo.3269888\n",
"[LICENCE]: https://img.shields.io/pypi/l/brainweb.svg?label=licence\n",
"[LICENCE-target]: https://www.mozilla.org/MPL/2.0"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from __future__ import print_function, division\n",
"%matplotlib notebook\n",
"import brainweb\n",
"from brainweb import volshow\n",
"import numpy as np\n",
"from os import path\n",
"from tqdm.auto import tqdm\n",
"import logging\n",
"logging.basicConfig(level=logging.INFO)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Raw Data"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# download\n",
"files = brainweb.get_files()\n",
"\n",
"# read last file\n",
"data = brainweb.load_file(files[-1])\n",
"\n",
"# show last subject\n",
"print(files[-1])\n",
"volshow(data, cmaps=['gist_ncar']);"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Transform\n",
"\n",
"$\\ifcsname bm\\endcsname\\else\\newcommand{\\bm}[1]{\\mathbf{#1}}\\fi$\n",
"Convert raw image data:\n",
"\n",
"- Siemens Biograph mMR resolution (~2mm) & dimensions (127, 344, 344)\n",
"- PET/T1/T2/uMap intensities\n",
" + PET defaults to FDG intensity ratios; could use e.g. Amyloid instead\n",
"- randomised structure for PET/T1/T2\n",
" + $\\bm{\\theta} \\circ (\\bm{1} + \\gamma[2G_\\sigma(\\bm{\\rho}) - \\bm{1}])$\n",
" * $\\bm{\\rho} = rand(127, 344, 344) \\in [0, 1)$\n",
" * Gaussian smoothing $\\sigma = 1$\n",
" * $\\gamma = \\left\\{\\matrix{1 & \\text{for PET}\\\\ 0.75 & \\text{for MR}}\\right.$\n",
" * $\\bm{\\theta}$ is the PET or MR piecewise constant phantom"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# show region probability masks\n",
"PetClass = brainweb.FDG\n",
"label_probs = brainweb.get_label_probabilities(files[-1], labels=PetClass.all_labels)\n",
"volshow(label_probs[brainweb.trim_zeros_ROI(label_probs)], titles=PetClass.all_labels, frameon=False);"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"brainweb.seed(1337)\n",
"\n",
"for f in tqdm(files, desc=\"mMR ground truths\", unit=\"subject\"):\n",
" vol = brainweb.get_mmr_fromfile(\n",
" f,\n",
" petNoise=1, t1Noise=0.75, t2Noise=0.75,\n",
" petSigma=1, t1Sigma=1, t2Sigma=1,\n",
" PetClass=PetClass)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# show last subject\n",
"print(files[-1])\n",
"volshow([vol['PET' ][:, 100:-100, 100:-100],\n",
" vol['uMap'][:, 100:-100, 100:-100],\n",
" vol['T1' ][:, 100:-100, 100:-100],\n",
" vol['T2' ][:, 100:-100, 100:-100]],\n",
" cmaps=['hot', 'bone', 'Greys_r', 'Greys_r'],\n",
" titles=[\"PET\", \"uMap\", \"T1\", \"T2\"],\n",
" frameon=False);"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# add some lesions\n",
"brainweb.seed(1337)\n",
"im3d = brainweb.add_lesions(vol['PET'])\n",
"volshow(im3d[:, 100:-100, 100:-100], cmaps=['hot']);"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# bonus: use brute-force registration to transform\n",
"#!pip install -U 'brainweb[register]'\n",
"reg = brainweb.register(\n",
" data[:, ::-1], target=vol['PET'],\n",
" src_resolution=brainweb.Res.brainweb,\n",
" target_resolution=brainweb.Res.mMR)\n",
"\n",
"volshow({\n",
" \"PET\": vol['PET'][:, 100:-100, 100:-100],\n",
" \"RawReg\": reg[ :, 100:-100, 100:-100],\n",
" \"T1\": vol['T1' ][:, 100:-100, 100:-100],\n",
"}, cmaps=['hot', 'gist_ncar', 'Greys_r'], ncols=3, tight_layout=5, figsize=(9.5, 3.5), frameon=False);"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython"
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Owner
- Name: Casper da Costa-Luis
- Login: casperdcl
- Kind: user
- Location: London, UK
- Website: https://cdcl.ml
- Repositories: 136
- Profile: https://github.com/casperdcl
Open Core Software Consultant & Technical Product Manager; Computational Physicist; member of IEEE, IOP, & @python Software Foundation
GitHub Events
Total
- Watch event: 2
- Push event: 1
- Pull request event: 1
- Fork event: 1
- Create event: 2
Last Year
- Watch event: 2
- Push event: 1
- Pull request event: 1
- Fork event: 1
- Create event: 2
Committers
Last synced: 12 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Casper da Costa-Luis | c****l@p****g | 70 |
| Kris Thielemans | k****s@u****k | 4 |
Committer Domains (Top 20 + Academic)
ucl.ac.uk: 1
physics.org: 1
Issues and Pull Requests
Last synced: 8 months ago
All Time
- Total issues: 9
- Total pull requests: 23
- Average time to close issues: about 2 months
- Average time to close pull requests: about 1 month
- Total issue authors: 5
- Total pull request authors: 3
- Average comments per issue: 1.44
- Average comments per pull request: 0.26
- Merged pull requests: 4
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 5
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- KrisThielemans (4)
- ashgillman (2)
- rajat-mae (1)
- rijobro (1)
- casperdcl (1)
Pull Request Authors
- casperdcl (20)
- snyk-bot (4)
- KrisThielemans (3)
Top Labels
Issue Labels
bug (4)
enhancement (2)
documentation (1)
question (1)
Pull Request Labels
bug (3)
enhancement (1)
Packages
- Total packages: 1
-
Total downloads:
- pypi 145 last-month
- Total dependent packages: 1
- Total dependent repositories: 3
- Total versions: 18
- Total maintainers: 1
pypi.org: brainweb
BrainWeb-based multimodal models of 20 normal brains
- Homepage: https://github.com/casperdcl/brainweb
- Documentation: https://brainweb.readthedocs.io/
- License: MPLv2.0
-
Latest release: 1.6.2
published over 5 years ago
Rankings
Dependent packages count: 4.8%
Dependent repos count: 8.9%
Average: 10.1%
Forks count: 11.4%
Stargazers count: 12.5%
Downloads: 12.8%
Maintainers (1)
Last synced:
8 months ago
Dependencies
requirements.txt
pypi
- matplotlib *
- numpy *
- requests *
- scikit-image *
- tqdm >=4.42.0