-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Currently, the input dataset selection in the application is implemented by populating a dropdown with a list of options assembled by iterating over elements in the container specified by DATA_TILED_URI. For any element, the element is added if:
- it is an array, or
- it is a container that contains a single array (occurs when Tiled has grouped sequence of images in a folder)
- it is a container with a recognized Spec (e.g., NXtomoproc) that indicates an array exists further down the hierarchy (used for nested HDF5/Nexus structures).
mlex_highres_segmentation/utils/data_utils.py
Lines 135 to 164 in 354dc33
| def get_data_sequence_by_name(self, project_name): | |
| """ | |
| Data sequences may be given directly inside the main client container, | |
| but can also be additionally encapsulated in a folder, multiple container or in a .nxs file. | |
| We make use of specs to figure out the path to the 3d data. | |
| """ | |
| if self.data_client is None or project_name is None: | |
| return None | |
| project_client = self.data_client[project_name] | |
| # If the project directly points to an array, directly return it | |
| if isinstance(project_client, ArrayClient): | |
| return project_client | |
| # If project_name points to a container | |
| elif isinstance(project_client, Container): | |
| # Check if the specs give us information about which sub-container to access | |
| specs = project_client.specs | |
| # TODO: Read yaml file with spec to path mapping | |
| if any(spec.name == "NXtomoproc" for spec in specs): | |
| # Example for how to access data if the project container corresponds to a | |
| # nexus-file following the NXtomoproc definition | |
| # TODO: This assumes that a validator has checked the file on ingestion | |
| # Otherwise we should first test if the path holds data | |
| return project_client["entry/data/data"] | |
| # Enter the container and return first element | |
| # if it represents an array | |
| if len(list(project_client)) == 1: | |
| sequence_client = project_client.values()[0] | |
| if isinstance(sequence_client, ArrayClient): | |
| return sequence_client | |
| return None |
Assume the configured dataset container (e.g. DATA_TILED_URI=https://tiled-seg.als.lbl.gov/api/v1/metadata/reconstruction) has the following structure:
/reconstruction/
/reconstruction/dataset1 ← array
/reconstruction/dataset2 ← container
/reconstruction/dataset2/dataset2_ ← array
/reconstruction/dataset3 ← has `Spec(name='NXtomoproc') → array under entry/data/data
In this case, the dropdown would contain [dataset1, dataset2, dataset3] as options. These dropdown entries are later used as project names when referencing derived data (e.g. masks, segmentations) and are used to determine where results are stored under MASK_TILED_URI and SEG_TILED_URI. In case of new additions to Tiled, the options can be updated through a refresh button.
This approach is functional for small catalogs but scales poorly and restricts dataset selection to a fixed hierarchy depth.
We need this more flexible and robust in case of large catalogs, and also support various authentication mechanism for Tiled access. This can be accomplished with integration of the tiled_viewer Dash component which wraps a corresponding React Tiled Viewer component. This would allow interactive, lazy-loaded navigation through large catalogs and support authenticated access.