Skip to content
This repository was archived by the owner on Apr 20, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.project
docs/_build
.pydevproject
#KDevelop project files
*.kdev4
Expand Down
4 changes: 2 additions & 2 deletions lazyflow/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class Operator(object):

Operators consist of a class inheriting from this class
and need to specify their inputs and outputs via
thei inputSlot and outputSlot class properties.
their inputSlot and outputSlot class properties.

Each instance of an operator obtains individual
copies of the inputSlots and outputSlots, which are
Expand Down Expand Up @@ -562,4 +562,4 @@ def debug_text(self):

# @debug_text.setter
# def debug_text(self, text):
# self._debug_text = text
# self._debug_text = text
4 changes: 3 additions & 1 deletion lazyflow/operatorWrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ def _removeInnerOperator(self, index, length):

op = self.innerOperators.pop(index)
for slot in op.inputs.values():
slot.backpropagate_values = False
slot.unregisterDisconnect(self.handleEarlyDisconnect)

for oslot in self.outputs.values():
Expand All @@ -279,6 +278,9 @@ def _removeInnerOperator(self, index, length):
if outerSlot.name in self.promotedSlotNames:
outerSlot.removeSlot(index, length)

for slot in op.inputs.values():
slot.backpropagate_values = False

op.cleanUp()

def _setupOutputs(self):
Expand Down
13 changes: 8 additions & 5 deletions lazyflow/operators/opCompressedCache.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,11 +523,7 @@ def _setInSlotInput(self, slot, subindex, roi, value, store_zero_blocks=True):

# If we can, remove this block entirely.
if not store_zero_blocks and new_block_sum == 0 and (dataset[:] == 0).all():
with self._lock:
with self._blockLocks[block_start]:
self._cacheFiles[block_start].close()
del self._cacheFiles[block_start]
del self._blockLocks[block_start]
self._deleteBlock(block_start)

# Here, we assume that if this function is used to update ANY PART of a
# block, he is responsible for updating the ENTIRE block.
Expand All @@ -538,6 +534,13 @@ def _setInSlotInput(self, slot, subindex, roi, value, store_zero_blocks=True):
# self.OutputHdf5._sig_value_changed()
# self.CleanBlocks._sig_value_changed()

def _deleteBlock(self, block_start):
with self._lock:
with self._blockLocks[block_start]:
self._cacheFiles[block_start].close()
del self._cacheFiles[block_start]
del self._blockLocks[block_start]

def _setInSlotInputHdf5(self, slot, subindex, roi, value):
logger.debug("Setting block {} from hdf5".format( roi ))
if self.Output.meta.has_mask:
Expand Down
10 changes: 9 additions & 1 deletion lazyflow/operators/opCompressedUserLabelArray.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@ def clearLabel(self, label_value):
"""
self._purge_label( label_value, False )

def clearAllLabels(self):
"""
Nearly the same as _purge_label but deleting all the >0 entries.
"""
for block_start in list(self._blockLocks.keys()):
self._deleteBlock(block_start)
self._dirtyBlocks = set()
self.Output.setDirty()

def mergeLabels(self, from_label, into_label):
self._purge_label(from_label, True, into_label)

Expand Down Expand Up @@ -173,7 +182,6 @@ def _purge_label(self, label_to_purge, decrement_remaining, replacement_value=0)
changed_block_rois.append( block_roi )

for block_roi in changed_block_rois:
# FIXME: Shouldn't this dirty notification be handled in OpUnmanagedCompressedCache?
self.Output.setDirty( *block_roi )

def execute(self, slot, subindex, roi, destination):
Expand Down
5 changes: 5 additions & 0 deletions lazyflow/operators/opReorderAxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ def propagateDirty(self, inputSlot, subindex, in_roi):
else:
assert False, "Unknown input slot: {}".format( inputSlot.name )


def setInSlot(self, slot, subindex, roi, value):
#TODO #FIXME added here, otherwise always a NotImplementedError
pass

# Helper function: Like list.index(), but return -1 for missing elements instead of raising a ValueError
def _index(tup, element):
try:
Expand Down