Skip to content

copper3d / Modules / Utils/segmentation/DrawToolCore / DrawToolCore

Class: DrawToolCore

Utils/segmentation/DrawToolCore.DrawToolCore

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new DrawToolCore(container)

Parameters

NameType
containerHTMLElement

Overrides

CommToolsData.constructor

Defined in

src/Utils/segmentation/DrawToolCore.ts:49

Properties

baseCanvasesSize

baseCanvasesSize: number = 1

Inherited from

CommToolsData.baseCanvasesSize

Defined in

src/Utils/segmentation/CommToolsData.ts:15


container

container: HTMLElement

Defined in

src/Utils/segmentation/DrawToolCore.ts:16


contrastEventPrameters

contrastEventPrameters: IContrastEvents

Defined in

src/Utils/segmentation/DrawToolCore.ts:29


cursorPage

cursorPage: ICursorPage

Inherited from

CommToolsData.cursorPage

Defined in

src/Utils/segmentation/CommToolsData.ts:81


drawingPrameters

drawingPrameters: IDrawingEvents

Defined in

src/Utils/segmentation/DrawToolCore.ts:18


eraserUrls

eraserUrls: string[] = []

Defined in

src/Utils/segmentation/DrawToolCore.ts:42


gui_states

gui_states: IGUIStates

Inherited from

CommToolsData.gui_states

Defined in

src/Utils/segmentation/CommToolsData.ts:102


mainAreaContainer

mainAreaContainer: HTMLDivElement

Defined in

src/Utils/segmentation/DrawToolCore.ts:17


nrrd_states

nrrd_states: INrrdStates

Inherited from

CommToolsData.nrrd_states

Defined in

src/Utils/segmentation/CommToolsData.ts:16


pencilUrls

pencilUrls: string[] = []

Defined in

src/Utils/segmentation/DrawToolCore.ts:43


protectedData

protectedData: IProtected

Inherited from

CommToolsData.protectedData

Defined in

src/Utils/segmentation/CommToolsData.ts:154


start

start: () => void

Type declaration

▸ (): void

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:47


undoArray

undoArray: IUndoType[] = []

Defined in

src/Utils/segmentation/DrawToolCore.ts:44

Methods

checkSharedPlaceSlice

checkSharedPlaceSlice(width, height, imageData): Uint8ClampedArray

**************************** Utils for store image and itksnap core *************************************

Parameters

NameType
widthnumber
heightnumber
imageDataImageData

Returns

Uint8ClampedArray

Defined in

src/Utils/segmentation/DrawToolCore.ts:1933


clearPaint

clearPaint(): void

Clear mask on current slice canvas

Returns

void

Overrides

CommToolsData.clearPaint

Defined in

src/Utils/segmentation/DrawToolCore.ts:1468


clearSphereCanvas

Private clearSphereCanvas(): (HTMLCanvasElement | CanvasRenderingContext2D)[]

Returns

(HTMLCanvasElement | CanvasRenderingContext2D)[]

Defined in

src/Utils/segmentation/DrawToolCore.ts:1280


clearSpherePrintStoreImages

Private clearSpherePrintStoreImages(): void

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:225


clearStoreImages

clearStoreImages(): void

Rewrite this {clearStoreImages} function under NrrdTools

Returns

void

Inherited from

CommToolsData.clearStoreImages

Defined in

src/Utils/segmentation/CommToolsData.ts:242


configContrastDragMode

configContrastDragMode(): void

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:2078


configMouseSphereWheel

Private configMouseSphereWheel(): (e: WheelEvent) => void

Returns

fn

▸ (e): void

Parameters
NameType
eWheelEvent
Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:1203


configMouseZoomWheel

Private configMouseZoomWheel(): (e: WheelEvent) => void

Returns

fn

▸ (e): void

Parameters
NameType
eWheelEvent
Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:963


convertCursorPoint

convertCursorPoint(from, to, cursorNumX, cursorNumY, currentSliceIndex): undefined | { convertCursorNumX: number ; convertCursorNumY: number ; currentIndex: number ; oldIndex: number }

We generate the MRI slice from threejs based on mm, but when we display it is based on pixel size/distance. So, the index munber on each axis (sagittal, axial, coronal) is the slice's depth in mm distance. And the width and height displayed on screen is the slice's width and height in pixel distance.

When we switch into different axis' views, we need to convert current view's the depth to the pixel distance in other views width or height, and convert the current view's width or height from pixel distance to mm distance as other views' depth (slice index) in general.

Then as for the crosshair (Cursor Inspector), we also need to convert the cursor point (x, y, z) to other views' (x, y, z).

Parameters

NameTypeDescription
from"z" | "y" | "x""x" | "y" | "z", current view axis, "x: sagittle, y: coronal, z: axial".
to"z" | "y" | "x""x" | "y" | "z", target view axis (where you want jump to), "x: sagittle, y: coronal, z: axial".
cursorNumXnumbernumber, cursor point x on current axis's slice. (pixel distance)
cursorNumYnumbernumber, cursor point y on current axis's slice. (pixel distance)
currentSliceIndexnumbernumber, current axis's slice's index/depth. (mm distance)

Returns

undefined | { convertCursorNumX: number ; convertCursorNumY: number ; currentIndex: number ; oldIndex: number }

Overrides

CommToolsData.convertCursorPoint

Defined in

src/Utils/segmentation/DrawToolCore.ts:1311


createEmptyPaintImage

createEmptyPaintImage(dimensions, paintImages): void

Rewrite this {createEmptyPaintImage} function under NrrdTools

Parameters

NameType
dimensionsnumber[]
paintImagesIPaintImages

Returns

void

Inherited from

CommToolsData.createEmptyPaintImage

Defined in

src/Utils/segmentation/CommToolsData.ts:250


draw

draw(opts?): void

Parameters

NameType
opts?IDrawOpts

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:143


drawCalSphereDown

drawCalSphereDown(x, y, sliceIndex, cal_position): void

Parameters

NameType
xnumber
ynumber
sliceIndexnumber
cal_position"tumour" | "skin" | "nipple" | "ribcage"

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:152


drawCalSphereUp

drawCalSphereUp(): void

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:196


drawCalculatorSphere

drawCalculatorSphere(radius): void

Parameters

NameType
radiusnumber

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:1225


drawCalculatorSphereOnEachViews

drawCalculatorSphereOnEachViews(axis): void

Parameters

NameType
axis"z" | "y" | "x"

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:1059


drawImageOnEmptyImage

drawImageOnEmptyImage(canvas): void

Parameters

NameType
canvasHTMLCanvasElement

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:1040


drawLine

Private drawLine(x1, y1, x2, y2): void

***********************************May consider to move outside ******************************************

Parameters

NameType
x1number
y1number
x2number
y2number

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:821


drawLinesOnLayer

Private drawLinesOnLayer(ctx, x, y): void

Parameters

NameType
ctxCanvasRenderingContext2D
xnumber
ynumber

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:829


drawSphere

drawSphere(mouseX, mouseY, radius): void

Parameters

NameType
mouseXnumber
mouseYnumber
radiusnumber

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:1256


drawSphereCore

Private drawSphereCore(ctx, x, y, radius, color): void

Parameters

NameTypeDescription
ctxCanvasRenderingContext2Ddraw sphere canvas ctx
xnumberwidth must be match the origin size, size factor 1, ignore the size factor
ynumberheight must be match the origin size, size factor 1, ignore the size factor
radiusnumberradius must be match the origin size, size factor 1, ignore the size factor
colorstringsphere color

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:1166


drawSphereOnEachViews

Private drawSphereOnEachViews(decay, axis): void

Parameters

NameType
decaynumber
axis"z" | "y" | "x"

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:1128


enableCrosshair

Private enableCrosshair(): void

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:1019


filterDrawedImage

filterDrawedImage(axis, sliceIndex, paintedImages): IPaintImage

Get a painted mask image (IPaintImage) based on current axis and input slice index.

Parameters

NameTypeDescription
axis"z" | "y" | "x""x" | "y" | "z"
sliceIndexnumbernumber
paintedImagesIPaintImagesIPaintImages, All painted mask images.

Returns

IPaintImage

Inherited from

CommToolsData.filterDrawedImage

Defined in

src/Utils/segmentation/CommToolsData.ts:353


findSliceInSharedPlace

findSliceInSharedPlace(): ImageData[]

Returns

ImageData[]

Defined in

src/Utils/segmentation/DrawToolCore.ts:1973


flipDisplayImageByAxis

flipDisplayImageByAxis(): void

Rewrite this {flipDisplayImageByAxis} function under NrrdTools

Returns

void

Inherited from

CommToolsData.flipDisplayImageByAxis

Defined in

src/Utils/segmentation/CommToolsData.ts:285


getCurrentUndo

Private getCurrentUndo(): IUndoType[]

************************** Undo clear functions***************************************************

Returns

IUndoType[]

Defined in

src/Utils/segmentation/DrawToolCore.ts:1459


getRestLabel

getRestLabel(): ("label1" | "label2" | "label3")[]

label div controls*************************

Returns

("label1" | "label2" | "label3")[]

Defined in

src/Utils/segmentation/DrawToolCore.ts:1449


getSpherePosition

Private getSpherePosition(position, axis): Object

Sphere calculate distance functions*************************

Parameters

NameType
positionICommXYZ
axis"z" | "y" | "x"

Returns

Object

NameType
xany
yany
zany

Defined in

src/Utils/segmentation/DrawToolCore.ts:1052


initAllCanvas

Private initAllCanvas(): void

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:864


initDrawToolCore

Private initDrawToolCore(): void

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:58


paintOnCanvas

Private paintOnCanvas(): void

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:235


paintOnCanvasLayer

Private paintOnCanvasLayer(x, y): void

Parameters

NameType
xnumber
ynumber

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:852


redrawDisplayCanvas

redrawDisplayCanvas(): void

Rewrite this {redrawDisplayCanvas} function under NrrdTools

Returns

void

Inherited from

CommToolsData.redrawDisplayCanvas

Defined in

src/Utils/segmentation/CommToolsData.ts:339


removeContrastDragMode

removeContrastDragMode(): void

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:2092


replaceArray

replaceArray(mainArr, replaceArr): void

Parameters

NameType
mainArrnumber[] | Uint8ClampedArray
replaceArrnumber[] | Uint8ClampedArray

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:1960


replaceHorizontalRowPixels

replaceHorizontalRowPixels(paintImageArray, length, ratio, markedArr, targetWidth, convertIndex): void

Parameters

NameTypeDescription
paintImageArrayIPaintImage[]: the target view slice's marked images array
lengthnumber: the target view slice's dimention (total slice index num)
rationumber: the target slice image's width/height ratio of its dimention length
markedArrnumber[][] | Uint8ClampedArray[]: current painted image's horizontal 2d Array
targetWidthnumber: the target image width
convertIndexnumber: Mapping current image's index to target slice image's width/height pixel start point

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:1912


replaceVerticalColPixels

replaceVerticalColPixels(paintImageArray, length, ratio, markedArr, targetWidth, convertIndex): void

Parameters

NameTypeDescription
paintImageArrayIPaintImage[]: the target view slice's marked images array
lengthnumber: the target view slice's dimention (total slice index num)
rationumber: the target slice image's width/height ratio of its dimention length
markedArrnumber[][] | Uint8ClampedArray[]: current painted image's vertical 2d Array
targetWidthnumber: the target image width
convertIndexnumber: Mapping current image's index to target slice image's width/height pixel start point

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:1879


repraintCurrentContrastSlice

repraintCurrentContrastSlice(): void

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:2142


resetLayerCanvas

resetLayerCanvas(): void

Rewrite this {resetLayerCanvas} function under NrrdTools

Returns

void

Inherited from

CommToolsData.resetLayerCanvas

Defined in

src/Utils/segmentation/CommToolsData.ts:323


resetPaintAreaUIPosition

resetPaintAreaUIPosition(l?, t?): void

Rewrite this {resetPaintAreaUIPosition} function under NrrdTools

Parameters

NameType
l?number
t?number

Returns

void

Inherited from

CommToolsData.resetPaintAreaUIPosition

Defined in

src/Utils/segmentation/CommToolsData.ts:293


resizePaintArea

resizePaintArea(factor): void

Rewrite this {resizePaintArea} function under NrrdTools

Parameters

NameType
factornumber

Returns

void

Inherited from

CommToolsData.resizePaintArea

Defined in

src/Utils/segmentation/CommToolsData.ts:261


setCurrentLayer

Private setCurrentLayer(): Object

Returns

Object

NameType
canvasHTMLCanvasElement
ctxCanvasRenderingContext2D

Defined in

src/Utils/segmentation/DrawToolCore.ts:119


setEmptyCanvasSize

setEmptyCanvasSize(axis?): void

Rewrite this {resetPaintAreaUIPosition} function under NrrdTools

Parameters

NameType
axis?"z" | "y" | "x"

Returns

void

Inherited from

CommToolsData.setEmptyCanvasSize

Defined in

src/Utils/segmentation/CommToolsData.ts:301


setEraserUrls

setEraserUrls(urls): void

Parameters

NameType
urlsstring[]

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:106


setIsDrawFalse

setIsDrawFalse(target): void

Rewrite this {setIsDrawFalse} function under NrrdTools

Parameters

NameType
targetnumber

Returns

void

Inherited from

CommToolsData.setIsDrawFalse

Defined in

src/Utils/segmentation/CommToolsData.ts:269


setPencilIconUrls

setPencilIconUrls(urls): void

Parameters

NameType
urlsstring[]

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:109


setSphereCanvasSize

Private setSphereCanvasSize(axis?): void

Parameters

NameType
axis?"z" | "y" | "x"

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:1180


setSyncsliceNum

setSyncsliceNum(): void

Rewrite this {setSyncsliceNum} function under NrrdTools

Returns

void

Inherited from

CommToolsData.setSyncsliceNum

Defined in

src/Utils/segmentation/CommToolsData.ts:331


setUpSphereOrigins

Private setUpSphereOrigins(mouseX, mouseY, sliceIndex): void

Parameters

NameType
mouseXnumber
mouseYnumber
sliceIndexnumber

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:1406


setupConrastEvents

setupConrastEvents(callback): void

Set up root container events fns for drag function

Parameters

NameType
callback(step: number, towards: "horizental" | "vertical") => void

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:2025


sliceArrayH

sliceArrayH(arr, row, col): Uint8ClampedArray[]

Parameters

NameType
arrUint8ClampedArray
rownumber
colnumber

Returns

Uint8ClampedArray[]

Defined in

src/Utils/segmentation/DrawToolCore.ts:1841


sliceArrayV

sliceArrayV(arr, row, col): number[][]

Parameters

NameType
arrUint8ClampedArray
rownumber
colnumber

Returns

number[][]

Defined in

src/Utils/segmentation/DrawToolCore.ts:1852


storeAllImages

storeAllImages(index, label): void

Parameters

NameType
indexnumber
labelstring

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:1598


storeEachLayerImage

storeEachLayerImage(index, label): void

Parameters

NameType
indexnumber
labelstring

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:1799


storeImageToAxis

storeImageToAxis(index, paintedImages, imageData, axis?): void

Store images*************************

Parameters

NameType
indexnumber
paintedImagesIPaintImages
imageDataImageData
axis?"z" | "y" | "x"

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:1564


storeImageToLabel

storeImageToLabel(index, canvas, paintedImages): ImageData

Parameters

NameType
indexnumber
canvasHTMLCanvasElement
paintedImagesIPaintImages

Returns

ImageData

Defined in

src/Utils/segmentation/DrawToolCore.ts:1779


storeSphereImages

Private storeSphereImages(index, axis): void

Sphere functions*************************

Parameters

NameType
indexnumber
axis"z" | "y" | "x"

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:1111


undoLastPainting

undoLastPainting(): void

Rewrite this {undoLastPainting} function under DrawToolCore

Returns

void

Overrides

CommToolsData.undoLastPainting

Defined in

src/Utils/segmentation/DrawToolCore.ts:1487


updateOriginAndChangedWH

updateOriginAndChangedWH(): void

Rewrite this {updateOriginAndChangedWH} function under NrrdTools

Returns

void

Inherited from

CommToolsData.updateOriginAndChangedWH

Defined in

src/Utils/segmentation/CommToolsData.ts:277


updateSlicesContrast

updateSlicesContrast(value, flag): void

Parameters

NameType
valuenumber
flagstring

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:2116


useEraser

Private useEraser(): (x: number, y: number, radius: number) => void

Returns

fn

▸ (x, y, radius): void

Parameters
NameType
xnumber
ynumber
radiusnumber
Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:922


zoomActionAfterDrawSphere

Private zoomActionAfterDrawSphere(): void

Returns

void

Defined in

src/Utils/segmentation/DrawToolCore.ts:218