From 8ef7e0663e9ec4abdf94f8669f23b03bb9c9c422 Mon Sep 17 00:00:00 2001
From: s184058 <s184058@student.dtu.dk>
Date: Wed, 14 Feb 2024 10:32:06 +0100
Subject: [PATCH] Change gui launch pipeline

---
 qim3d/__init__.py            |  1 -
 qim3d/gui/local_thickness.py |  3 ++-
 qim3d/io/downloader.py       |  2 +-
 qim3d/utils/cli.py           | 30 +++++++++++++++++++++++-------
 4 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/qim3d/__init__.py b/qim3d/__init__.py
index eca0e61d..c51e707e 100644
--- a/qim3d/__init__.py
+++ b/qim3d/__init__.py
@@ -6,4 +6,3 @@ import qim3d.models as models
 import logging
 
 examples = io.ImgExamples()
-downloader = io.Downloader()
diff --git a/qim3d/gui/local_thickness.py b/qim3d/gui/local_thickness.py
index ae4b625b..632db4db 100644
--- a/qim3d/gui/local_thickness.py
+++ b/qim3d/gui/local_thickness.py
@@ -71,7 +71,7 @@ class Interface:
         session.zpos = zpos
         return session
 
-    def launch(self, img=None):
+    def launch(self, img=None,**kwargs):
         # Show header
         if self.show_header:
             internal_tools.gradio_header(self.title, self.port)
@@ -90,6 +90,7 @@ class Interface:
             quiet=quiet,
             height=self.height,
             width=self.width,
+            **kwargs
         )
 
         return
diff --git a/qim3d/io/downloader.py b/qim3d/io/downloader.py
index d619c78e..b4644a49 100644
--- a/qim3d/io/downloader.py
+++ b/qim3d/io/downloader.py
@@ -22,7 +22,7 @@ class Downloader:
         [folder_name_n] (str): folder class with the name of the n-th folder in the QIM data repository.
 
     Example:
-        dl = Downloader()
+        dl = qim3d.io.Downloader()
         # Downloads and Loads (optional) image:
         img = dl.Corals.Coral2_DOWNSAMPLED(load = True)
     """
diff --git a/qim3d/utils/cli.py b/qim3d/utils/cli.py
index f48a5b81..2b6e3bd0 100644
--- a/qim3d/utils/cli.py
+++ b/qim3d/utils/cli.py
@@ -13,23 +13,39 @@ def main():
     gui_parser.add_argument('--annotation-tool', action='store_true', help='Run annotation tool.')
     gui_parser.add_argument('--local-thickness', action='store_true', help='Run local thickness tool.')
     gui_parser.add_argument('--host', default='0.0.0.0', help='Desired host.')
+    gui_parser.add_argument('--platform', action='store_true', help='Use QIM platform address')
+
 
     args = parser.parse_args()
 
     if args.subcommand == 'gui':
         arghost = args.host
         if args.data_explorer:
-            
-            data_explorer.run_interface(arghost)
+            if args.platform:
+                data_explorer.run_interface(arghost)
+            else:
+                interface = data_explorer.Interface()
+                interface.launch()
+
 
         elif args.iso3d:
-            iso3d.run_interface(arghost)
+            if args.platform:
+                iso3d.run_interface(arghost)
+            else:
+                interface = iso3d.Interface()
+                interface.launch()            
         
         elif args.annotation_tool:
-            annotation_tool.run_interface(arghost)
-        
+            if args.platform:
+                annotation_tool.run_interface(arghost)
+            else:
+                interface = annotation_tool.Interface()
+                interface.launch()        
         elif args.local_thickness:
-            local_thickness.run_interface(arghost)
-
+            if args.platform:
+                local_thickness.run_interface(arghost)
+            else:
+                interface = local_thickness.Interface()
+                interface.launch()
 if __name__ == '__main__':
     main()
\ No newline at end of file
-- 
GitLab