Skip to content

Commit a2a6f83

Browse files
committed
First draft of changes for ilastik
1 parent dbd6e0d commit a2a6f83

File tree

1 file changed

+25
-21
lines changed

1 file changed

+25
-21
lines changed

active_plugins/runilastik.py

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,12 @@ def create_settings(self):
8383

8484
self.docker_or_local = Choice(
8585
text="Run ilastik in docker or local environment",
86-
choices=["Docker", "Local"],
86+
choices=["Docker", "Podman", "Local"],
8787
value="Docker",
8888
doc="""\
8989
If Docker is selected, ensure that Docker Desktop is open and running on your
90-
computer. On first run of the Runilastik plugin, the Docker container will be
90+
computer; likewise for Podman, ensure Podman Desktop is running. On first run
91+
of the Runilastik plugin, the Docker container will be
9192
downloaded. However, this slow downloading process will only have to happen
9293
once.
9394
@@ -165,7 +166,7 @@ def settings(self):
165166
def visible_settings(self):
166167

167168
vis_settings = [self.docker_or_local]
168-
if self.docker_or_local.value == "Docker":
169+
if self.docker_or_local.value in ["Docker","Podman"]:
169170
vis_settings += [self.docker_choice]
170171

171172
if self.docker_choice == "select your own":
@@ -225,9 +226,27 @@ def run(self, workspace):
225226

226227
fout.close()
227228

228-
if self.docker_or_local.value == "Docker":
229-
# Define how to call docker
230-
docker_path = "docker" if sys.platform.lower().startswith("win") else "/usr/local/bin/docker"
229+
if self.docker_or_local.value == "Local":
230+
231+
if self.executable.value[-4:] == ".app":
232+
executable = os.path.join(self.executable.value, "Contents/MacOS/ilastik")
233+
else:
234+
executable = self.executable.value
235+
236+
fout_name = fout.name
237+
fin_name = fin.name
238+
239+
cmd = [
240+
executable,
241+
"--headless",
242+
"--project", self.project_file.value]
243+
244+
else:
245+
if self.docker_or_local.value == "Docker":
246+
# Define how to call docker
247+
docker_path = "docker" if sys.platform.lower().startswith("win") else "/usr/local/bin/docker"
248+
else:
249+
docker_path = "podman" if sys.platform.lower().startswith("win") else "/opt/podman/bin/podman"
231250
# The project file is stored in a directory which can be pointed to the docker
232251
model_file = self.project_file.value
233252
model_directory = os.path.dirname(os.path.abspath(model_file))
@@ -250,21 +269,6 @@ def run(self, workspace):
250269
"--project", f"/model/{os.path.basename(model_file)}"
251270
]
252271

253-
if self.docker_or_local.value == "Local":
254-
255-
if self.executable.value[-4:] == ".app":
256-
executable = os.path.join(self.executable.value, "Contents/MacOS/ilastik")
257-
else:
258-
executable = self.executable.value
259-
260-
fout_name = fout.name
261-
fin_name = fin.name
262-
263-
cmd = [
264-
executable,
265-
"--headless",
266-
"--project", self.project_file.value]
267-
268272
cmd += ["--output_format", "hdf5"]
269273

270274

0 commit comments

Comments
 (0)