{"id":20215416,"url":"https://github.com/kitwaremedical/vtkcolorcodeddepthvolume","last_synced_at":"2025-03-03T11:18:33.113Z","repository":{"id":67764862,"uuid":"106594024","full_name":"KitwareMedical/vtkColorCodedDepthVolume","owner":"KitwareMedical","description":"Animate a sequence of NRRD volumes in VTK","archived":false,"fork":false,"pushed_at":"2018-09-30T19:06:43.000Z","size":3382,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-24T07:06:51.599Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KitwareMedical.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":"2017-10-11T18:34:23.000Z","updated_at":"2022-05-05T03:29:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"3e6c9eaf-5c7c-4cbd-878b-7b2e427529c7","html_url":"https://github.com/KitwareMedical/vtkColorCodedDepthVolume","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KitwareMedical%2FvtkColorCodedDepthVolume","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KitwareMedical%2FvtkColorCodedDepthVolume/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KitwareMedical%2FvtkColorCodedDepthVolume/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KitwareMedical%2FvtkColorCodedDepthVolume/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KitwareMedical","download_url":"https://codeload.github.com/KitwareMedical/vtkColorCodedDepthVolume/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241652964,"owners_count":19997578,"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":[],"created_at":"2024-11-14T06:22:04.855Z","updated_at":"2025-03-03T11:18:33.087Z","avatar_url":"https://github.com/KitwareMedical.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vtkColorCodedDepthVolume\n\nvtkColorCodedDepthVolume is a sample application that demonstrates animating a\nsequence of NRRD volumes with custom blend modes in VTK.\n\n## Features\n\n- Switch between different volume rendering modes\n  - Composite blending (stock volume rendering)\n  - Average intensity projection\n  - Maximum intensity projection\n  - Color coding the depth of first non-transparent voxel along the ray. (Think\n    of this as a colored depth map).\n  - Color coding based on the depth of individual voxels (yellow-brown-blue\n    color function).\n- Demonstrates use of custom shaders in VTK volume rendering\n- Read and animate a sequence of NRRD volumes in VTK\n- Licensed under Apache version 2.0\n\n## Compile\n\nUse CMake to configure the build system for the platform of choice. Build the\nconfigured system using the generator selected in CMake.\nFor more details, take a look at the [Running\nCMake](https://cmake.org/runningcmake/) tutorial.\n\n## Usage\n\n```shell_session\n$ ./vtkColorCodedDepthVolume \u003cNrrd files directory\u003e\n```\n\nThe argument should point to the directory containing the time sequence of NRRD\nvolumes as individual files.\n\n**Note** Take a look at [Preparing Data](#preparing-data) to convert a single\nNRRD sequence file into multiple files.\n\nOnce the above command is run, the application starts reading each file in the\ndirectory as a time series and instantiates a volume pipeline for each dataset.\nA default color and scalar opacity transfer function are applied for the\ncomposite blend mode. One can now use the mouse to interact with the rendered\ndata. Use the custom keymappings below to interact with the whole series:\n\n| Key             |         Mapping                |\n|:----------------|:-------------------------------|\n|  Space          |  Play / Loop through sequence  |\n|   n             |      Next volume               |\n|   p             |      Previous volume           |\n|   a             |   Average Intensity Projection |\n|   m             |   Maximum Intensity Projection |\n|   c             |   Composite Blend (default)    |\n|   d             |   Color coded depth map (First non-transparent voxel) |\n|   o             |   Color coded depth            |\n\n### Preparing Data\n\nFor converting a single `*.seq.nrrd` (4D NRRD volume) into individual 3D NRRD\nvolumes, one can use [teem-unu](http://teem.sourceforge.net/unrrdu/).\n\n```shell_session\n$ unu dice -a 0 -i \u003cinput 4D file\u003e -o \u003coutput basename\u003e -ff %03.nrrd\n```\n\n## Description\n\nThe source for vtkColorCodedDepthVolume consists of:\n\n- [vtkColorCodedDepthVolume.cxx](./vtkColorCodedDepthVolume.cxx):\n  This file provides the `main()` function for the application that sets up the\n  rendering pipeline as well as defines\n  relevant callbacks for the different key-mappings as described in\n  [Usage](#usage).\n- [vtkNrrdSequenceReader.h(cxx)](./vtkNrrdSequenceReader.h): This is a VTK\n  reader that reads in multiple NRRD files from a single directory as individual\n  time steps. The output of the reader is a `vtkImageData` object of the first\n  timestep by default. The reader provides API for specifying a particular\n  timestep as well as convenience API like `Next()` and `Previous()`.\n- [ColorCodedDepthFragmentShader.glsl](./ColorCodedDepthFragmentShader.glsl):\n  This is a custom fragment shader that is used for color coding the depth of\n  first non-transparent voxel along the ray. To simplify consumption of the\n  shader code in the C++ application, it is converted to a C string using\n  [vtkEncodeString.cmake](https://gitlab.kitware.com/vtk/vtk/blob/590b3413ba71bfe0a746d276360d055001ec8eac/CMake/vtkEncodeString.cmake).\n\n### Custom shaders\n\nThis application also serves as an example for using custom GLSL shading code\nin VTK's volume rendering framework. There are two types of customizations\navailable to the user - partial replacements or full shader replacements.\n\nThe application uses\n[`vtkOpenGLGPUVolumeRayCastMapper::AddShaderReplacement()`](https://www.vtk.org/doc/nightly/html/classvtkOpenGLGPUVolumeRayCastMapper.html#a5f701007fb5301dfd2b047739ab28edc)\nto modify final color computation in the fragment shader. The final image is a\ncomposite representing depth of individual voxels in a yellow - brown - blue\ncolor transfer function.\n\nThe application uses\n[`vtkOpenGLGPUVolumeRayCastMapper::SetFragmentShaderCode()`](https://www.vtk.org/doc/nightly/html/classvtkOpenGLGPUVolumeRayCastMapper.html#a95123c088bb25fbc8231702bedf57aea) to replace the\nwhole shader code with the code provided by\n[ColorCodedDepthFragmentShader.glsl](./ColorCodedDepthFragmentShader.glsl).\nThis code terminates the ray at the first non-transparent voxel and registers\nits depth. The final color of the rendered fragment is decided based on the\ndepth value registered for the fragment. In this case, the color transfer\nfunction is defined over the Z-range i.e. (0, depth) range of the volume. We set\n[`vtkGPUVolumeRayCastMapper::SetColorRangeType`](https://www.vtk.org/doc/nightly/html/classvtkGPUVolumeRayCastMapper.html#a784d19bb8eeb1350269dbc99e7be995f)\nto `NATIVE` to avoid re-scaling the transfer function over the scalar range in\nthe mapper.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitwaremedical%2Fvtkcolorcodeddepthvolume","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkitwaremedical%2Fvtkcolorcodeddepthvolume","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitwaremedical%2Fvtkcolorcodeddepthvolume/lists"}