Skip to content
Snippets Groups Projects
Commit 955e7f8b authored by fima's avatar fima :beers:
Browse files

Merge branch 'FileExplorer' into 'main'

Updated File explorer to work with large data directories

See merge request !65
parents b4590be2 4030ef41
No related branches found
No related tags found
1 merge request!65Updated File explorer to work with large data directories
...@@ -15,19 +15,21 @@ app.launch() ...@@ -15,19 +15,21 @@ app.launch()
``` ```
""" """
import gradio as gr
import numpy as np
import os
from qim3d.utils import internal_tools
from qim3d.io import load
from qim3d.io.logger import log
import tifffile
import outputformat as ouf
import datetime import datetime
import os
import gradio as gr
import matplotlib import matplotlib
# matplotlib.use("Agg") # matplotlib.use("Agg")
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import numpy as np
import outputformat as ouf
import tifffile
from qim3d.io import load
from qim3d.io.logger import log
from qim3d.utils import internal_tools
class Interface: class Interface:
...@@ -45,7 +47,6 @@ class Interface: ...@@ -45,7 +47,6 @@ class Interface:
"Z min projection", "Z min projection",
"Intensity histogram", "Intensity histogram",
"Data summary", "Data summary",
] ]
# CSS path # CSS path
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
...@@ -118,7 +119,7 @@ class Interface: ...@@ -118,7 +119,7 @@ class Interface:
value="", elem_classes="btn-html h-36" value="", elem_classes="btn-html h-36"
) )
explorer = gr.FileExplorer( explorer = gr.FileExplorer(
glob="{*/,}{*.*}", ignore_glob="*/.*", # ignores hidden files
root_dir=os.getcwd(), root_dir=os.getcwd(),
label=os.getcwd(), label=os.getcwd(),
render=True, render=True,
...@@ -406,8 +407,10 @@ class Pipeline: ...@@ -406,8 +407,10 @@ class Pipeline:
virtual_stack=session.virtual_stack, virtual_stack=session.virtual_stack,
dataset_name=session.dataset_name, dataset_name=session.dataset_name,
) )
if session.vol.ndim != 3:
raise ValueError("Invalid data shape should be 3 dimensional, not shape: ", session.vol.shape)
except Exception as error_message: except Exception as error_message:
raise ValueError( raise gr.Error(
f"Failed to load the image: {error_message}" f"Failed to load the image: {error_message}"
) from error_message ) from error_message
......
albumentations>=1.3.1, albumentations>=1.3.1,
gradio>=4.15.0, gradio>=4.22.0,
h5py>=3.9.0, h5py>=3.9.0,
localthickness>=0.1.2, localthickness>=0.1.2,
matplotlib>=3.8.0, matplotlib>=3.8.0,
......
from setuptools import setup, find_packages
import os import os
from setuptools import find_packages, setup
# Read the contents of your README file # Read the contents of your README file
with open("README.md", "r", encoding="utf-8") as f: with open("README.md", "r", encoding="utf-8") as f:
...@@ -38,7 +38,7 @@ setup( ...@@ -38,7 +38,7 @@ setup(
python_requires=">=3.10", python_requires=">=3.10",
install_requires=[ install_requires=[
"albumentations>=1.3.1", "albumentations>=1.3.1",
"gradio>=4.15.0", "gradio>=4.22.0",
"h5py>=3.9.0", "h5py>=3.9.0",
"localthickness>=0.1.2", "localthickness>=0.1.2",
"matplotlib>=3.8.0", "matplotlib>=3.8.0",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment