diff --git a/GettingStarted/result_caching.html b/GettingStarted/result_caching.html index 3bdd542..805c1b4 100644 --- a/GettingStarted/result_caching.html +++ b/GettingStarted/result_caching.html @@ -178,8 +178,8 @@
self.tmpdir.cache()
and self.tmpdir.cache_im()
to create cache files:
class ExampleSegProcess(SegProcess):
- def forward(self, im, cptr: CachePointer, viewer: napari.Viewer = None):
+ async def forward(self, im, cptr: CachePointer, viewer: napari.Viewer = None):
cache_path = cptr.subpath()
- # in the case cache does not exists, cache_path.abs_path is an empty path we can create a folder in:
+ # in the case cache does not exists, cache_path.url is an empty path we can create a folder in:
if not cache_path.exists:
- os.makedirs(cache_path.abs_path)
+ os.makedirs(cache_path.url)
result = compute_result(im)
- save(cache_path.abs_path, result)
- result = load(cache_path.abs_path)
+ save(cache_path.url, result)
+ result = load(cache_path.url)
return result
lc_interpretable_napari()
or temp_directory.cache_im()
while passing in viewer_args
argument to display your results:
class ExampleSegProcess(SegProcess):
- def forward(self, im, cptr: CachePointer, viewer_args: dict = None):
+ async def forward(self, im, cptr: CachePointer, viewer_args: dict = None):
if viewer_args is None:
viewer_args = {}
result = compute_result(im)
- result = cptr.im(lambda: result, viewer_args=viewer_args) # caching result at location pointed by cptr
+ result = await cptr.im(lambda: result, viewer_args=viewer_args) # caching result at location pointed by cptr
return result
# ...
viewer = napari.Viewer(ndisplay=2)
@@ -223,7 +223,7 @@ Extending the Pipelinemultiscale=4 if viewer else 0, # maximum downsampling level of ome zarr files, necessary for very large images
)
process = ExampleSegProcess()
-process.forward(im, cptr = root_dir.cache(cid='compute'), viewer_args=viewer_args)
+await process.forward(im, cptr = root_dir.cache(cid='compute'), viewer_args=viewer_args)
viewer_args
is a parameter that allows us to visualize the saved results as part of the caching
@@ -258,7 +258,7 @@