Update how stitching is called in Windows
This commit is contained in:
parent
00a0301e0c
commit
ec29a1999f
2 changed files with 10 additions and 2 deletions
|
|
@ -18,6 +18,8 @@ import labthings_fastapi as lt
|
||||||
|
|
||||||
from openflexure_microscope_server.utilities import make_path_safe
|
from openflexure_microscope_server.utilities import make_path_safe
|
||||||
|
|
||||||
|
IS_WINDOWS = os.name == "nt"
|
||||||
|
|
||||||
STITCHING_CMD = "openflexure-stitch"
|
STITCHING_CMD = "openflexure-stitch"
|
||||||
STITCHING_RESOLUTION = (820, 616)
|
STITCHING_RESOLUTION = (820, 616)
|
||||||
STITCH_TILE_SIZE = 8192
|
STITCH_TILE_SIZE = 8192
|
||||||
|
|
@ -95,7 +97,8 @@ class BaseStitcher:
|
||||||
self.validate_path()
|
self.validate_path()
|
||||||
|
|
||||||
# The command, and the mode
|
# The command, and the mode
|
||||||
initial_args = shlex.split(STITCHING_CMD) + ["--stitching_mode", self._mode]
|
base_args = shlex.split(STITCHING_CMD, posix=not IS_WINDOWS)
|
||||||
|
initial_args = base_args + ["--stitching_mode", self._mode]
|
||||||
# Use float() just to really ensure that anything input is a float
|
# Use float() just to really ensure that anything input is a float
|
||||||
setting_args = [
|
setting_args = [
|
||||||
"--minimum_overlap",
|
"--minimum_overlap",
|
||||||
|
|
@ -181,7 +184,11 @@ class PreviewStitcher(BaseStitcher):
|
||||||
except lt.exceptions.InvocationCancelledError as e:
|
except lt.exceptions.InvocationCancelledError as e:
|
||||||
with self._popen_lock:
|
with self._popen_lock:
|
||||||
if self._popen_obj is not None:
|
if self._popen_obj is not None:
|
||||||
self._popen_obj.send_signal(signal.SIGKILL)
|
if IS_WINDOWS:
|
||||||
|
# Windows has no SIGKILL
|
||||||
|
self._popen_obj.kill()
|
||||||
|
else:
|
||||||
|
self._popen_obj.send_signal(signal.SIGKILL)
|
||||||
raise (e)
|
raise (e)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -235,6 +235,7 @@ class StitchingTestThing(lt.Thing):
|
||||||
"""Run the final stitcher."""
|
"""Run the final stitcher."""
|
||||||
stitcher = FinalStitcher(FAKE_DIR, logger=self.logger)
|
stitcher = FinalStitcher(FAKE_DIR, logger=self.logger)
|
||||||
# Send in the argument HANG to mock-stitch and it just hang for 10s
|
# Send in the argument HANG to mock-stitch and it just hang for 10s
|
||||||
|
stitcher._extra_args = ["HANG"]
|
||||||
stitcher.run()
|
stitcher.run()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue