Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
katjaq committed Nov 28, 2023
2 parents c32bb78 + 4065dd6 commit c7be498
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions thresholdmann.js
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,8 @@ const loadNifti = () => {
};

/** Handle initialisation when a path is provided.
* This function is called from
* the HTML page.
* @param {string} path - the path to the Nifti file
* @returns {void}
*/
Expand All @@ -788,19 +790,37 @@ const initWithPath = async (path) => {
initUI();
};

/** Adjust transparency of the thresholding mask. This
* function is called from the HTML page.
* @param {Event} ev - the event
* @returns {void}
*/
// eslint-disable-next-line no-unused-vars
const changeAlpha = (ev) => {
const newAlpha = Number(ev.target.value)/100;
globals.alpha = newAlpha;
globals.mv.draw();
};

/** Adjust the brightness of the brain MRI. This
* function is called from the HTML page.
* @param {Event} ev - the event
* @returns {void}
*/
// eslint-disable-next-line no-unused-vars
const changeBrightness = (ev) => {
const {brightness} = globals;
const contrast = Number(ev.target.value)/100;
globals.contrast = contrast;
document.querySelector('canvas.viewer').style.filter = `brightness(${brightness}) contrast(${contrast})`;
};

/** Adjust the contrast of the brain MRI. This
* function is called from the HTML page.
* @param {Event} ev - the event
* @returns {void}
*/
// eslint-disable-next-line no-unused-vars
const changeContrast = (ev) => {
const brightness = Number(ev.target.value)/100;
const {contrast} = globals;
Expand Down

0 comments on commit c7be498

Please sign in to comment.