Module: helpers/stack

Helper to easily display and interact with a stack.

Defaults:
- orientation: 0 (acquisition direction)
- index: middle slice in acquisition direction

Features:
- slice from the stack (in any direction)
- slice border
- stack bounding box

Live demo at: Lesson 01
Source:
See:
Example
let stack = new VJS.Models.Stack();
... // prepare the stack

let helpersStack = new VJS.Helpers.Stack(stack);
stackHelper.bbox.color = 0xF9F9F9;
stackHelper.border.color = 0xF9F9F9;

let scene = new THREE.Scene();
scene.add(stackHelper);

Members

bbox :HelpersBoundingBox

Get bounding box helper.
Type:
  • HelpersBoundingBox
Source:

border :HelpersSlice

Get border helper.
Type:
  • HelpersSlice
Source:

index :number

Set/get current slice index.
Sets outOfBounds flag to know if target index is in/out stack bounding box.

Internally updates the sliceHelper index and position. Also updates the borderHelper with the updated sliceHelper.
Type:
  • number
Source:

orientation :number

Set/get current slice orientation.
Values:
- 0: acquisition direction (slice normal is z_cosine)
- 1: next direction (slice normal is x_cosine)
- 2: next direction (slice normal is y_cosine)
- n: set orientation to 0

Internally updates the sliceHelper direction. Also updates the borderHelper with the updated sliceHelper.
Type:
  • number
Source:

orientationMaxIndex :number

Set/get the orientationMaxIndex.
Type:
  • number
Source:

orientationSpacing :number

Set/get the orientationSpacing.
Type:
  • number
Source:

outOfBounds :boolean

Set/get the outOfBound flag.
Type:
  • boolean
Source:

slice :HelpersSlice

Get slice helper.
Type:
  • HelpersSlice
Source:

stack :ModelsStack

Get stack.
Type:
  • ModelsStack
Source:

stack :ModelsStack

Set stack.
Type:
  • ModelsStack
Source:

Methods

(private) _create()

Initial setup, including stack prepare, bbox prepare, slice prepare and border prepare.
Source:

(private) _isIndexOutOfBounds()

Given orientation, check if index is in/out of bounds.
Source:

(private) _prepareBBox()

Setup bounding box helper given prepared stack and add bounding box helper to stack helper.
Source:

(private) _prepareBorder()

Setup border helper given slice helper and add border helper to stack helper.
Source:

(private) _prepareDirection(orientation) → {Vector3}

Compute slice direction depending on orientation.
Parameters:
Name Type Description
orientation number Slice orientation.
Source:
Returns:
Slice direction
Type
Vector3

(private) _prepareSlice()

Setup slice helper given prepared stack helper and add slice helper to stack helper.
Source:

(private) _prepareSliceIndex(indices) → {number}

Compute slice index depending on orientation.
Parameters:
Name Type Description
indices Vector3 Indices in each direction.
Source:
Returns:
Slice index according to current orientation.
Type
number

(private) _prepareSlicePosition(rPosition, index) → {number}

Compute slice position depending on orientation. Sets index in proper location of reference position.
Parameters:
Name Type Description
rPosition Vector3 Reference position.
index number Current index.
Source:
Returns:
Slice index according to current orientation.
Type
number

(private) _prepareStack()

Prepare a stack for visualization. (image to world transform, frames order, pack data into 8 bits textures, etc.)
Source:

dispose()

Release the stack helper memory including the slice memory.
Source: