Option to run scan without background detect in webapp and Thing
This commit is contained in:
parent
89dae7ba80
commit
d219e32bc8
2 changed files with 21 additions and 15 deletions
|
|
@ -330,6 +330,7 @@ class SmartScanThing(Thing):
|
||||||
csm: CSMDep,
|
csm: CSMDep,
|
||||||
background_detect: BackgroundDep,
|
background_detect: BackgroundDep,
|
||||||
recentre: RecentreStage,
|
recentre: RecentreStage,
|
||||||
|
sample_check
|
||||||
):
|
):
|
||||||
"""Move the stage to cover an area, taking images that can be tiled together.
|
"""Move the stage to cover an area, taking images that can be tiled together.
|
||||||
|
|
||||||
|
|
@ -345,16 +346,23 @@ class SmartScanThing(Thing):
|
||||||
|
|
||||||
# Before anything else, check that we've got a background set
|
# Before anything else, check that we've got a background set
|
||||||
# It's annoying to have to wait to find out!
|
# It's annoying to have to wait to find out!
|
||||||
|
max_dist = self.max_range
|
||||||
|
|
||||||
d = background_detect.background_distributions
|
if sample_check:
|
||||||
if not d:
|
d = background_detect.background_distributions
|
||||||
raise RuntimeError("Background is not set: you need to calibrate background detection.")
|
if not d:
|
||||||
|
raise RuntimeError("Background is not set: you need to calibrate background detection.")
|
||||||
|
else:
|
||||||
|
logger.warning(
|
||||||
|
"This scan will run in a spiral from the starting point "
|
||||||
|
f"until you cancel it, or until it has moved by {max_dist} steps "
|
||||||
|
"in every direction. Make sure you watch it run to stop it leaving "
|
||||||
|
"the area of interest, or (worse) leading the microscope's range "
|
||||||
|
"of motion."
|
||||||
|
)
|
||||||
names = []
|
names = []
|
||||||
positions = []
|
positions = []
|
||||||
|
|
||||||
max_dist = self.max_range
|
|
||||||
|
|
||||||
# Record the starting position so we can move back there afterwards
|
# Record the starting position so we can move back there afterwards
|
||||||
starting_position = stage.position
|
starting_position = stage.position
|
||||||
|
|
||||||
|
|
@ -422,11 +430,13 @@ class SmartScanThing(Thing):
|
||||||
)
|
)
|
||||||
|
|
||||||
# Check if the image is background
|
# Check if the image is background
|
||||||
image_is_sample = background_detect.image_is_sample()
|
if sample_check:
|
||||||
|
image_is_sample = background_detect.image_is_sample()
|
||||||
|
else:
|
||||||
|
image_is_sample = True
|
||||||
|
|
||||||
# if more than 92% of the image is background, treat it as background and continue
|
# if more than 92% of the image is background, treat it as background and continue
|
||||||
if not image_is_sample:
|
if not image_is_sample:
|
||||||
category = "background"
|
|
||||||
logger.info(f"Skipping {stage.position} as it is {round(background_detect.background_fraction(),0)}% background.")
|
logger.info(f"Skipping {stage.position} as it is {round(background_detect.background_fraction(),0)}% background.")
|
||||||
else:
|
else:
|
||||||
# if not, it's sample. run an autofocus and use the updated height
|
# if not, it's sample. run an autofocus and use the updated height
|
||||||
|
|
@ -443,8 +453,6 @@ class SmartScanThing(Thing):
|
||||||
):
|
):
|
||||||
path.append(pos)
|
path.append(pos)
|
||||||
|
|
||||||
category = "sample"
|
|
||||||
|
|
||||||
attempts = 0
|
attempts = 0
|
||||||
while True:
|
while True:
|
||||||
recentre.looping_autofocus(dz=self.autofocus_dz)
|
recentre.looping_autofocus(dz=self.autofocus_dz)
|
||||||
|
|
|
||||||
|
|
@ -35,15 +35,16 @@
|
||||||
<div class="uk-margin">
|
<div class="uk-margin">
|
||||||
<taskSubmitter
|
<taskSubmitter
|
||||||
:submit-url="smartScanUri"
|
:submit-url="smartScanUri"
|
||||||
|
:submit-data="{ sample_check: true }"
|
||||||
submit-label="Start smart scan"
|
submit-label="Start smart scan"
|
||||||
:can-terminate="true"
|
:can-terminate="true"
|
||||||
:modal-progress="true"
|
:modal-progress="true"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="uk-margin">
|
<div class="uk-margin">
|
||||||
<taskSubmitter
|
<taskSubmitter
|
||||||
:submit-url="standardScanUri"
|
:submit-url="smartScanUri"
|
||||||
|
:submit-data="{ sample_check: false }"
|
||||||
submit-label="Start manual scan"
|
submit-label="Start manual scan"
|
||||||
:can-terminate="true"
|
:can-terminate="true"
|
||||||
:modal-progress="true"
|
:modal-progress="true"
|
||||||
|
|
@ -69,9 +70,6 @@ export default {
|
||||||
},
|
},
|
||||||
smartScanUri() {
|
smartScanUri() {
|
||||||
return this.thingActionUrl("smart_scan", "sample_scan");
|
return this.thingActionUrl("smart_scan", "sample_scan");
|
||||||
},
|
|
||||||
standardScanUri() {
|
|
||||||
return this.thingActionUrl("smart_scan", "standard_scan");
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue