{"id":15358424,"url":"https://github.com/astrofrog/vispy-multivol","last_synced_at":"2026-06-23T07:31:37.921Z","repository":{"id":136158515,"uuid":"49751138","full_name":"astrofrog/vispy-multivol","owner":"astrofrog","description":"MultiVolumeVisual class for Vispy that allows multiple volumes to be shown at the same time","archived":false,"fork":false,"pushed_at":"2016-01-18T17:37:16.000Z","size":282,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-05-24T07:42:09.798Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/astrofrog.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}},"created_at":"2016-01-15T23:44:56.000Z","updated_at":"2019-05-17T03:54:37.000Z","dependencies_parsed_at":"2023-03-19T00:47:56.472Z","dependency_job_id":null,"html_url":"https://github.com/astrofrog/vispy-multivol","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/astrofrog/vispy-multivol","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astrofrog%2Fvispy-multivol","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astrofrog%2Fvispy-multivol/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astrofrog%2Fvispy-multivol/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astrofrog%2Fvispy-multivol/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/astrofrog","download_url":"https://codeload.github.com/astrofrog/vispy-multivol/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astrofrog%2Fvispy-multivol/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34680620,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-23T02:00:07.161Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":"2024-10-01T12:41:10.384Z","updated_at":"2026-06-23T07:31:37.901Z","avatar_url":"https://github.com/astrofrog.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"About\n-----\n\nThis repository includes experiments of ways to display multiple volumes in\nvolume renderings using OpenGL with VisPy.\n\n![screenshot](screenshot.png)\n\n### Approach 1 - MultiVolumeVisual\n\nThis implements a ``MultiVolumeVisual`` and a ``MultiVolume`` class for\n[VisPy](http://www.vispy.org) which allows multiple volumes to be shown\nsimultaneously.\n\nSimply use the ``MultiVolume`` class as you would use the ``Volume`` class in\n[VisPy](http://www.vispy.org), but instead of passing the volume data,\n``clim``, and ``cmap`` as separate arguments, the first argument should be a\nlist of tuples, where each tuple contains ``(data, clim, cmap)``.\n\nIn future it should be possible to also add extra tuples to the ``volumes``\nattribute of the ``MultiVolume`` on-the-fly.\n\nYou can try the two examples in the repository by running:\n\n```\npython medical.py\n```\n\nand\n\n```\npython astrocube.py\n```\n\nThe approach here is to make it so that the vertex shader includes variables\nfor separate volumes and colormaps, and the color averaging is done in the\nshader itself. The ``MultiVolumeVisual`` class then includes a list of volumes\nthat is a callback-enabled list: every time an item is added or removed from\nthe list, the OpenGL data buffer for that item is updated.\n\n**Pros:** when adding a new volume, we don't have to resend all the data, we\nsimply add the new volume data, and update the volume counter in OpenGL. In\naddition, the averaging is done on-the-fly in OpenGL and seems to be very fast.\n\n**Cons:** the fragment shader code has to be generated for a fixed maximum\nnumber of volumes. We could consider making it so that when more than this\nvalue of volumes are added, we update the fragment shader code, but this is not\nideal.\n\n### Approach 2 - RGBAVolumeVisual\n\nThis implements a ``RGBAVolumeVisual`` and a ``RGBAVolume`` class for\n[VisPy](http://www.vispy.org) which allows a cube with arbitrary colors in each\npixel to be shown. This in turn can then be used to show multiple volumes,\nsince we can pre-compute the full final RGBA cube in Python before passing it\nto VisPy.\n\nThis works by simply setting ``u_volumetex`` to an actual 4-d RGBA cube instead\nof a 3-d array, and then using these values without mapping with a colormap.\n\nYou can try the two examples in the repository by running:\n\n```\npython medical_rgba.py\n```\n\nand\n\n```\npython astrocube_rgba.py\n```\n\n**Pros:** could actually be implemented in VisPy with minimal effort (a few\nlines) on top of the existing Volume.\n\n**Cons:** combining the volumes has to be done in Python, and may therefore be\nslower.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastrofrog%2Fvispy-multivol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fastrofrog%2Fvispy-multivol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastrofrog%2Fvispy-multivol/lists"}