Skip to content

Commit

Permalink
vfv and InputFileMixin: use cached_property
Browse files Browse the repository at this point in the history
  • Loading branch information
gmazzamuto committed May 5, 2023
1 parent 8bb3e95 commit 0f12b83
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
5 changes: 2 additions & 3 deletions zetastitcher/fuse/virtual_fused_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import threading

from queue import Queue
from functools import lru_cache
from functools import cached_property

import numpy as np

Expand Down Expand Up @@ -90,8 +90,7 @@ def overlay_debug_enabled(self):
def overlay_debug_enabled(self, value):
self._debug = value

@property
@lru_cache()
@cached_property
def shape(self):
"""Shape of the whole stitched volume.
Expand Down
26 changes: 21 additions & 5 deletions zetastitcher/io/inputfile_mixin.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import numpy as np
from functools import cached_property


class InputFileMixin:
def __init__(self):
self.path = None
self.xsize = None
self.ysize = None
self.nfrms = None
self.dtype = None
self.nchannels = 1

def __del__(self):
self.close()
Expand All @@ -19,6 +15,26 @@ def __enter__(self):
def __exit__(self, *args):
self.close()

@cached_property
def xsize(self):
pass

@cached_property
def ysize(self):
pass

@cached_property
def nfrms(self):
pass

@cached_property
def dtype(self):
pass

@cached_property
def nchannels(self):
return 1

def close(self):
pass

Expand Down

0 comments on commit 0f12b83

Please sign in to comment.