diff --git a/.gitbook/assets/github-mark-120px-plus.png b/.gitbook/assets/github-mark-120px-plus.png new file mode 100644 index 00000000..ea6ff545 Binary files /dev/null and b/.gitbook/assets/github-mark-120px-plus.png differ diff --git a/.gitignore b/.gitignore index 4e434a90..ebcf7b27 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ _build/ .DS_Store Thumbs.db + +gallery.txt diff --git a/conf.py b/conf.py index f3554fcf..2117ba72 100644 --- a/conf.py +++ b/conf.py @@ -34,6 +34,7 @@ extensions = [ 'myst_parser', # there's also myst_nb, which supports embedding Jupyter notebooks, but is heavier. 'sphinx_panels', + 'sphinx_design', ] myst_heading_anchors = 4 # enable #section links: https://myst-parser.readthedocs.io/en/latest/syntax/optional.html#syntax-header-anchors @@ -103,3 +104,94 @@ "README.html")): # don't create dangling symlinks; # it annoyes Github Pages. os.symlink("README.html", z) + + +# -- Custom scripts ---------------------------------------------------------- + +import os +from pathlib import Path +import random +import requests +from subprocess import run +from textwrap import dedent +from urllib.parse import urlparse +from ghapi.all import GhApi +import pandas as pd + +import yaml + +from sphinx.application import Sphinx +from sphinx.util import logging + +LOGGER = logging.getLogger("conf") + +def build_gallery(app: Sphinx): + # Build the gallery file + LOGGER.info("building gallery...") + grid_items = [] + projects = yaml.safe_load((Path(app.srcdir) / "gallery_software.yml").read_text()) + for item in projects: + if not item.get("image"): + item["image"] = "https://jupyterbook.org/_images/logo-square.svg" + + repo_text = "" + star_text = "" + + if item["repository"]: + repo_text = f'{{bdg-link-secondary}}`repo <{item["repository"]}>`' + + try: + url = urlparse(item["repository"]) + if url.netloc == "github.com": + _, org, repo = url.path.rstrip("/").split("/") + star_text = f"[![GitHub Repo stars](https://img.shields.io/github/stars/{org}/{repo}?style=social)]({item['repository']})" + except Exception as error: + pass + + grid_items.append( + f"""\ + `````{{grid-item-card}} + :text-align: center + logo + +++ + {" ".join(item["name"].split())} + ````{{grid}} 2 2 2 2 + :margin: 0 0 0 0 + :padding: 0 0 0 0 + :gutter: 1 + ```{{grid-item}} + :child-direction: row + :child-align: start + :class: sd-fs-5 + {{bdg-link-secondary}}`website <{item["website"]}>` + {repo_text} + ``` + ```{{grid-item}} + :child-direction: row + :child-align: end + {star_text} + ``` + ```` + ````` + """ + ) + grid_items = "\n".join(grid_items) + +# :column: text-center col-6 col-lg-4 +# :card: +my-2 +# :img-top-cls: w-75 m-auto p-2 +# :body: d-none + + panels = f""" +``````{{grid}} 1 2 3 3 +:gutter: 1 1 2 2 +:class-container: full-width +{dedent(grid_items)} +`````` + """ + (Path(app.srcdir) / "gallery_software.txt").write_text(panels) + + +def setup(app: Sphinx): + app.add_css_file("_static/theme.css") + app.connect("builder-inited", build_gallery) diff --git a/gallery_software.yml b/gallery_software.yml new file mode 100644 index 00000000..fd50cc56 --- /dev/null +++ b/gallery_software.yml @@ -0,0 +1,20 @@ +- name: Comprehensive library of analysis tools for multi-parametric MRI of the spinal cord + website: https://spinalcordtoolbox.com/ + repository: https://github.com/spinalcordtoolbox/spinalcordtoolbox + image: https://raw.githubusercontent.com/spinalcordtoolbox/spinalcordtoolbox/master/documentation/source/_static/img/logo_sct.png +- name: Integrated framework for medical image analysis with deep learning + website: https://ivadomed.org + repository: https://github.com/ivadomed/ivadomed + image: https://raw.githubusercontent.com/ivadomed/ivadomed/master/images/ivadomed_logo.png +- name: Simulation, analysis, and visualization of qMRI data (Magnetization Transfer, Diffusion, etc.) + website: https://qmrlab.readthedocs.io + repository: https://github.com/qMRLab/qMRLab + image: https://raw.githubusercontent.com/qMRLab/documentation/master/logo/qMR_logo_orig.png +- name: Software tools to perform advanced static and real-time shimming experiments with MRI. + website: https://shimming-toolbox.org + repository: https://github.com/shimming-toolbox/shimming-toolbox + image: https://raw.githubusercontent.com/shimming-toolbox/shimming-toolbox/master/docs/source/_static/img/shimming_toolbox_logo.png +- name: Segmentation of axon and myelin on microscopy data. + website: https://axondeepseg.readthedocs.io/ + repository: https://github.com/neuropoly/axondeepseg + image: https://raw.githubusercontent.com/neuropoly/axondeepseg/master/docs/source/_static/logo_ads-alpha.png diff --git a/setup.py b/setup.py index 2dec8a9e..4299a35d 100644 --- a/setup.py +++ b/setup.py @@ -20,8 +20,7 @@ "myst-parser", "sphinx-book-theme", "sphinx-panels", - # pinned because of this bug https://github.com/pydata/pydata-sphinx-theme/pull/509 - # and that the patched sphinx-book-theme isn't out yet: https://github.com/executablebooks/sphinx-book-theme/issues/428#issuecomment-966021270 + "sphinx-design~=0.0.11", # pinned because of this bug https://github.com/pydata/pydata-sphinx-theme/pull/50# and that the patched sphinx-book-theme isn't out yet: https://github.com/executablebooks/sphinx-book-theme/issues/428#issuecomment-966021270 "sphinx~=4.2.0", # TODO: unpin when the next sphinx-book-theme is released ], }, diff --git a/software.md b/software.md index bc339605..4c34abc5 100644 --- a/software.md +++ b/software.md @@ -1,31 +1,37 @@ # `🖥` Software -## Open-Source Projects - Below is a list of software projects created at **NeuroPoly** or at collaborative institutions. These projects are open source and freely available. -### MRI +## Image analysis -| Name | Description | Source | Documentation | -| ----------------------- | ---------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| ivadomed | Comprehensive and open-source repository of deep learning methods for medical data segmentation | [Source](https://github.com/ivadomed/ivadomed) | [Documentation](https://ivadomed.org/en/latest/) | -| Multiclass Segmentation | Code related to the NIH marmoset longitudinal segmentation project | [Source](https://github.com/neuropoly/multiclass-segmentation) | [Documentation](https://github.com/neuropoly/multiclass-segmentation/blob/master/README.md) | -| qMRLab | Software for data aimulation, analysis, and visualization of qMRI data (Magnetization Transfer, Diffusion, etc.) | [Source](https://github.com/qMRLab/qMRLab) | [Documentation](https://qmrlab.readthedocs.io/en/master/) | -| Shimming Toolbox | Code for performing real-time shimming using external MRI shim coils | [Source](https://github.com/shimming-toolbox) | [Documentation](https://shimming-toolbox.org/en/latest/) | -| Spinal Cord Toolbox | Comprehensive and open-source library of analysis tools for multi-parametric MRI of the spinal cord | [Source](https://github.com/neuropoly/spinalcordtoolbox) | [Documentation](https://spinalcordtoolbox.com/en/latest/) | -| Template | A framework for creating unbiased MRI templates of the spinal cord | [Source](https://github.com/neuropoly/template) | [Documentation](https://github.com/neuropoly/template/blob/master/README.md) | +```{include} gallery_software.txt +``` -### Histology + -### Contributing + + + + + +## Contributing + +**NeuroPoly** welcomes and appreciates contributions. To get started, please check out [**NeuroPoly**'s contributing guidelines](https://intranet.neuro.polymtl.ca/geek-tips/contributing).