ReFlex Logo
ReFlex (Title)
Documentation
Navigation

reflex-layers

This page documents application setup, content preparation, and controls. For the research questions, interaction concepts, and findings of the historical implementation, see Case Study: Layers - Layered Data.

Table-of-contents

  1. User Interface
  2. Textures
  3. Example Data
  4. Generating KTX files
  5. using powershell scripts
  6. Sources for Additional Content
  7. Electron
  8. Keyboard Shortcuts
  9. Key Bindings for loading Datasets
  10. Interaction Modes
  11. Project Setup and Development
  12. Known Issues

User Interface

The application provides three presentation concepts. Magic Lens has separate single-touch and multi-touch variants; availability depends on the texture format. See Interaction Modes for behaviour and configuration options.

Magic Lens (single touch and multi-touch)

Displays a lens containing the layer content of the depth of the deformation at the finger position.

Magic Lens

Single Touch (only one lens for the finger causing the highest deformation) and Multi-Touch (one lens for each finger) modes can be selected separately.

Lens Options include the size of the lens, an optional offset from the finger and the specification whether additional information should be displayed on the lens itself.

Layer Navigation

Displays the layer mapped to the current maximum deformation.

Layer Navigation

Pixel Blending

Maps the depth information associated to each pixel on the surface to the displayed content by blending images based on the depth value.

Pixel Blending

Pixel Blending Options include developer / debugging options, whether to interpolate depth values for smoother blending and if the sensor calibration should be applied to the depth image.

Textures

Texture Formats

  1. Texture2D
    • multiple images in common file formats (preferably png and jpg)
    • Pixel Blending supports a maximum of 15 separately supplied layer textures in the case-study implementation; this limit does not apply generally to image-based lens navigation
  2. TextureArray:
    • multiple images of equal size provided in a single file
    • either in RAW format (raw byte data) or in Khronos KTX2 texture format
    • the case study describes a 256-layer limit for its raw-data representation; KTX2 avoids that restriction, but usable array sizes still depend on the graphics implementation and hardware
  3. Texture3D:
    • number of images of equal size, encoded as volumetric data structure
    • either in DDS format (raw bit data) or in Khronos KTX texture format
    • REMARK: not a usable option in the implementation described by the case study: 3D-texture integration with three.js was unreliable, so existing FlexiWall 3D textures required conversion. This is distinct from the supported TextureArray formats.

Common Properties for TextureResource

Specific properties for TextureArrays

App Configuration

There is an optional parameter config that can be set for each dataset. It specifies the default settings applied when loading the dataset:


    "config": {
      // default interaction mode: 
      //    0: Pixel Blending, 
      //    1: Magic Lens (single touch)
      //    2: Magic Lens (multi touch)
      //    3: Layer Navigation
      "interaction": 1,          
      "interpolateColor": true,
      // show layers and layer information at the lens
      "showLenseUI": true,
      // show position in the current layer on the side
      "showLayerUI": false,
      // selected mask for Magic Lens (TextureArray only)
      "defaultLensMaskIdx": 1,
      // selected border color for Magic Lens (TextureArray only) - hex color
      "lensBorderColor": "#ffff00",
      // scaling factor of lens
      "lensSize": 1.0,
      // horizontal lens offset from finger (Pixel)
      "lensOffsetX": 0.0,
      // vertical lens offset from finger (Pixel)
      "lensOffsetY": 0.0,
      // only for multi-touch Magic lenses: constrain number of available lenses
      "maxNumLenses": 1
    }

Example Data

Visible Human

CT Head Raw TextureArray

Generating KTX files

    "C:\Program Files\KTX-Software\bin\toktx.exe" --t2 --encode etc1s --layers 10 output_texArray @files.txt

  // conversion from Linear color space to sRGB
  vec4 fromLinear(vec4 linearRGB)
  {
    bvec4 cutoff = lessThan(linearRGB, vec4(0.0031308));
    vec4 higher = vec4(1.055)*pow(linearRGB, vec4(1.0/2.4)) - vec4(0.055);
    vec4 lower = linearRGB * vec4(12.92);

    return mix(higher, lower, cutoff);
  }

  // conversion from Linear color space to sRGB
  vec4 toLinear(vec4 sRGB)
  {
    bvec4 cutoff = lessThan(sRGB, vec4(0.04045));
    vec4 higher = pow((sRGB + vec4(0.055))/vec4(1.055), vec4(2.4));
    vec4 lower = sRGB/vec4(12.92);

    return mix(higher, lower, cutoff);
  }

using powershell scripts

There are two PowerShell scripts provided which automate the creation of the file list and creating the ktx command.


  .\create-file-list.ps1 -Path "textures\" -Output "output.txt"

to create the file list with the following optional parameters:

Both parameters are optional.

Remarks: Files are sorted by name (string sort)


  .\create-ktx.ps1 -Path ".\test" -NumLayers 141 -ToolPath "C:\Program Files\KTX-Software\bin\toktx.exe"

with the following optional parameters:

Sources for Additional Content

Additional Content Link
Dresden Hochwasser (2D/3D) Dresden Hochwasser (arcGis)
Dresden Themenstadtplan Dresden Themenstadtplan (cardo.Map)
Historische Karten Europa 1500 - 2008 Digitaler Atlas zur Geschichte Europas
Altar von Ghent (van Eyck) [nicht freigegeben !] Closer to van Eyck
Visible Human Head National Library of Medicine
CT Head Raw CodeProject article

Electron

Keyboard Shortcuts

The app starts in full screen mode. The following shortcuts are available:

Shortcut Description
S Toggle Settings Panel
Esc Close the application
STRG + Shift + I open dev tools
STRG + R reload app
STRG + M minimize app
F1 - F10 load specific Configurations (if defined, see Key Bindings)

Key Bindings for loading Datasets

It is possible to assign Keys to specific datasets. This can be done in the assets/data/keybindings.json file. So far, only assigning keys F1 to F10 has been tested; other might work as well.

Just add a (unique) mapping between key and dataset id in the form { "key": "F6", "dataset": 8 } to the keyBindings array.

Example Config:

  {
    "keyBindings": [
      { "key": "F1", "dataset": 14 },
      { "key": "F2", "dataset": 51 },
      { "key": "F3", "dataset": 60 },
      { "key": "F4", "dataset": 4 },
      { "key": "F5", "dataset": 5 },
      { "key": "F6", "dataset": 8 },
      { "key": "F7", "dataset": 9 },
      { "key": "F8", "dataset": 15 },
      { "key": "F9", "dataset": 1 }
    ]
  }

Interaction Modes

The case-study implementation supports the following combinations. These describe the reported prototype; later repository versions may extend them.

Mode Texture2D TextureArray
Pixel Blending Supported, with the layer limit described under Texture Formats Supported
Magic Lens (single-touch) Supported Supported
Magic Lens (multi-touch) Supported Not implemented
Layer Navigation Supported Supported

Pixel Blending

Magic Lens (Single or Multi-Touch)

Layer Navigation

For texture-array lenses, a grayscale mask can interpolate between the selected layer and the resting view, producing effects such as a fisheye-like transition. The lens border color is also configurable. Lens size, offset, and the layer widget at the screen edge are available for both texture formats; widgets directly on the lens are limited to Texture2D in the case-study implementation.

Project Setup and Development

This project was generated with Angular CLI version 17.3.11.

Run npm install in directory reflex-layers to install node packages.

Code Scaffolding

Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.

NPM Commands

Command Description
start starts the Angular app on port 4302
start:electron starts the app as packaged electron application
watch starts the Angular app on port 4302 in watch mode
build builds the Angular app
build:electron builds and packages the app as electron application (Target: Win)
test executes unit tests via Karma

Further Help

To get more help on the Angular CLI use ng help or go check out the Angular CLI Overview and Command Reference page.

Known Issues