Appearance
copper3d / Modules / Utils/segmentation/DrawToolCore / DrawToolCore
Class: DrawToolCore
Utils/segmentation/DrawToolCore.DrawToolCore
Hierarchy
↳
DrawToolCore
↳↳
NrrdTools
Table of contents
Constructors
Properties
- baseCanvasesSize
- container
- contrastEventPrameters
- cursorPage
- drawingPrameters
- eraserUrls
- gui_states
- mainAreaContainer
- nrrd_states
- pencilUrls
- protectedData
- start
- undoArray
Methods
- checkSharedPlaceSlice
- clearPaint
- clearSphereCanvas
- clearSpherePrintStoreImages
- clearStoreImages
- configContrastDragMode
- configMouseSphereWheel
- configMouseZoomWheel
- convertCursorPoint
- createEmptyPaintImage
- draw
- drawCalSphereDown
- drawCalSphereUp
- drawCalculatorSphere
- drawCalculatorSphereOnEachViews
- drawImageOnEmptyImage
- drawLine
- drawLinesOnLayer
- drawSphere
- drawSphereCore
- drawSphereOnEachViews
- enableCrosshair
- filterDrawedImage
- findSliceInSharedPlace
- flipDisplayImageByAxis
- getCurrentUndo
- getRestLabel
- getSpherePosition
- initAllCanvas
- initDrawToolCore
- paintOnCanvas
- paintOnCanvasLayer
- redrawDisplayCanvas
- removeContrastDragMode
- replaceArray
- replaceHorizontalRowPixels
- replaceVerticalColPixels
- repraintCurrentContrastSlice
- resetLayerCanvas
- resetPaintAreaUIPosition
- resizePaintArea
- setCurrentLayer
- setEmptyCanvasSize
- setEraserUrls
- setIsDrawFalse
- setPencilIconUrls
- setSphereCanvasSize
- setSyncsliceNum
- setUpSphereOrigins
- setupConrastEvents
- sliceArrayH
- sliceArrayV
- storeAllImages
- storeEachLayerImage
- storeImageToAxis
- storeImageToLabel
- storeSphereImages
- undoLastPainting
- updateOriginAndChangedWH
- updateSlicesContrast
- useEraser
- zoomActionAfterDrawSphere
Constructors
constructor
• new DrawToolCore(container
)
Parameters
Name | Type |
---|---|
container | HTMLElement |
Overrides
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
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
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
Defined in
src/Utils/segmentation/CommToolsData.ts:16
pencilUrls
• pencilUrls: string
[] = []
Defined in
src/Utils/segmentation/DrawToolCore.ts:43
protectedData
• protectedData: IProtected
Inherited from
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
Name | Type |
---|---|
width | number |
height | number |
imageData | ImageData |
Returns
Uint8ClampedArray
Defined in
src/Utils/segmentation/DrawToolCore.ts:1933
clearPaint
▸ clearPaint(): void
Clear mask on current slice canvas
Returns
void
Overrides
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
Name | Type |
---|---|
e | WheelEvent |
Returns
void
Defined in
src/Utils/segmentation/DrawToolCore.ts:1203
configMouseZoomWheel
▸ Private
configMouseZoomWheel(): (e
: WheelEvent
) => void
Returns
fn
▸ (e
): void
Parameters
Name | Type |
---|---|
e | WheelEvent |
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
Name | Type | Description |
---|---|---|
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". |
cursorNumX | number | number, cursor point x on current axis's slice. (pixel distance) |
cursorNumY | number | number, cursor point y on current axis's slice. (pixel distance) |
currentSliceIndex | number | number, 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
Name | Type |
---|---|
dimensions | number [] |
paintImages | IPaintImages |
Returns
void
Inherited from
CommToolsData.createEmptyPaintImage
Defined in
src/Utils/segmentation/CommToolsData.ts:250
draw
▸ draw(opts?
): void
Parameters
Name | Type |
---|---|
opts? | IDrawOpts |
Returns
void
Defined in
src/Utils/segmentation/DrawToolCore.ts:143
drawCalSphereDown
▸ drawCalSphereDown(x
, y
, sliceIndex
, cal_position
): void
Parameters
Name | Type |
---|---|
x | number |
y | number |
sliceIndex | number |
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
Name | Type |
---|---|
radius | number |
Returns
void
Defined in
src/Utils/segmentation/DrawToolCore.ts:1225
drawCalculatorSphereOnEachViews
▸ drawCalculatorSphereOnEachViews(axis
): void
Parameters
Name | Type |
---|---|
axis | "z" | "y" | "x" |
Returns
void
Defined in
src/Utils/segmentation/DrawToolCore.ts:1059
drawImageOnEmptyImage
▸ drawImageOnEmptyImage(canvas
): void
Parameters
Name | Type |
---|---|
canvas | HTMLCanvasElement |
Returns
void
Defined in
src/Utils/segmentation/DrawToolCore.ts:1040
drawLine
▸ Private
drawLine(x1
, y1
, x2
, y2
): void
***********************************May consider to move outside ******************************************
Parameters
Name | Type |
---|---|
x1 | number |
y1 | number |
x2 | number |
y2 | number |
Returns
void
Defined in
src/Utils/segmentation/DrawToolCore.ts:821
drawLinesOnLayer
▸ Private
drawLinesOnLayer(ctx
, x
, y
): void
Parameters
Name | Type |
---|---|
ctx | CanvasRenderingContext2D |
x | number |
y | number |
Returns
void
Defined in
src/Utils/segmentation/DrawToolCore.ts:829
drawSphere
▸ drawSphere(mouseX
, mouseY
, radius
): void
Parameters
Name | Type |
---|---|
mouseX | number |
mouseY | number |
radius | number |
Returns
void
Defined in
src/Utils/segmentation/DrawToolCore.ts:1256
drawSphereCore
▸ Private
drawSphereCore(ctx
, x
, y
, radius
, color
): void
Parameters
Name | Type | Description |
---|---|---|
ctx | CanvasRenderingContext2D | draw sphere canvas ctx |
x | number | width must be match the origin size, size factor 1, ignore the size factor |
y | number | height must be match the origin size, size factor 1, ignore the size factor |
radius | number | radius must be match the origin size, size factor 1, ignore the size factor |
color | string | sphere color |
Returns
void
Defined in
src/Utils/segmentation/DrawToolCore.ts:1166
drawSphereOnEachViews
▸ Private
drawSphereOnEachViews(decay
, axis
): void
Parameters
Name | Type |
---|---|
decay | number |
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
Name | Type | Description |
---|---|---|
axis | "z" | "y" | "x" | "x" | "y" | "z" |
sliceIndex | number | number |
paintedImages | IPaintImages | IPaintImages, 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
Name | Type |
---|---|
position | ICommXYZ |
axis | "z" | "y" | "x" |
Returns
Object
Name | Type |
---|---|
x | any |
y | any |
z | any |
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
Name | Type |
---|---|
x | number |
y | number |
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
Name | Type |
---|---|
mainArr | number [] | Uint8ClampedArray |
replaceArr | number [] | Uint8ClampedArray |
Returns
void
Defined in
src/Utils/segmentation/DrawToolCore.ts:1960
replaceHorizontalRowPixels
▸ replaceHorizontalRowPixels(paintImageArray
, length
, ratio
, markedArr
, targetWidth
, convertIndex
): void
Parameters
Name | Type | Description |
---|---|---|
paintImageArray | IPaintImage [] | : the target view slice's marked images array |
length | number | : the target view slice's dimention (total slice index num) |
ratio | number | : the target slice image's width/height ratio of its dimention length |
markedArr | number [][] | Uint8ClampedArray [] | : current painted image's horizontal 2d Array |
targetWidth | number | : the target image width |
convertIndex | number | : 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
Name | Type | Description |
---|---|---|
paintImageArray | IPaintImage [] | : the target view slice's marked images array |
length | number | : the target view slice's dimention (total slice index num) |
ratio | number | : the target slice image's width/height ratio of its dimention length |
markedArr | number [][] | Uint8ClampedArray [] | : current painted image's vertical 2d Array |
targetWidth | number | : the target image width |
convertIndex | number | : 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
Name | Type |
---|---|
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
Name | Type |
---|---|
factor | number |
Returns
void
Inherited from
Defined in
src/Utils/segmentation/CommToolsData.ts:261
setCurrentLayer
▸ Private
setCurrentLayer(): Object
Returns
Object
Name | Type |
---|---|
canvas | HTMLCanvasElement |
ctx | CanvasRenderingContext2D |
Defined in
src/Utils/segmentation/DrawToolCore.ts:119
setEmptyCanvasSize
▸ setEmptyCanvasSize(axis?
): void
Rewrite this {resetPaintAreaUIPosition} function under NrrdTools
Parameters
Name | Type |
---|---|
axis? | "z" | "y" | "x" |
Returns
void
Inherited from
CommToolsData.setEmptyCanvasSize
Defined in
src/Utils/segmentation/CommToolsData.ts:301
setEraserUrls
▸ setEraserUrls(urls
): void
Parameters
Name | Type |
---|---|
urls | string [] |
Returns
void
Defined in
src/Utils/segmentation/DrawToolCore.ts:106
setIsDrawFalse
▸ setIsDrawFalse(target
): void
Rewrite this {setIsDrawFalse} function under NrrdTools
Parameters
Name | Type |
---|---|
target | number |
Returns
void
Inherited from
Defined in
src/Utils/segmentation/CommToolsData.ts:269
setPencilIconUrls
▸ setPencilIconUrls(urls
): void
Parameters
Name | Type |
---|---|
urls | string [] |
Returns
void
Defined in
src/Utils/segmentation/DrawToolCore.ts:109
setSphereCanvasSize
▸ Private
setSphereCanvasSize(axis?
): void
Parameters
Name | Type |
---|---|
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
Defined in
src/Utils/segmentation/CommToolsData.ts:331
setUpSphereOrigins
▸ Private
setUpSphereOrigins(mouseX
, mouseY
, sliceIndex
): void
Parameters
Name | Type |
---|---|
mouseX | number |
mouseY | number |
sliceIndex | number |
Returns
void
Defined in
src/Utils/segmentation/DrawToolCore.ts:1406
setupConrastEvents
▸ setupConrastEvents(callback
): void
Set up root container events fns for drag function
Parameters
Name | Type |
---|---|
callback | (step : number , towards : "horizental" | "vertical" ) => void |
Returns
void
Defined in
src/Utils/segmentation/DrawToolCore.ts:2025
sliceArrayH
▸ sliceArrayH(arr
, row
, col
): Uint8ClampedArray
[]
Parameters
Name | Type |
---|---|
arr | Uint8ClampedArray |
row | number |
col | number |
Returns
Uint8ClampedArray
[]
Defined in
src/Utils/segmentation/DrawToolCore.ts:1841
sliceArrayV
▸ sliceArrayV(arr
, row
, col
): number
[][]
Parameters
Name | Type |
---|---|
arr | Uint8ClampedArray |
row | number |
col | number |
Returns
number
[][]
Defined in
src/Utils/segmentation/DrawToolCore.ts:1852
storeAllImages
▸ storeAllImages(index
, label
): void
Parameters
Name | Type |
---|---|
index | number |
label | string |
Returns
void
Defined in
src/Utils/segmentation/DrawToolCore.ts:1598
storeEachLayerImage
▸ storeEachLayerImage(index
, label
): void
Parameters
Name | Type |
---|---|
index | number |
label | string |
Returns
void
Defined in
src/Utils/segmentation/DrawToolCore.ts:1799
storeImageToAxis
▸ storeImageToAxis(index
, paintedImages
, imageData
, axis?
): void
Store images*************************
Parameters
Name | Type |
---|---|
index | number |
paintedImages | IPaintImages |
imageData | ImageData |
axis? | "z" | "y" | "x" |
Returns
void
Defined in
src/Utils/segmentation/DrawToolCore.ts:1564
storeImageToLabel
▸ storeImageToLabel(index
, canvas
, paintedImages
): ImageData
Parameters
Name | Type |
---|---|
index | number |
canvas | HTMLCanvasElement |
paintedImages | IPaintImages |
Returns
ImageData
Defined in
src/Utils/segmentation/DrawToolCore.ts:1779
storeSphereImages
▸ Private
storeSphereImages(index
, axis
): void
Sphere functions*************************
Parameters
Name | Type |
---|---|
index | number |
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
Name | Type |
---|---|
value | number |
flag | string |
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
Name | Type |
---|---|
x | number |
y | number |
radius | number |
Returns
void
Defined in
src/Utils/segmentation/DrawToolCore.ts:922
zoomActionAfterDrawSphere
▸ Private
zoomActionAfterDrawSphere(): void
Returns
void