Skip to content

Commit 1b3023c

Browse files
authored
Merge pull request #135 from LinkunGao/release/v1.12.11
Release/v1.12.11
2 parents 9447457 + 2f944a7 commit 1b3023c

File tree

7 files changed

+36
-37
lines changed

7 files changed

+36
-37
lines changed

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
author = 'LinkunGao'
2323

2424
# The full version, including alpha/beta/rc tags
25-
release = 'v1.12.10'
25+
release = 'v1.12.11'
2626

2727

2828
# -- General configuration ---------------------------------------------------

docs/source/release/release.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,3 +1089,15 @@ const resetMainAreaSize = (factor: number) => {
10891089
## Release v1.12.9
10901090

10911091
- add mouse cursor option in nrrd_tools GUI.
1092+
1093+
## Release v1.12.10
1094+
1095+
- update nrrd_tools GUI opacity.
1096+
1097+
## Release v1.12.11
1098+
1099+
- fixed all NRRD slice index error.
1100+
- threejs environment is base on RSADimention to render the nrrd each slices. But in this way, The slice presented by threejs does not match the real nrrd slice. Actually, one nrrd slice should represent one dicom file image. Thus, we need use `voxel spacing` to fix this issue.
1101+
- Suppose we want to get the index 10 slice image. which is 10th dicom file image. Using multiplication: we can use the index 10 to times voxel spacing to get the 10th dicom file image in threejs environment.
1102+
- update copper3d nrrd loader, in order to match the real nrrd slice, all position max slice index minus 1.
1103+
- update nrrd_tools GUI some parameters name.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "copper3d_visualisation",
33
"description": "A 3d visualisation package base on threejs provides multiple scenes and Nrrd image load funtion.",
4-
"version": "1.12.10",
4+
"version": "1.12.11",
55
"main": "dist/bundle.umd.js",
66
"moudle": "dist/bundle.esm.js",
77
"types": "dist/types/index.d.ts",

src/Loader/copperNrrdLoader.ts

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,30 +54,28 @@ export function copperNrrdLoader(
5454
const rasdimensions = volume.RASDimensions;
5555
const dimensions = volume.dimensions;
5656

57-
const ratioX = rasdimensions[0] / dimensions[0];
58-
const ratioY = rasdimensions[1] / dimensions[1];
59-
const ratioZ = rasdimensions[2] / dimensions[2];
57+
const ratio = volume.spacing;
6058

6159
const initIndexZ = Math.floor(dimensions[2] / 2);
6260
const initIndexY = Math.floor(dimensions[1] / 2);
6361
const initIndexX = Math.floor(dimensions[0] / 2);
6462

65-
const sliceZ = volume.extractSlice("z", initIndexZ * ratioZ);
66-
const sliceY = volume.extractSlice("y", initIndexY * ratioY);
63+
const sliceZ = volume.extractSlice("z", initIndexZ * ratio[2]);
64+
const sliceY = volume.extractSlice("y", initIndexY * ratio[1]);
6765
//x plane
68-
const sliceX = volume.extractSlice("x", initIndexX * ratioX);
66+
const sliceX = volume.extractSlice("x", initIndexX * ratio[0]);
6967
sliceZ.initIndex = initIndexZ;
7068
sliceY.initIndex = initIndexY;
7169
sliceX.initIndex = initIndexX;
72-
sliceZ.RSARatio = ratioZ;
73-
sliceY.RSARatio = ratioY;
74-
sliceX.RSARatio = ratioX;
75-
sliceZ.MaxIndex = dimensions[2];
76-
sliceY.MaxIndex = dimensions[1];
77-
sliceX.MaxIndex = dimensions[0];
78-
sliceZ.RSAMaxIndex = rasdimensions[2];
79-
sliceY.RSAMaxIndex = rasdimensions[1];
80-
sliceX.RSAMaxIndex = rasdimensions[0];
70+
sliceZ.MaxIndex = dimensions[2] - 1;
71+
sliceY.MaxIndex = dimensions[1] - 1;
72+
sliceX.MaxIndex = dimensions[0] - 1;
73+
sliceZ.RSARatio = ratio[2];
74+
sliceY.RSARatio = ratio[1];
75+
sliceX.RSARatio = ratio[0];
76+
sliceZ.RSAMaxIndex = rasdimensions[2] - 1;
77+
sliceY.RSAMaxIndex = rasdimensions[1] - 1;
78+
sliceX.RSAMaxIndex = rasdimensions[0] - 1;
8179

8280
nrrdMeshes = {
8381
x: sliceX.mesh,

src/Utils/nrrd_tool.ts

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,7 @@ export class nrrd_tools {
350350
this.mainPreSlice.index = i * this.nrrd_states.RSARatio;
351351
this.mainPreSlice.repaint.call(this.mainPreSlice);
352352
const verfiy = !this.verifyCanvasIsEmpty(this.mainPreSlice.canvas);
353-
console.log(verfiy);
354-
355353
if (verfiy) {
356-
console.log(i);
357354
this.mainPreSlice.index = (i - 1) * this.nrrd_states.RSARatio;
358355
this.mainPreSlice.repaint.call(this.mainPreSlice);
359356
this.nrrd_states.latestNotEmptyImg.src =
@@ -401,17 +398,7 @@ export class nrrd_tools {
401398

402399
private updateMaxIndex() {
403400
if (this.mainPreSlice) {
404-
switch (this.axis) {
405-
case "x":
406-
this.nrrd_states.maxIndex = this.mainPreSlice.volume.dimensions[0];
407-
break;
408-
case "y":
409-
this.nrrd_states.maxIndex = this.mainPreSlice.volume.dimensions[1];
410-
break;
411-
case "z":
412-
this.nrrd_states.maxIndex = this.mainPreSlice.volume.dimensions[2];
413-
break;
414-
}
401+
this.nrrd_states.maxIndex = this.mainPreSlice.MaxIndex;
415402
}
416403
}
417404

@@ -1249,10 +1236,12 @@ export class nrrd_tools {
12491236
if (modeFolder.__controllers.length > 0)
12501237
this.removeGuiFolderChilden(modeFolder);
12511238

1239+
modeFolder.open();
12521240
const actionsFolder = modeFolder.addFolder("Default Actions");
12531241

12541242
actionsFolder
12551243
.add(this.gui_states, "cursor", ["crosshair", "pencil"])
1244+
.name("cursor icons")
12561245
.onChange((value) => {
12571246
if (value === "crosshair") {
12581247
this.nrrd_states.defaultPaintCursor = "crosshair";
@@ -1265,7 +1254,7 @@ export class nrrd_tools {
12651254
});
12661255
actionsFolder
12671256
.add(this.gui_states, "mainAreaSize")
1268-
.name("Zoom")
1257+
.name("zoom")
12691258
.min(1)
12701259
.max(8)
12711260
.onFinishChange((factor) => {
@@ -1276,7 +1265,7 @@ export class nrrd_tools {
12761265
actionsFolder.add(this.gui_states, "resetZoom");
12771266
actionsFolder
12781267
.add(this.gui_states, "globalAlpha")
1279-
.name("Opacity")
1268+
.name("opacity")
12801269
.min(0.1)
12811270
.max(1)
12821271
.step(0.01);

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ import {
3333

3434
import "./css/style.css";
3535

36-
export const REVISION = "v1.12.10";
36+
export const REVISION = "v1.12.11";
3737

3838
console.log(
39-
"%cCopper3D Visualisation %cBeta:v1.12.10",
39+
"%cCopper3D Visualisation %cBeta:v1.12.11",
4040
"padding: 3px;color:white; background:#023047",
4141
"padding: 3px;color:white; background:#f50a25"
4242
);

0 commit comments

Comments
 (0)