ImageΒΆ
An Image
is the N-dimensional image data structure for itk-wasm.
Image
is a JavaScript object with the following properties:
imageType
: The ImageType for this image.name
: An optional name string that describes this image.origin
An Array with lengthimageType.dimension
that describes the location of the center of the lower left pixel in physical units.spacing
: An Array with lengthdimension
that describes the spacing between pixel in physical units.direction
: Adimension
bydimension
lengthFloat64Array
in column-major order, that describes the orientation of the image at itsorigin
The orientation of each axis are the orthonormal columns.size
: An Array with lengthdimension
that contains the number of pixels along dimension.data
: ATypedArray
containing the pixel buffer data.metadata
: AMap
of string keys to values that could be strings, string arrays, numbers, number arrays, or arrays of number arrays providing additional metadata for the image.
For more information, see the description of an itk::Image
in the ITK Software Guide.
Note that the origin
, spacing
, direction
, and size
are indexed with an x
, y
, z
convention ordering. This is the reverse indexing convention relative to other libraries such as TensorFlow.js. To generate a TensorFlow tensor from an Image
, image
:
const tensor = tf.tensor(image.data, image.size.reverse())
To visualize an Image
with vtk.js use convertItkToVtkImage
from vtk.js/Sources/Common/DataModel/ITKHelper
.