Skip to content

Commit

Permalink
Merge branch 'maintenance/2018.07.19' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
tomka committed Aug 16, 2018
2 parents b0f1206 + 2660a32 commit bcc1b00
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 19 deletions.
2 changes: 1 addition & 1 deletion django/applications/catmaid/control/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def flatten(d, max_index):
k = []
for i in range(max_index):
v = d.get(i)
if not v:
if not v and v != 0:
continue
if parsedict == type(v):
k.append(flatten(v, max_index))
Expand Down
15 changes: 5 additions & 10 deletions django/applications/catmaid/static/js/3d/skeleton-shading.js
Original file line number Diff line number Diff line change
Expand Up @@ -550,14 +550,6 @@
// Get intervals for domain
let domain = domains[j];

// Ignore domain, if a domain filter exists and this domain isn't
// allowed.
if (options.sampler_domain_shading_ids &&
options.sampler_domain_shading_ids.length > 0 &&
options.sampler_domain_shading_ids.indexOf(domain.id) === -1) {
continue;
}

// Skip this domain if the user set 'allowed_sampler_domains'
if (options.viewerOptions.allowed_sampler_domain_ids &&
options.viewerOptions.allowed_sampler_domain_ids.length > 0 &&
Expand Down Expand Up @@ -1038,9 +1030,11 @@
options.allowed_sampler_domain_ids);
}

var nonDomainWeight = options.sampler_domain_shading_other_weight || 0;

// Add all nodes in all domains
var nodeWeights = arbor.nodesArray().reduce(function(o, d) {
o[d] = samplerEdges[d] === undefined ? 0 : 1;
o[d] = samplerEdges[d] === undefined ? nonDomainWeight : 1;
return o;
}, {});

Expand All @@ -1051,6 +1045,7 @@
prepare: initSamplerIntervals,
weights: function(skeleton, options) {
var arbor = skeleton.createArbor();
var positions = skeleton.getPositions();
var samplers = skeleton.samplers;
if (!samplers) {
// Weight each node zero if there are no samplers
Expand All @@ -1064,7 +1059,7 @@
var intervalMap = {};
for (var i=0; i<samplers.length; ++i) {
var sampler = samplers[i];
CATMAID.Sampling.intervalEdges(arbor, skeleton.getPositions(),
CATMAID.Sampling.intervalEdges(arbor, positions,
sampler, true, true, true, intervalMap);
}

Expand Down
1 change: 1 addition & 0 deletions django/applications/catmaid/static/js/widgets/3dviewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1249,6 +1249,7 @@
this.volume_location_picking = false;
this.allowed_sampler_domain_ids = [];
this.allowed_sampler_interval_ids = [];
this.sampler_domain_shading_other_weight = 0;
};

WebGLApplication.prototype.Options.prototype = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1926,10 +1926,12 @@
glWidget.addSkeletons(models, function() {
// Set new shading and coloring methods
glWidget.options.color_method = colorMethod;
glWidget.options.shading_method = 'none';
glWidget.options.shading_method = 'sampler-domains';
glWidget.options.interpolate_vertex_colots = false;

// Make sure only the active domain is visible
// Make sure only the active domain is visible fully and other
// parts of the skeleton only a little.
glWidget.options.sampler_domain_shading_other_weight = 0.2;
glWidget.options.allowed_sampler_domain_ids.length = 0;
glWidget.options.allowed_sampler_domain_ids.push(activeDomainId);

Expand Down
12 changes: 6 additions & 6 deletions django/applications/catmaid/tests/test_internal_apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
class InternalApiTestsNoDB(TestCase):

def test_request_list_parsing(self):
q = QueryDict('a=1&a=2&a=3')
self.assertEqual(get_request_list(q, 'a'), ['1', '2', '3'])
self.assertEqual(get_request_list(q, 'a', map_fn=int), [1, 2, 3])
q = QueryDict('a=0&a=1&a=2&a=3')
self.assertEqual(get_request_list(q, 'a'), ['0', '1', '2', '3'])
self.assertEqual(get_request_list(q, 'a', map_fn=int), [0, 1, 2, 3])
self.assertEqual(get_request_list(q, 'b'), None)

q2 = QueryDict('a[0]=1&a[1]=2&a[2]=3&a=4')
self.assertEqual(get_request_list(q2, 'a'), ['1', '2', '3'])
self.assertEqual(get_request_list(q2, 'a', map_fn=int), [1, 2, 3])
q2 = QueryDict('a[0]=0&a[1]=1&a[2]=2&a[3]=3&a=4')
self.assertEqual(get_request_list(q2, 'a'), ['0', '1', '2', '3'])
self.assertEqual(get_request_list(q2, 'a', map_fn=int), [0, 1, 2, 3])
self.assertEqual(get_request_list(q2, 'b'), None)

# Test list of lists [[1,2],[3,4]]
Expand Down

0 comments on commit bcc1b00

Please sign in to comment.