Geometry

2D/3D Geometry class.

Constructor

new Geometry(origin, size, spacing, orientationopt, timeopt)

Parameters:
NameTypeAttributesDescription
originPoint3D

The object origin (a 3D point).

sizeSize

The object size.

spacingSpacing

The object spacing.

orientationMatrix33<optional>

The object orientation (33 matrix, default to 33 identity).

timenumber<optional>

Optional time index.

Classes

Geometry

Methods

appendFrame(origin, time)

Append a frame to the geometry.

Parameters:
NameTypeDescription
originPoint3D

The origin to append.

timenumber

Optional time index.

appendOrigin(origin, index, timeopt)

Append an origin to the geometry.

Parameters:
NameTypeAttributesDescription
originPoint3D

The origin to append.

indexnumber

The index at which to append.

timenumber<optional>

Optional time index.

equals(rhs) → {boolean}

Check for equality.

Parameters:
NameTypeDescription
rhsGeometry

The object to compare to.

Returns:

True if both objects are equal.

Type: 
boolean

getCurrentNumberOfSlicesBeforeTime(time) → {number|undefined}

Get the number of slices stored for time points preceding the input one.

Parameters:
NameTypeDescription
timenumber

The time point to check.

Returns:

The count.

Type: 
number | undefined

getCurrentTotalNumberOfSlices() → {number}

Get the total number of slices. Can be different from what is stored in the size object during a volume with time points creation process.

Returns:

The total count.

Type: 
number

getInitialTime() → {number}

Get the time value that was passed at construction.

Returns:

The time value.

Type: 
number

getOrientation() → {Matrix33}

Get the object orientation.

Returns:

The object orientation.

Type: 
Matrix33

getOrigin() → {Point3D}

Get the object origin. This should be the lowest origin to ease calculations (?).

Returns:

The object origin.

Type: 
Point3D

getOrigins() → {Array.<Point3D>}

Get the object origins.

Returns:

The object origins.

Type: 
Array.<Point3D>

getRealSpacing() → {Spacing}

Get the image spacing in real world.

Returns:

The object spacing.

Type: 
Spacing

getSize(viewOrientationopt) → {Size}

Get the object size. Warning: the size comes as stored in DICOM, meaning that it could be oriented.

Parameters:
NameTypeAttributesDescription
viewOrientationMatrix33<optional>

The view orientation (optional).

Returns:

The object size.

Type: 
Size

getSliceIndex(point, time) → {number}

Get the slice position of a point in the current slice layout. Slice indices increase with decreasing origins (high index -> low origin), this simplified the handling of reconstruction since it means the displayed data is in the same 'direction' as the extracted data. As seen in the getOrigin method, the main origin is the lowest one. This implies that the index to world and reverse method do some flipping magic...

Parameters:
NameTypeDescription
pointPoint3D

The point to evaluate.

timenumber

Optional time index.

Returns:

The slice index.

Type: 
number

getSpacing(viewOrientationopt) → {Spacing}

Get the object spacing. Warning: the spacing comes as stored in DICOM, meaning that it could be oriented.

Parameters:
NameTypeAttributesDescription
viewOrientationMatrix33<optional>

The view orientation (optional).

Returns:

The object spacing.

Type: 
Spacing

hasSlicesAtTime(time) → {boolean}

Check if a time point has associated slices.

Parameters:
NameTypeDescription
timenumber

The time point to check.

Returns:

True if slices are present.

Type: 
boolean

includesOrigin(point3D, tol) → {boolean}

Check if a point is in the origin list.

Parameters:
NameTypeDescription
point3DPoint3D

The point to check.

tolnumber

The comparison tolerance default to Number.EPSILON.

Returns:

True if in list.

Type: 
boolean

indexToWorld(index) → {Point}

Convert an index into world coordinates.

Parameters:
NameTypeDescription
indexIndex

The index to convert.

Returns:

The corresponding point.

Type: 
Point

isInBounds(point) → {boolean}

Check that a point is within bounds.

Parameters:
NameTypeDescription
pointPoint

The point to check.

Returns:

True if the given coordinates are within bounds.

Type: 
boolean

isIndexInBounds(index, dirsopt) → {boolean}

Check that a index is within bounds.

Parameters:
NameTypeAttributesDescription
indexIndex

The index to check.

dirsArray.<number><optional>

Optional list of directions to check.

Returns:

True if the given coordinates are within bounds.

Type: 
boolean

pointToWorld(point) → {Point3D}

Convert a 3D point into world coordinates.

Parameters:
NameTypeDescription
pointPoint3D

The 3D point to convert.

Returns:

The corresponding world 3D point.

Type: 
Point3D

toString() → {string}

Get a string representation of the geometry.

Returns:

The geometry as a string.

Type: 
string

worldToIndex(point) → {Index}

Convert world coordinates into an index.

Parameters:
NameTypeDescription
pointPoint

The point to convert.

Returns:

The corresponding index.

Type: 
Index

worldToPoint(point) → {Point3D}

Convert world coordinates into an point.

Parameters:
NameTypeDescription
pointPoint

The world point to convert.

Returns:

The corresponding point.

Type: 
Point3D