Added arg to affix metadata and tags to scans

This commit is contained in:
Joel Collins 2019-03-07 09:53:25 +00:00
parent cd4bab94ab
commit d10263adf8

View file

@ -16,11 +16,13 @@ class ScanPlugin(MicroscopePlugin):
api_views = {} api_views = {}
def capture(self, def capture(self,
basename, basename,
scan_id, scan_id,
use_video_port: bool = False, use_video_port: bool = False,
resize: Tuple[int, int] = None, resize: Tuple[int, int] = None,
bayer: bool = False): bayer: bool = False,
metadata: dict = {},
tags: list = []):
# Construct a tile filename # Construct a tile filename
filename = "{}_{}_{}_{}".format(basename, *self.microscope.stage.position) filename = "{}_{}_{}_{}".format(basename, *self.microscope.stage.position)
@ -41,8 +43,8 @@ class ScanPlugin(MicroscopePlugin):
bayer=bayer) bayer=bayer)
# Affix metadata # Affix metadata
metadata = {} if 'stack' not in tags:
tags = ['stack'] tags.append('stack')
metadata.update({ metadata.update({
'Position': self.microscope.state['stage']['position'], 'Position': self.microscope.state['stage']['position'],
@ -60,7 +62,9 @@ class ScanPlugin(MicroscopePlugin):
autofocus_dz: int = 20, autofocus_dz: int = 20,
use_video_port: bool = False, use_video_port: bool = False,
resize: Tuple[int, int] = None, resize: Tuple[int, int] = None,
bayer: bool = False): bayer: bool = False,
metadata: dict = {},
tags: list = []):
# Generate a basename if none given # Generate a basename if none given
if not basename: if not basename:
@ -93,7 +97,9 @@ class ScanPlugin(MicroscopePlugin):
scan_id, scan_id,
use_video_port=use_video_port, use_video_port=use_video_port,
resize=resize, resize=resize,
bayer=bayer bayer=bayer,
metadata=metadata,
tags=tags
) )
if j != grid[0] - 1: if j != grid[0] - 1:
@ -113,7 +119,9 @@ class ScanPlugin(MicroscopePlugin):
center: bool = True, center: bool = True,
use_video_port: bool = False, use_video_port: bool = False,
resize: Tuple[int, int] = None, resize: Tuple[int, int] = None,
bayer: bool = False): bayer: bool = False,
metadata: dict = {},
tags: list = []):
# Generate a basename if none given # Generate a basename if none given
if not basename: if not basename:
@ -138,7 +146,9 @@ class ScanPlugin(MicroscopePlugin):
scan_id, scan_id,
use_video_port=use_video_port, use_video_port=use_video_port,
resize=resize, resize=resize,
bayer=bayer bayer=bayer,
metadata=metadata,
tags=tags
) )
if i != steps - 1: if i != steps - 1: