Skip to content

Commit

Permalink
toggle SharpenFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
adamcanray committed Mar 28, 2024
1 parent 055b280 commit 88939fa
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/tools/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ export class Sharpen {
this.#resetImage = false;
command.execute();
} else {
this.#resetImage = true;
command.undo();
}

Expand Down
51 changes: 51 additions & 0 deletions tests/pacs/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,45 @@ _toolFeaturesUI.Draw = {
return res;
}
};
_toolFeaturesUI.Filter = {
getValue() {
const shapeSelect = document.getElementById('filter-shape-select');
return {
filterName: shapeSelect.value,
run: true,
// undo: true
};
},
getHtml() {
const shapeSelect = document.createElement('select');
shapeSelect.id = 'filter-shape-select';

const shapeNames = _tools.Filter.options;
if (typeof shapeNames === 'undefined') {
return;
}

for (const filterName of shapeNames) {
const opt = document.createElement('option');
opt.id = 'shape-' + filterName;
opt.value = filterName;
opt.appendChild(document.createTextNode(filterName));
shapeSelect.appendChild(opt);
}

shapeSelect.onchange = function (event) {
const element = event.target;
console.log('a', element.value);
_app.setToolFeatures({filterName: element.value, run: true, undo: true});
};

const res = document.createElement('span');
res.id = 'toolFeatures';
res.className = 'toolFeatures';
res.appendChild(shapeSelect);
return res;
}
};

// viewer options
let _layout = 'one';
Expand Down Expand Up @@ -153,6 +192,8 @@ function viewerSetup() {
Pan: {},
Opacity: {},
Draw: {options: ['Select', 'Ruler', 'Circle', 'Ellipse', 'Rectangle']},
// Sharpen: {},
Filter: {options: ['Sharpen', 'Sobel', 'Threshold']},
};

// app config
Expand Down Expand Up @@ -223,6 +264,16 @@ function viewerSetup() {
console.timeEnd('load-data-' + event.dataid);
// remove abort shortcut
window.removeEventListener('keydown', abortShortcut);

// sharpen filter
// const sharpenFilter = new Sharpen(_app)

console.log('aap', _app);
// const sharpenFilter = new dwv.tool.Filter(_app);
// sharpenFilter.setOptions({type: 'Sharpen'});
// sharpenFilter.init();


});

let dataLoad = 0;
Expand Down

0 comments on commit 88939fa

Please sign in to comment.