This class had been written to handle the output of the NRRDLoader. It contains a volume of data and information about it. For now it only handles 3 dimensional data.
Volume is an addon, and must be imported explicitly, see Installation#Addons.
import { Volume } from 'three/addons/misc/Volume.js';
Constructs a new volume.
xLength
Width of the volume.
yLength
Length of the volume.
zLength
Depth of the volume.
type
The type of data (uint8, uint16, ...).
arrayBuffer
The buffer with volume data.
This array holds the dimensions of the volume in the RAS space
The order of the Axis dictated by the NRRD header
The data of the volume.
The RAS to IJK matrix.
The voxels with values under this threshold won't appear in the slices. If changed, geometryNeedsUpdate is automatically set to true on all the slices associated to this volume.
The IJK to RAS matrix.
Offset of the volume in the RAS coordinate system
Whether to use segmentation mode or not. It can load 16-bits nrrds correctly.
Default is false.
The list of all the slices associated to this volume
Spacing to apply to the volume from IJK to RAS coordinate system
The voxels with values over this threshold won't appear in the slices. If changed, geometryNeedsUpdate is automatically set to true on all the slices associated to this volume
Width of the volume in the IJK coordinate system.
Default is 1.
Height of the volume in the IJK coordinate system.
Default is 1.
Depth of the volume in the IJK coordinate system.
Default is 1.
Compute the index in the data array corresponding to the given coordinates in IJK system.
i
First coordinate.
j
Second coordinate.
k
Third coordinate.
Returns: The index.
Compute the minimum and the maximum of the data in the volume.
Returns: The min/max data as [min,max].
Compute the orientation of the slice and returns all the information relative to the geometry such as sliceAccess, the plane matrix (orientation and position in RAS coordinate) and the dimensions of the plane in both coordinate system.
axis
The normal axis to the slice.
RASIndex
The index of the slice.
Returns: An object containing all the useful information on the geometry of the slice.
Returns a slice corresponding to the given axis and index. The coordinate are given in the Right Anterior Superior coordinate format.
axis
The normal axis to the slice.
index
The index of the slice.
Returns: The extracted slice.
Shortcut for data[access(i,j,k)].
i
First coordinate.
j
Second coordinate.
k
Third coordinate.
Returns: The value in the data array.
Apply a function to all the voxels, be careful, the value will be replaced.
functionToMap
A function to apply to every voxel, will be called with the following parameters: value of the voxel, index of the voxel, the data (TypedArray).
context
You can specify a context in which call the function, default if this Volume.
Returns: A reference to this instance.
Call repaint on all the slices extracted from this volume.
See:
Returns: A reference to this volume.
Retrieve the IJK coordinates of the voxel corresponding of the given index in the data.
index
Index of the voxel.
Returns: The IJK coordinates as [x,y,z].