SharedImageSet
Set of images independent of their storage location.
This class is the main high-level container for image data consisting of one or multiple images or volumes.
Extends
Accessors
Inherited from Data
| Accessor | Description |
|---|---|
| name | The name of the dataset |
Methods
| Method | Description |
|---|---|
| autoWindow() | Perform an automatic windowing of the dataset so that the entire intensity range is visible. |
| focus() | Returns the index of the focused image in the image set. |
| setFocus() | Sets the focus to the image at the given index. |
| size() | Returns the number of images in the image set. |
| add() | Add an image to the image set. |
| remove() | Remove an image from the image set at the specified index. |
| imageInfo() | Returns the ImageInfo of this SharedImageSet if present. |
| setModality() | Set image modality for all frames |
| isMultiModal() | Return true if set contains images of different modalities, false otherwise |
| clear() | Clear all data and delete it if owned |
| hasTransformations() | Return true if at least one image in the set has a matrix transformation unequal identity. |
| hasTimestamps() | Return if all image frames have timestamps |
| allEqual() | Return if all image descriptors are the same |
| get() | Get a specific image from the image set as a ref-counted handle. |
| descriptor() | Returns the descriptor for the given imageIndex, or the currently focused image if imageIndex is omitted. |
| setTimestamp() | Set specific or focused timestamp in seconds. |
| timestamp() | Get specific or focused timestamp in seconds. |
| displayOptions2d() | Returns the handle to the 2d display options used by slice renderers to render this dataset. |
| displayOptions3d() | Returns the handle to the 3d display options used by volume renderers to render this dataset. |
| onSelectionChanged() | Fires when the selection (focus) of the image set changes. |
| histogram() | Computes the intensity histogram of this image over the entire [range of available image pixels]SharedImageSetHandle#minmaxIntensityOriginal. |
| timestamps() | Get the timestamps sequence |
| thumbnail() | Creates a thumbnail for the image at the given index. |
| minmaxIntensityOriginal() | Returns the intensity range of this image in original value domain. |
| matrixFromWorld() | Get image matrix mapping from the world coordinate system. |
| matrixToWorld() | Get image matrix mapping from the world coordinate system. |
| setMatrixFromWorld() | Set image matrix mapping from the world coordinate system. |
| setMatrixToWorld() | Set image matrix mapping from the world coordinate system. |
Inherited from Data
| Method | Description |
|---|---|
| kind() | Returns the kind of this data. |
| modality() | Returns the modality of this data. |
| bounds() | Returns the axis-aligned bounding box of this data in world space. |
Inherited from ClassHandle
| Method | Description |
|---|---|
| isAliasOf() | Returns true if this handle and other alias the same underlying C++ object. |
| delete() | Releases this JavaScript handle. |
| deleteLater() | Schedules this handle for deferred deletion and returns this handle. |
| isDeleted() | Returns true if this handle has already been deleted. |
| [dispose]() | Releases this handle when the enclosing scope exits, so a handle can be declared with using instead of calling delete() later manually. |
| clone() | Returns a new JavaScript handle aliasing the same underlying C++ object. |
autoWindow()
autoWindow(): void;Perform an automatic windowing of the dataset so that the entire intensity range is visible.
Returns
void
focus()
focus(): number;Returns the index of the focused image in the image set.
Returns
number
setFocus()
setFocus(focus: number): void;Sets the focus to the image at the given index.
Parameters
| Parameter | Type |
|---|---|
focus | number |
Returns
void
true if the focus was set successfully, false otherwise.
size()
size(): number;Returns the number of images in the image set.
Returns
number
add()
add(img: Image | null): void;Add an image to the image set.
Parameters
| Parameter | Type | Description |
|---|---|---|
img | Image | null | Ref-counted handle to the image to add to the set. |
Returns
void
remove()
remove(index: number): void;Remove an image from the image set at the specified index.
Parameters
| Parameter | Type | Description |
|---|---|---|
index | number | Index of the image to remove. |
Returns
void
imageInfo()
imageInfo(): ImageInfo | null;Returns the ImageInfo of this SharedImageSet if present.
Returns
ImageInfo | null
setModality()
setModality(modality: DataModality): void;Set image modality for all frames
Parameters
| Parameter | Type |
|---|---|
modality | DataModality |
Returns
void
isMultiModal()
isMultiModal(): boolean;Return true if set contains images of different modalities, false otherwise
Returns
boolean
clear()
clear(): void;Clear all data and delete it if owned
Returns
void
hasTransformations()
hasTransformations(): boolean;Return true if at least one image in the set has a matrix transformation unequal identity.
Returns
boolean
hasTimestamps()
hasTimestamps(): boolean;Return if all image frames have timestamps
Returns
boolean
allEqual()
allEqual(): boolean;Return if all image descriptors are the same
Returns
boolean
get()
get(index?: number): Image | null;Get a specific image from the image set as a ref-counted handle.
While the garbage collector will eventually decrement the reference count, it is recommended to manually call delete() on the returned handle once it is no longer needed on the JS side.
Parameters
| Parameter | Type | Description |
|---|---|---|
index? | number | Index of the image to get. If not provided, the focused image is returned. |
Returns
Image | null
image at index index if it exists, otherwise null.
Example
const image = imageSet.get(0);
otherImageSet.add(image); // otherImageSet now has shared ownership of the image
image.delete(); // image is now invalid on the JS side, but remains valid inside otherImageSet.descriptor()
descriptor(imageIndex?: number): ImageDescriptor;Returns the descriptor for the given imageIndex, or the currently focused image if imageIndex is omitted.
Parameters
| Parameter | Type | Description |
|---|---|---|
imageIndex? | number | Defaults to the currently focused image if omitted. |
Returns
Once the handle to the returned object is no longer needed on the JS side, it must be released by calling delete(). Prefer declaring the variable with using so this happens automatically:
using descriptor = imageSet.descriptor();setTimestamp()
setTimestamp(timeInSeconds: number, imageIndex?: number): void;Set specific or focused timestamp in seconds.
Parameters
| Parameter | Type | Description |
|---|---|---|
timeInSeconds | number | - |
imageIndex? | number | Defaults to the currently focused image if omitted |
Returns
void
timestamp()
timestamp(imageIndex?: number): number;Get specific or focused timestamp in seconds.
Parameters
| Parameter | Type | Description |
|---|---|---|
imageIndex? | number | Defaults to the currently focused image if omitted |
Returns
number
displayOptions2d()
displayOptions2d(): DisplayOptions2d;Returns the handle to the 2d display options used by slice renderers to render this dataset.
Returns
displayOptions3d()
displayOptions3d(): DisplayOptions3d;Returns the handle to the 3d display options used by volume renderers to render this dataset.
Returns
onSelectionChanged()
onSelectionChanged(callback: () => void): () => void;Fires when the selection (focus) of the image set changes.
Parameters
| Parameter | Type |
|---|---|
callback | () => void |
Returns
Unsubscribe function.
() => void
histogram()
histogram(numBins: number): number[];Computes the intensity histogram of this image over the entire [range of available image pixels]SharedImageSetHandle#minmaxIntensityOriginal.
Parameters
| Parameter | Type | Description |
|---|---|---|
numBins | number | Number of bins the returned histogram should have. |
Returns
number[]
array of numBins numbers, each number corresponds to the number of image pixels that have an intensity corresponding to that bin.
timestamps()
timestamps(): number[];Get the timestamps sequence
Returns
number[]
thumbnail()
thumbnail(
index: number,
width: number,
height: number): Uint8Array;Creates a thumbnail for the image at the given index.
Parameters
| Parameter | Type | Description |
|---|---|---|
index | number | Index of the image to create a thumbnail for. |
width | number | Width of the thumbnail in pixels. |
height | number | Height of the thumbnail in pixels. |
Returns
A JS-owned Uint8Array containing the PNG-encoded thumbnail image.
Example
const bytes = sis.thumbnail(0, 32, 32);
const url = URL.createObjectURL(new Blob([bytes], { type: 'image/png' }));
img.src = url; // display the imageminmaxIntensityOriginal()
minmaxIntensityOriginal(): vec2;Returns the intensity range of this image in original value domain.
Returns
array of 2 numbers: minimum and maximum intensity
matrixFromWorld()
matrixFromWorld(imageIndex?: number): mat4;Get image matrix mapping from the world coordinate system.
Parameters
| Parameter | Type | Description |
|---|---|---|
imageIndex? | number | The index of the image in the SharedImageset, if omitted, the currently focused image will be used. |
Returns
matrixToWorld()
matrixToWorld(imageIndex?: number): mat4;Get image matrix mapping from the world coordinate system.
Parameters
| Parameter | Type | Description |
|---|---|---|
imageIndex? | number | The index of the image in the SharedImageset, if omitted, the currently focused image will be used. |
Returns
setMatrixFromWorld()
setMatrixFromWorld(
m: mat4,
imageIndex?: number,
updateAll?: boolean): void;Set image matrix mapping from the world coordinate system.
Parameters
| Parameter | Type | Description |
|---|---|---|
m | mat4 | - |
imageIndex? | number | The index of the image in the SharedImageset, if omitted, the currently focused image will be used. The currently focused image will also be used if the given imageIndex is out of bounds. |
updateAll? | boolean | If set, the matrices of all images are updated relative to the given imageIndex. Defaults to false |
Returns
void
setMatrixToWorld()
setMatrixToWorld(
m: mat4,
imageIndex?: number,
updateAll?: boolean): void;Set image matrix mapping from the world coordinate system.
Parameters
| Parameter | Type | Description |
|---|---|---|
m | mat4 | - |
imageIndex? | number | The index of the image in the SharedImageset, if omitted, the currently focused image will be used. The currently focused image will also be used if the given imageIndex is out of bounds. |
updateAll? | boolean | If set, the matrices of all images are updated relative to the given imageIndex. Defaults to false |
Returns
void