Commit 0fb9b4fb authored by Philipp Schubert's avatar Philipp Schubert
Browse files

SuperSegmentationDataset().mapping_dict is now a property, updated README, removed print

parent 70075013
......@@ -34,6 +34,7 @@ We are especially grateful for the support by Winfried Denk who enabled this wor
and his group at the MPCDF for cluster support and deepmind for providing egl extension code to handle multi-gpu rendering on the same machine.
The original code snippet (under the Apache License 2.0) used for our project can be found
[here](https://github.com/deepmind/dm_control/blob/30069ac11b60ee71acbd9159547d0bc334d63281/dm_control/_render/pyopengl/egl_ext.py).
Thanks to Julia Kuhl (see http://somedonkey.com/ for more beautiful work) for designing and creating the logo!
Publications
......
......@@ -711,12 +711,10 @@ class main_class(QtGui.QDialog):
# TODO: could be optimized: currently we need to get the index,
# and in on_syn_selector_changed the synapse ID is retrieved again
syn_ix = self.syn_item_model.index(self.all_syns['ids'].index(self.syn_selected1), 0)
print(syn_ix, type(syn_ix))
self.on_syn_selector_changed(syn_ix)
return
def clear_knossos_view_button_clicked(self):
# delete all existing objects in mergelist
all_objects = KnossosModule.segmentation.objects()
[KnossosModule.segmentation.remove_object(obj) for obj in all_objects]
......
......@@ -144,7 +144,9 @@ def run_create_rag():
'/logs/', overwrite=True)
# Crop RAG according to cell SVs found during SD generation and apply size threshold
G = nx.read_edgelist(global_params.config.init_rag_path, nodetype=np.uint)
if 0 in G.nodes():
G.remove_node(0)
log.warning('Found background node 0 in original graph. Removing.')
all_sv_ids_in_rag = np.array(list(G.nodes()), dtype=np.uint)
log.info("Found {} SVs in initial RAG.".format(len(all_sv_ids_in_rag)))
......
......@@ -440,8 +440,6 @@ def _run_neuron_rendering_big_helper(max_n_jobs=None):
def run_neuron_rendering(max_n_jobs=None):
ssd = SuperSegmentationDataset(working_dir=global_params.config.working_dir)
log = initialize_logging('neuron_view_rendering',
global_params.config.working_dir + '/logs/')
ps = [Process(target=_run_neuron_rendering_big_helper, args=(max_n_jobs, )),
......@@ -452,9 +450,12 @@ def run_neuron_rendering(max_n_jobs=None):
for p in ps:
p.join()
log.info('Finished rendering of all SSVs. Checking completeness.')
ssd = SuperSegmentationDataset(working_dir=global_params.config.working_dir)
res = find_incomplete_ssv_views(ssd, woglia=True, n_cores=global_params.NCORES_PER_NODE)
if len(res) != 0:
msg = "Not all SSVs were rendered completely! Missing:\n{}".format(res)
msg = "Not all SVs were predicted! {}/{} missing:\n" \
"{}".format(len(res), len(ssd.ssv_ids),
res[:10])
log.error(msg)
raise RuntimeError(msg)
log.info('Success.')
......
......@@ -58,7 +58,7 @@ class SuperSegmentationDataset(object):
if True, locking is enabled for SSO files.
"""
self.ssv_dict = {}
self.mapping_dict = {}
self._mapping_dict = None
self.sso_caching = sso_caching
self.sso_locking = sso_locking
self._mapping_dict_reversed = None
......@@ -197,6 +197,16 @@ class SuperSegmentationDataset(object):
def id_changer_exists(self):
return os.path.exists(self.id_changer_path)
@property
def mapping_dict(self):
if self._mapping_dict is None:
if self.mapping_dict_exists:
self.load_mapping_dict()
else:
self._mapping_dict = {}
return self._mapping_dict
@property
def mapping_dict_reversed(self):
if self._mapping_dict_reversed is None:
......@@ -494,7 +504,7 @@ class SuperSegmentationDataset(object):
def load_mapping_dict(self):
assert self.mapping_dict_exists
self.mapping_dict = load_pkl2obj(self.mapping_dict_path)
self._mapping_dict = load_pkl2obj(self.mapping_dict_path)
def load_mapping_dict_reversed(self):
assert self.mapping_dict_reversed_exists
......@@ -575,8 +585,9 @@ def save_dataset_deep(ssd, extract_only=False, attr_keys=(), n_jobs=None,
attr_dict[attribute] += this_attr_dict[attribute]
if not ssd.mapping_dict_exists:
ssd.mapping_dict = dict(zip(attr_dict["id"], attr_dict["sv"]))
if not ssd.mapping_dict_exists or len(ssd.mapping_dict) == 0:
# initialize mapping dict
ssd._mapping_dict = dict(zip(attr_dict["id"], attr_dict["sv"]))
ssd.save_dataset_shallow()
for attribute in attr_dict.keys():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment