Skip to content

Commit 88939fa

Browse files
committed
toggle SharpenFilter
1 parent 055b280 commit 88939fa

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

src/tools/filter.js

+1
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ export class Sharpen {
395395
this.#resetImage = false;
396396
command.execute();
397397
} else {
398+
this.#resetImage = true;
398399
command.undo();
399400
}
400401

tests/pacs/viewer.js

+51
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,45 @@ _toolFeaturesUI.Draw = {
7474
return res;
7575
}
7676
};
77+
_toolFeaturesUI.Filter = {
78+
getValue() {
79+
const shapeSelect = document.getElementById('filter-shape-select');
80+
return {
81+
filterName: shapeSelect.value,
82+
run: true,
83+
// undo: true
84+
};
85+
},
86+
getHtml() {
87+
const shapeSelect = document.createElement('select');
88+
shapeSelect.id = 'filter-shape-select';
89+
90+
const shapeNames = _tools.Filter.options;
91+
if (typeof shapeNames === 'undefined') {
92+
return;
93+
}
94+
95+
for (const filterName of shapeNames) {
96+
const opt = document.createElement('option');
97+
opt.id = 'shape-' + filterName;
98+
opt.value = filterName;
99+
opt.appendChild(document.createTextNode(filterName));
100+
shapeSelect.appendChild(opt);
101+
}
102+
103+
shapeSelect.onchange = function (event) {
104+
const element = event.target;
105+
console.log('a', element.value);
106+
_app.setToolFeatures({filterName: element.value, run: true, undo: true});
107+
};
108+
109+
const res = document.createElement('span');
110+
res.id = 'toolFeatures';
111+
res.className = 'toolFeatures';
112+
res.appendChild(shapeSelect);
113+
return res;
114+
}
115+
};
77116

78117
// viewer options
79118
let _layout = 'one';
@@ -153,6 +192,8 @@ function viewerSetup() {
153192
Pan: {},
154193
Opacity: {},
155194
Draw: {options: ['Select', 'Ruler', 'Circle', 'Ellipse', 'Rectangle']},
195+
// Sharpen: {},
196+
Filter: {options: ['Sharpen', 'Sobel', 'Threshold']},
156197
};
157198

158199
// app config
@@ -223,6 +264,16 @@ function viewerSetup() {
223264
console.timeEnd('load-data-' + event.dataid);
224265
// remove abort shortcut
225266
window.removeEventListener('keydown', abortShortcut);
267+
268+
// sharpen filter
269+
// const sharpenFilter = new Sharpen(_app)
270+
271+
console.log('aap', _app);
272+
// const sharpenFilter = new dwv.tool.Filter(_app);
273+
// sharpenFilter.setOptions({type: 'Sharpen'});
274+
// sharpenFilter.init();
275+
276+
226277
});
227278

228279
let dataLoad = 0;

0 commit comments

Comments
 (0)