{"id":43716399,"url":"https://github.com/khanlab/hippunfold-plot","last_synced_at":"2026-02-05T07:32:58.358Z","repository":{"id":265949067,"uuid":"896213395","full_name":"khanlab/hippunfold-plot","owner":"khanlab","description":"Plotting functions for hippocampal surface maps from HippUnfold","archived":false,"fork":false,"pushed_at":"2024-12-01T18:11:40.000Z","size":2739,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-01T18:29:52.161Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/khanlab.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":"2024-11-29T19:41:13.000Z","updated_at":"2024-12-01T18:11:44.000Z","dependencies_parsed_at":"2024-12-01T18:41:31.486Z","dependency_job_id":null,"html_url":"https://github.com/khanlab/hippunfold-plot","commit_stats":null,"previous_names":["khanlab/hippunfold-plot"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/khanlab/hippunfold-plot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khanlab%2Fhippunfold-plot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khanlab%2Fhippunfold-plot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khanlab%2Fhippunfold-plot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khanlab%2Fhippunfold-plot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/khanlab","download_url":"https://codeload.github.com/khanlab/hippunfold-plot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khanlab%2Fhippunfold-plot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29115573,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T05:31:32.482Z","status":"ssl_error","status_checked_at":"2026-02-05T05:31:29.075Z","response_time":65,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2026-02-05T07:32:57.497Z","updated_at":"2026-02-05T07:32:58.353Z","avatar_url":"https://github.com/khanlab.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🧠 hippunfold_plot\n\nThis package provides plotting functions for hippocampal surface maps from HippUnfold (https://github.com/khanlab/hippunfold), \nwrapping the Nilearn (https://nilearn.github.io) plotting functions (matplotlib engine) to achieve this. \n\nNote: these plotting functions are distinct from those in HippoMaps (https://github.com/MICA-MNI/hippomaps), which use \nVTK wrappers and have a number of limitations therein. \n\nThis package is new and still under active development so suggestions and pull-requests are welcome!\n\n\n## 📦 Installation\n\nTo install the package, simply run:\n\n```sh\npip install hippunfold_plot\n```\n\n## 🚀 Usage\n\nHere are some examples of how to use the `plot_hipp_surf` function to visualize hippocampal surface maps.\n\n### Example 1: Plot Both Hemispheres\n\n```python\nfrom hippunfold_plot.plotting import plot_hipp_surf\nfrom hippunfold_plot.utils import get_resource_path\n\n#get subfields for demonstrating plotting\nlabel_gii = get_resource_path('tpl-avg_label-hippdentate_density-{density}_subfields.label.gii')\ndensity = '1mm'\n\n# Plot dorsal view\nfig = plot_hipp_surf(label_gii.format(density=density), hemi=None, density=density, view='dorsal')\n\n# Plot ventral view\nfig = plot_hipp_surf(label_gii.format(density=density), hemi=None, density=density, view='ventral')\n\n```\n![png](docs/example1_0.png)\n![png](docs/example1_1.png)\n    \n### Example 2: Plot Left and Right Hemispheres Separately\n\n```python\nfrom hippunfold_plot.plotting import plot_hipp_surf\nfrom hippunfold_plot.utils import get_resource_path\n\n#get subfields for demonstrating plotting\nlabel_gii = get_resource_path('tpl-avg_label-hippdentate_density-{density}_subfields.label.gii')\ndensity = '1mm'\n\n# Plot left hemisphere\nfig = plot_hipp_surf(label_gii.format(density=density), hemi='left', density=density, view='dorsal')\n\n# Plot right hemisphere\nfig = plot_hipp_surf(label_gii.format(density=density), hemi='right', density=density, view='dorsal')\n\n```\n    \n![png](docs/example2_0.png)\n![png](docs/example2_1.png)\n\n### Example 3: Plot unfolded and canonical space separately\n\n```python\nfrom hippunfold_plot.plotting import plot_hipp_surf\nfrom hippunfold_plot.utils import get_resource_path\n\n#get subfields for demonstrating plotting\nlabel_gii = get_resource_path('tpl-avg_label-hippdentate_density-{density}_subfields.label.gii')\ndensity = '1mm'\n\n# Plot left hemisphere in unfolded space\nfig = plot_hipp_surf(label_gii.format(density=density), space='unfold', density=density, view='dorsal')\n\n# Plot left hemisphere in canonical space\nfig = plot_hipp_surf(label_gii.format(density=density), space='canonical', density=density, view='dorsal')\n```\n    \n![png](docs/example3_0.png)\n![png](docs/example3_1.png)\n\n## 🛠️ Functions\n\n### `plot_hipp_surf`\n\nPlot hippocampal surface map.\n\nThis function plots a surface map of the hippocampus, which can be a label-hippdentate shape.gii, func.gii, or a Vx1 array\n(where V is the number of vertices in the hippocampus and dentate). Any arguments that can be supplied to nilearn's plot_surf()\ncan also be applied here, overriding the defaults set below.\n\n###### Parameters\n - **surf_map** (str or array-like):\n   The surface map to plot. This can be a file path to a .gii file or a Vx1 array.\n - **density** (str, optional):\n   The density of the surface map. Can be 'unfoldiso', '0p5mm', '1mm', or '2mm'. Default is '0p5mm'.\n - **hemi** (str, optional):\n   The hemisphere to plot. Can be 'left', 'right', or None (in which case both are plotted). Default is 'left'.\n - **space** (str, optional):\n   The space of the surface map. Can be 'canonical', 'unfold', or None (in which case both are plotted). Default is None.\n - **figsize** (tuple, optional):\n   The size of the figure. Default is (12, 8).\n - **dpi** (int, optional):\n   The resolution of the figure in dots per inch. Default is 300.\n - **vmin** (float, optional):\n   The minimum value for the color scale. Default is None.\n - **vmax** (float, optional):\n   The maximum value for the color scale. Default is None.\n - **colorbar** (bool, optional):\n   Whether to display a colorbar. Default is False.\n - **colorbar_shrink** (float, optional):\n   The shrink factor for the colorbar. Default is 0.25.\n - **cmap** (str or colormap, optional):\n   The colormap to use. Default is None.\n - **view** (str, optional):\n   The view of the surface plot. Default is 'dorsal'.\n - **avg_method** (str, optional):\n   The method to average the data. Default is 'median'.\n - **bg_on_data** (bool, optional):\n   Whether to display the background on the data. Default is True.\n - **alpha** (float, optional):\n   The alpha transparency level. Default is 0.1.\n - **darkness** (float, optional):\n   The darkness level of the background. Default is 2.\n - **axes** (matplotlib.axes.Axes or list of matplotlib.axes.Axes, optional):\n   Axes to plot on. If None, new axes will be created. If a single axis is provided, it will be used for a single plot.\n   If multiple plots are to be made, a list of axes should be provided.\n - **figure** (matplotlib.figure.Figure, optional):\n   The figure to plot on. If None, a new figure will be created.\n - ****kwargs** (dict):\n   Additional arguments to pass to nilearn's plot_surf().\n\n###### Returns\n - **figure** (matplotlib.figure.Figure):\n   The figure object.\n\n###### Notes\nBy default, this function will plot one hemisphere (left by default) in both canonical and unfolded space.\nBoth surfaces can be plotted with hemi=None, but the same surf_map will be plotted on both.\n## 🧪 Testing\n\nTo run the tests, including unit tests and docstring tests, use the following command:\n\n```sh\npython -m unittest discover -s . -p \"test_*.py\"\n```\n\n## 📄 License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## 🙌 Contributing\n\nWe welcome contributions and feedback! Please make a PR or post an issue. \n\n---\n\nHappy plotting! 🎉\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhanlab%2Fhippunfold-plot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkhanlab%2Fhippunfold-plot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhanlab%2Fhippunfold-plot/lists"}