Skip to content

Commit

Permalink
Merge pull request #55 from dvisionlab/colormap
Browse files Browse the repository at this point in the history
add LUT management
  • Loading branch information
ronzim authored Jun 1, 2021
2 parents 5479620 + e004afd commit 9f86975
Show file tree
Hide file tree
Showing 13 changed files with 6,790 additions and 76 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
/.vscode/

/docs/examples/test_*
/docs/examples/demo/thorax*
/docs/examples/demo/thorax*
/docs/examples/demo/abdomen*
2,924 changes: 2,923 additions & 1 deletion dist/diglettk.js

Large diffs are not rendered by default.

2,924 changes: 2,923 additions & 1 deletion docs/examples/diglettk.js

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions docs/examples/vr.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ <h3 style="margin-bottom: 20px;">Opacity Widget</h3>
<label class="sr-only" for="select-lut">LUT</label>
<select style="max-width: 150px;" id="select-lut" onchange="updateLut(this.options[this.selectedIndex].text)">
</select>
<input type="checkbox" class="custom-control-input" id="customControlAutosizing" onchange="updateRescale(this.checked)">
<input checked type="checkbox" class="custom-control-input" id="customControlAutosizing" onchange="updateRescale(this.checked)">
<label class="custom-control-label" for="customControlAutosizing">rescale LUT</label>
</div>
</form>
Expand All @@ -86,7 +86,8 @@ <h3 style="margin-top: 20px; margin-bottom: 10px;">Code Example</h3>
// set widget element to control opacity
vr.widgetElement = widgetContainer;
// set a LUT
vr.lut = "2hot";
vr.lut = "MuscleBone";
vr.rescaleLUT = true;
})
</code>
</pre>
Expand All @@ -104,7 +105,7 @@ <h3 style="margin-top: 20px; margin-bottom: 10px;">Code Example</h3>

let vr = null;

function fillSelect(list) {
function fillSelect(list, initialLUT) {
let select = document.getElementById('select-lut');
let index = 0;
for(let element of list)
Expand All @@ -115,6 +116,7 @@ <h3 style="margin-top: 20px; margin-bottom: 10px;">Code Example</h3>
select.appendChild(opt);
index++;
}
select.selectedIndex = list.indexOf(initialLUT)
}

function updateLut(v) {
Expand Down Expand Up @@ -146,8 +148,10 @@ <h3 style="margin-top: 20px; margin-bottom: 10px;">Code Example</h3>
vr.widgetElement = widgetContainer;
// set a LUT
let lutList = vr.getLutList();
fillSelect(lutList)
vr.lut = lutList[0];
fillSelect(lutList, "MuscleBone")
// vr.lut = lutList[0];
vr.lut = "MuscleBone";
vr.rescaleLUT = true;
})
</script>
</body>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "diglettk",
"version": "0.8.1",
"version": "0.9.0",
"description": "A medical imaging toolkit, build on top of vtk.js",
"main": "index.js",
"scripts": {
Expand Down
14 changes: 13 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
// Log lib version and hardware info
import * as pkg from "../package.json";
import { getVideoCardInfo } from "./utils/utils";
console.groupCollapsed(
"%c** dtk **",
"background: #0aa658; color: #000000; line-height: 1.6"
);
console.log(`Version ${pkg.version}`);
console.log("Detected graphic card:");
console.log(getVideoCardInfo());
console.groupEnd("dtk");

// NOTE: this is necessary as workaround to this issue:
// https://github.com/Kitware/vtk-js/issues/1882
import "regenerator-runtime/runtime";
Expand All @@ -10,6 +22,6 @@ import "vtk.js/Sources/Rendering/Profiles/Glyph";

import { VRView } from "./vrView";
import { MPRManager } from "./mprManager";
import { loadDemoSerieWithLarvitar, buildVtkVolume } from "./utils";
import { loadDemoSerieWithLarvitar, buildVtkVolume } from "./utils/utils";

export { MPRManager, VRView, loadDemoSerieWithLarvitar, buildVtkVolume };
2 changes: 1 addition & 1 deletion src/mpr-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// ======================================

import { MPRManager } from "./mprManager";
import { buildVtkVolume, loadSerieWithLarvitar } from "./utils";
import { buildVtkVolume, loadSerieWithLarvitar } from "./utils/utils";

// =====================
// Define viewports ====
Expand Down
2 changes: 1 addition & 1 deletion src/mprManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
getPlaneIntersection,
getVolumeCenter,
createVolumeActor
} from "./utils";
} from "./utils/utils";

import { MPRView } from "./mprView";

Expand Down
2 changes: 1 addition & 1 deletion src/mprView.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import vtkInteractorStyleMPRSlice from "./vtk/vtkInteractorMPRSlice";

import { quat, vec3, mat4 } from "gl-matrix";

import { degrees2radians, fill2DView } from "./utils";
import { degrees2radians, fill2DView } from "./utils/utils";

/**
* MPRView class
Expand Down
Loading

0 comments on commit 9f86975

Please sign in to comment.