Image

dwv.image. Image

new Image(geometry, buffer, imageUids)

Source:

Image class. Usable once created, optional are:

  • rescale slope and intercept (default 1:0),
  • photometric interpretation (default MONOCHROME2),
  • planar configuration (default RGBRGB...).
Parameters:
Name Type Description
geometry dwv.image.Geometry

The geometry of the image.

buffer Array

The image data as a one dimensional buffer.

imageUids Array

An array of Uids indexed to slice number.

Methods

addEventListener(type, callback)

Source:

Add an event listener to this class.

Parameters:
Name Type Description
type string

The event type.

callback object

The method associated with the provided event type, will be called with the fired event.

appendFrame()

Source:

Append a frame to the image.

appendFrameBuffer(frameBuffer, frameIndex)

Source:

Append a frame buffer to the image.

Parameters:
Name Type Description
frameBuffer object

The frame buffer to append.

frameIndex number

The frame index.

appendSlice(rhs, timeId)

Source:

Append a slice to the image.

Parameters:
Name Type Description
rhs Image

The slice to append.

timeId number

An optional time ID.

calculateDataRange() → {object}

Source:

Calculate the data range of the image. WARNING: for speed reasons, only calculated on the first frame...

Returns:

The range {min, max}.

Type
object

calculateHistogram() → {object}

Source:

Calculate the histogram of the image.

Returns:

The histogram, data range and rescaled data range.

Type
object

calculateRescaledDataRange() → {object}

Source:

Calculate the rescaled data range of the image. WARNING: for speed reasons, only calculated on the first frame...

Returns:

The range {min, max}.

Type
object

canQuantify() → {boolean}

Source:

Can the image values be quantified?

Returns:

True if only one component.

Type
boolean

canScroll(viewOrientation) → {boolean}

Source:

Can the data be scrolled?

Parameters:
Name Type Description
viewOrientation dwv.math.Matrix33

The view orientation.

Returns:

True if the data has a third dimension greater than one after applying the view orientation.

Type
boolean

canWindowLevel() → {boolean}

Source:

Can window and level be applied to the data?

Returns:

True if the data is monochrome.

Type
boolean

clone() → {Image}

Source:

Clone the image.

Returns:

A clone of this image.

Type
Image

compose(rhs, operator) → {Image}

Source:

Compose this image with another one and using a specific operator. WARNING: no size check!

Parameters:
Name Type Description
rhs Image

The image to compose with.

operator function

The operator to use when composing.

Returns:

The composed image. Note: Uses the raw buffer values.

Type
Image

convolute2D(weights) → {Image}

Source:

Convolute the image with a given 2D kernel.

Note: Uses raw buffer values.

Parameters:
Name Type Description
weights Array

The weights of the 2D kernel as a 3x3 matrix.

Returns:

The convoluted image.

Type
Image

convoluteBuffer(weights, buffer, startOffset)

Source:

Convolute an image buffer with a given 2D kernel.

Note: Uses raw buffer values.

Parameters:
Name Type Description
weights Array

The weights of the 2D kernel as a 3x3 matrix.

buffer Array

The buffer to convolute.

startOffset number

The index to start at.

getBuffer() → {Array}

Source:
To Do:
  • dangerous...

Get the data buffer of the image.

Returns:

The data buffer of the image.

Type
Array

getDataRange() → {object}

Source:

Get the data range.

Returns:

The data range.

Type
object

getGeometry() → {dwv.image.Geometry}

Source:

Get the geometry of the image.

Returns:

The geometry.

Type
dwv.image.Geometry

getHistogram() → {Array}

Source:

Get the histogram.

Returns:

The histogram.

Type
Array

getImageUid(index) → {string}

Source:

Get the image UID at a given index.

Parameters:
Name Type Description
index dwv.math.Index

The index at which to get the id.

Returns:

The UID.

Type
string

getMeta() → {object}

Source:

Get the meta information of the image.

Returns:

The meta information of the image.

Type
object

getNumberOfComponents() → {number}

Source:

Get the numberOfComponents of the image.

Returns:

The numberOfComponents of the image.

Type
number

getPhotometricInterpretation() → {string}

Source:

Get the photometricInterpretation of the image.

Returns:

The photometricInterpretation of the image.

Type
string

getPlanarConfiguration() → {number}

Source:

Get the planarConfiguration of the image.

Returns:

The planarConfiguration of the image.

Type
number

getRescaledDataRange() → {object}

Source:

Get the rescaled data range.

Returns:

The rescaled data range.

Type
object

getRescaledValue(i, j, k, f) → {number}

Source:

Get the rescaled value of the image at a specific position.

Parameters:
Name Type Description
i number

The X index.

j number

The Y index.

k number

The Z index.

f number

The frame number.

Returns:

The rescaled value at the desired position. Warning: No size check...

Type
number

getRescaledValueAtIndex(index) → {number}

Source:

Get the rescaled value of the image at a specific index.

Parameters:
Name Type Description
index dwv.math.Index

The index.

Returns:

The rescaled value at the desired position. Warning: No size check...

Type
number

getRescaledValueAtOffset(offset) → {number}

Source:

Get the rescaled value of the image at a specific offset.

Parameters:
Name Type Description
offset number

The desired offset.

Returns:

The rescaled value at the desired offset. Warning: No size check...

Type
number

getRescaleSlopeAndIntercept(index) → {object}

Source:

Get the rescale slope and intercept.

Parameters:
Name Type Description
index dwv.math.Index

The index (only needed for non constant rsi).

Returns:

The rescale slope and intercept.

Type
object

getSecondaryOffset(index) → {number}

Source:

Get the secondary offset: an offset that takes into account the slice and above dimension numbers.

Parameters:
Name Type Description
index dwv.math.Index

The index.

Returns:

The offset.

Type
number

getValue(i, j, k, f) → {number}

Source:

Get the value of the image at a specific coordinate.

Parameters:
Name Type Description
i number

The X index.

j number

The Y index.

k number

The Z index.

f number

The frame number.

Returns:

The value at the desired position. Warning: No size check...

Type
number

getValueAtIndex(index) → {number}

Source:

Get the value of the image at a specific index.

Parameters:
Name Type Description
index dwv.math.Index

The index.

Returns:

The value at the desired position. Warning: No size check...

Type
number

getValueAtOffset(offset) → {number}

Source:

Get value at offset. Warning: No size check...

Parameters:
Name Type Description
offset number

The desired offset.

Returns:

The value at offset.

Type
number

isConstantRSI() → {boolean}

Source:

Are all the RSIs equal.

Returns:

True if they are.

Type
boolean

isIdentityRSI() → {boolean}

Source:

Are all the RSIs identity (1,0).

Returns:

True if they are.

Type
boolean

removeEventListener(type, callback)

Source:

Remove an event listener from this class.

Parameters:
Name Type Description
type string

The event type.

callback object

The method associated with the provided event type.

setMeta(rhs)

Source:

Set the meta information of the image.

Parameters:
Name Type Description
rhs object

The meta information of the image.

setPhotometricInterpretation(interp)

Source:

Set the photometricInterpretation of the image.

Parameters:
Name Type Description
interp string

The photometricInterpretation of the image.

setPlanarConfiguration(config)

Source:

Set the planarConfiguration of the image.

Parameters:
Name Type Description
config number

The planarConfiguration of the image.

setRescaleSlopeAndIntercept(inRsi, offset)

Source:

Set the rescale slope and intercept.

Parameters:
Name Type Description
inRsi object

The input rescale slope and intercept.

offset number

The rsi offset (only needed for non constant rsi).

transform(operator) → {Image}

Source:

Transform an image using a specific operator. WARNING: no size check!

Parameters:
Name Type Description
operator function

The operator to use when transforming.

Returns:

The transformed image. Note: Uses the raw buffer values.

Type
Image

(inner) getRescaleSlopeAndInterceptAtOffset(offset) → {object}

Source:

Get the rsi at a specified (secondary) offset.

Parameters:
Name Type Description
offset number

The desired (secondary) offset.

Returns:

The coresponding rsi.

Type
object

(inner) getSecondaryOffsetMax() → {number}

Source:

Get the secondary offset max.

Returns:

The maximum offset.

Type
number

(inner) realloc(size)

Source:

Re-allocate buffer memory to an input size.

Parameters:
Name Type Description
size number

The new size.