Skip to content

Commit

Permalink
Label stacks: setup annotations if metadata exists
Browse files Browse the repository at this point in the history
  • Loading branch information
aschampion committed Nov 16, 2018
1 parent 511526d commit 7bf0ae1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
7 changes: 7 additions & 0 deletions django/applications/catmaid/static/js/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -1595,6 +1595,13 @@ var project;

var stack = new CATMAID.Stack.fromStackInfoJson(e);

// If this is a label stack, not a raw stack, create a label annotation
// manager.
// TODO: should eventually use a backend image label space instead.
if (!!stack.labelMetadata()) {
CATMAID.LabelAnnotations.get(stack);
}

if (!useExistingViewer) {
stackViewer = new CATMAID.StackViewer(project, stack);
}
Expand Down
13 changes: 5 additions & 8 deletions django/applications/catmaid/static/js/label-annotations.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@

const LABEL_FILTER_KEY = 'Object Label Color Map';

const SPECIAL_LABELS = {
background: 0,
};

class LabelStackAnnotations {
constructor(
primaryStack
Expand All @@ -79,14 +83,7 @@
this.stackIDs = new Set([this.primaryStack.id]);
this.activeLabelID = undefined;

this.specialLabels = {
background: 0,
};
if (this.primaryStack.metadata &&
this.primaryStack.metadata.catmaidLabelMeta &&
this.primaryStack.metadata.catmaidLabelMeta.specialLabels) {
$.extend(this.specialLabels, this.primaryStack.metadata.catmaidLabelMeta.specialLabels);
}
this.specialLabels = Object.assign({}, SPECIAL_LABELS, this.primaryStack.labelMetadata());
this.stackLayerFilters = new Map();

project.on(CATMAID.Project.EVENT_STACKVIEW_ADDED,
Expand Down
6 changes: 6 additions & 0 deletions django/applications/catmaid/static/js/stack.js
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,12 @@
self.removeMirror = function(mirrorIndex) {
self.mirrors.splice(mirrorIndex, 1);
};

self.labelMetadata = function () {
if (this.metadata) {
return this.metadata.catmaidLabelMeta;
}
};
}

/**
Expand Down

0 comments on commit 7bf0ae1

Please sign in to comment.