Skip to content

Commit 8e784e5

Browse files
committed
Painting tool: use more sensible defaults for painting data layer
Namely, pre-define object label map filter. Also fix some initial display problems, due to the wrong opacity.
1 parent 3846518 commit 8e784e5

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

django/applications/catmaid/static/js/layers/painting-layer.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106
this.updateContextConfiguration();
107107
} else if (name === 'value') {
108108
this.value = value;
109+
this.dataLayer.setLayerSetting('backgroundLabel', value);
109110
} else if (name === 'dtype') {
110111
this.dtype = dtype;
111112
} else if (name === 'brushSize') {
@@ -278,7 +279,7 @@
278279
}
279280

280281
// Write block back to server. This is done asynchronously in regular
281-
// intervald (if changes happen).
282+
// intervals (if changes happen).
282283
return this.dataLayer.writeBlock(project.id, this.stackViewer.s, zoom, ...blockCoord, block);
283284
})
284285
.catch(CATMAID.handleError);

django/applications/catmaid/static/js/tools/painting-tool.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@
279279
stackViewer.primaryStack,
280280
customMirrorData.id,
281281
isVisible,
282-
isVisible ? 0 : 1,
282+
isVisible ? 1 : 0,
283283
showOverview,
284284
CATMAID.StackLayer.INTERPOLATION_MODES.INHERIT,
285285
changeMirrorIfNoData);
@@ -289,6 +289,15 @@
289289
CATMAID.setLocalStorageItem(self.customMirrorStorageName,
290290
JSON.stringify(customMirrorData));
291291

292+
// Add an "Object label color map" filter after WebGL is available, to
293+
// render the painted labels
294+
const backgroundLabel = 0;
295+
const filter = new (dataLayer.getAvailableFilters()["Object Label Color Map"])();
296+
filter.setParam("backgroundLabel", CATMAID.PixiLayer.Filters.int2arr(Number(backgroundLabel)));
297+
filter.setParam("foregroundAlpha", 0.8);
298+
filter.setParam("seed", 0.09);
299+
dataLayer.addFilter(filter);
300+
292301
// Update layer control UI to reflect settings changes.
293302
if (self.stackViewer && self.stackViewer.layerControl) {
294303
self.layerControl.refresh();

0 commit comments

Comments
 (0)