Skip to content

Commit

Permalink
Merge pull request #76 from LinkunGao/release/v1.11.17
Browse files Browse the repository at this point in the history
Release/v1.11.17
  • Loading branch information
LinkunGao authored Oct 5, 2022
2 parents fbe281f + 049e10b commit 0cde717
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 20 deletions.
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
author = 'LinkunGao'

# The full version, including alpha/beta/rc tags
release = 'v1.11.16'
release = 'v1.11.17'


# -- General configuration ---------------------------------------------------
Expand Down
5 changes: 5 additions & 0 deletions docs/source/release/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -795,3 +795,8 @@ appRenderer.sceneInfos[0].addPreRenderCallbackFunction(nrrdTools.start);
- change back `setVolumeAndSlice(volume: any, slice: any, notMainArea?: boolean)` to `setVolumeAndSlice(volume: any, slice: any)`.

- add drag sensitive attribute in GUI.

## Release v1.11.17

- optimise Nrrd_tools GUI
- optimise drag sensitive parameter
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "copper3d_visualisation",
"description": "A 3d visualisation package base on threejs provides multiple scenes and Nrrd image load funtion.",
"version": "1.11.16",
"version": "1.11.17",
"main": "dist/bundle.umd.js",
"moudle": "dist/bundle.esm.js",
"types": "dist/types/index.d.ts",
Expand Down
1 change: 0 additions & 1 deletion src/Loader/copperDicomLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as THREE from "three";
import getVOILUT from "../Utils/getVOILUT";
import dicomParser from "dicom-parser";
import { copperVolumeType } from "../types/types";
// import { TAG_DICT } from "../lib/dicom_pharser_dictionary";

const loader = new THREE.FileLoader().setResponseType("arraybuffer");

Expand Down
46 changes: 32 additions & 14 deletions src/Utils/nrrd_tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export class nrrd_tools {
private Mouse_Over_x: number = 0;
private Mouse_Over_y: number = 0;
private Mouse_Over: boolean = false;
private Max_sensitive: number = 100;
private sensitiveArray: number[] = [];

private showDragNumberDiv: HTMLDivElement = document.createElement("div");
private drawingCanvas: HTMLCanvasElement = document.createElement("canvas");
Expand Down Expand Up @@ -93,9 +95,9 @@ export class nrrd_tools {
segmentation: false,
fillColor: "#3fac58",
brushColor: "#3fac58",
brushLineWidth: 15,
brushAndEraserSize: 15,
Eraser: false,
EraserSize: 25,
// EraserSize: 25,
clearAll: () => {
this.clearAllPaint();
},
Expand Down Expand Up @@ -165,6 +167,10 @@ export class nrrd_tools {
this.downloadImage.href = "";
this.downloadImage.target = "_blank";
this.drawingCanvasContainer.className = "copper3D_drawingCanvasContainer";

for (let i = 0; i < this.Max_sensitive; i++) {
this.sensitiveArray.push((i + 1) / 20);
}
}

private afterLoadSlice() {
Expand Down Expand Up @@ -324,13 +330,15 @@ export class nrrd_tools {
let move: number;
let y: number;
let h: number = this.container.offsetHeight;
let convertArr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1];
// let convertArr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1];
let sensivity = 1;

let handleOnMouseUp: (ev: MouseEvent) => void;
let handleOnMouseDown: (ev: MouseEvent) => void;
let handleOnMouseMove: (ev: MouseEvent) => void;

this.sensitiveArray.reverse();

this.originWidth = this.slice.canvas.width;
this.originHeight = this.slice.canvas.height;

Expand Down Expand Up @@ -410,7 +418,7 @@ export class nrrd_tools {
y = ev.offsetY / h;
this.container.addEventListener("mousemove", handleOnMouseMove, false);
this.oldIndex = this.slice.index;
sensivity = convertArr[this.stateMode.dragSensitivity - 1];
sensivity = this.sensitiveArray[this.stateMode.dragSensitivity - 1];
};
handleOnMouseMove = throttle((ev: MouseEvent) => {
this.oldIndex = this.slice.index;
Expand Down Expand Up @@ -785,7 +793,7 @@ export class nrrd_tools {
this.drawingLayer1Ctx.lineWidth = this.stateMode.lineWidth;
} else {
this.drawingLayer1Ctx.strokeStyle = this.stateMode.brushColor;
this.drawingLayer1Ctx.lineWidth = this.stateMode.brushLineWidth;
this.drawingLayer1Ctx.lineWidth = this.stateMode.brushAndEraserSize;
}

this.drawingLayer1Ctx.lineTo(x, y);
Expand All @@ -803,7 +811,7 @@ export class nrrd_tools {
if (this.stateMode.Eraser) {
stepClear = 1;
// drawingCtx.clearRect(e.offsetX - 5, e.offsetY - 5, 25, 25);
clearArc(e.offsetX, e.offsetY, this.stateMode.EraserSize);
clearArc(e.offsetX, e.offsetY, this.stateMode.brushAndEraserSize);
} else {
lines.push({ x: e.offsetX, y: e.offsetY });
paintOnCanvasLayer1(e.offsetX, e.offsetY);
Expand Down Expand Up @@ -926,7 +934,7 @@ export class nrrd_tools {
this.drawingCtx.arc(
this.Mouse_Over_x,
this.Mouse_Over_y,
this.stateMode.brushLineWidth / 2,
this.stateMode.brushAndEraserSize / 2,
0,
Math.PI * 2
);
Expand Down Expand Up @@ -1236,7 +1244,11 @@ export class nrrd_tools {

private configGui(modeFolder: GUI) {
if (modeFolder.__controllers.length > 0) this.removeModeChilden(modeFolder);
modeFolder.add(this.stateMode, "dragSensitivity").min(1).max(10).step(1);
modeFolder
.add(this.stateMode, "dragSensitivity")
.min(1)
.max(this.Max_sensitive)
.step(1);
modeFolder
.add(this.stateMode, "size")
.min(1)
Expand All @@ -1246,14 +1258,10 @@ export class nrrd_tools {
this.resizePaintArea(factor);
});
modeFolder.add(this.stateMode, "globalAlpha").min(0.1).max(1).step(0.01);
modeFolder.add(this.stateMode, "segmentation");
modeFolder.addColor(this.stateMode, "color");
modeFolder.addColor(this.stateMode, "fillColor");
modeFolder.add(this.stateMode, "lineWidth").min(1.7).max(3).step(0.01);

modeFolder.add(this.stateMode, "brushLineWidth").min(5).max(50).step(1);
modeFolder.add(this.stateMode, "brushAndEraserSize").min(5).max(50).step(1);
modeFolder.addColor(this.stateMode, "brushColor");
modeFolder.add(this.stateMode, "EraserSize").min(1).max(50).step(1);
// modeFolder.add(this.stateMode, "EraserSize").min(1).max(50).step(1);
modeFolder.add(this.stateMode, "Eraser").onChange((value) => {
this.stateMode.Eraser = value;
if (this.stateMode.Eraser) {
Expand All @@ -1267,6 +1275,16 @@ export class nrrd_tools {
modeFolder.add(this.stateMode, "clearAll");
modeFolder.add(this.stateMode, "undo");
modeFolder.add(this.stateMode, "downloadCurrentImage");
const segmentation = modeFolder.addFolder("segmentation");
segmentation.add(this.stateMode, "segmentation");
segmentation
.add(this.stateMode, "lineWidth")
.name("outerLineWidth")
.min(1.7)
.max(3)
.step(0.01);
segmentation.addColor(this.stateMode, "color");
segmentation.addColor(this.stateMode, "fillColor");
const contrast = modeFolder.addFolder("contrast");
contrast.open();
contrast
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
import "./css/style.css";

console.log(
"%cCopper3D Visualisation %cBeta:v1.11.16",
"%cCopper3D Visualisation %cBeta:v1.11.17",
"padding: 3px;color:white; background:#023047",
"padding: 3px;color:white; background:#f50a25"
);
Expand Down

0 comments on commit 0cde717

Please sign in to comment.