Skip to content

Commit

Permalink
Added "Load example" and "Load current data" buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
zonia3000 committed May 21, 2024
1 parent 615dae6 commit 2174bcf
Show file tree
Hide file tree
Showing 2 changed files with 184 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/routes/sandbox/jsonschema/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script>
import { displayStandardErrorAlert } from '$lib/common/errors';
import JSchema from '$lib/components/v2/workflow/JSchema.svelte';
import example from './example.json';
let schema = undefined;
let schemaData = {};
Expand Down Expand Up @@ -60,6 +61,18 @@
errorAlert = displayStandardErrorAlert(err, `errorAlert-form`);
}
}
function loadExample() {
jsonSchemaString = JSON.stringify(example, null, 2);
handleJsonSchemaStringChanged();
}
function loadCurrentData() {
if (!jschemaComponent) {
return;
}
jsonDataString = JSON.stringify(jschemaComponent.getArguments(), null, 2);
}
</script>
<h1 class="fw-light">Sandbox page for JSON Schema</h1>
Expand All @@ -69,6 +82,9 @@
<div class="col-lg-6 mt-3">
<div class="row">
<div class="col">
<button class="btn btn-outline-primary float-end" on:click={loadExample}>
Load example
</button>
<div class="form-check form-switch">
<input
class="form-check-input"
Expand Down Expand Up @@ -117,6 +133,9 @@
{#if valid}
<div class="alert alert-success">Data is valid</div>
{/if}
<button class="btn btn-outline-primary float-end" on:click={loadCurrentData}>
Load current data
</button>
<button class="btn btn-primary" on:click={validate}>Validate</button>
</div>
</div>
Expand Down
165 changes: 165 additions & 0 deletions src/routes/sandbox/jsonschema/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
{
"title": "CellvoyagerToOmeZarrInit",
"type": "object",
"properties": {
"zarr_urls": {
"title": "Zarr Urls",
"type": "array",
"items": {
"type": "string"
},
"description": "List of paths or urls to the individual OME-Zarr image to be processed. Not used by the converter task. (standard argument for Fractal tasks, managed by Fractal server)."
},
"zarr_dir": {
"title": "Zarr Dir",
"type": "string",
"description": "path of the directory where the new OME-Zarrs will be created. (standard argument for Fractal tasks, managed by Fractal server)."
},
"image_dirs": {
"title": "Image Dirs",
"type": "array",
"items": {
"type": "string"
},
"description": "list of paths to the folders that contains the Cellvoyager image files. Each entry is a path to a folder that contains the image files themselves for a multiwell plate and the MeasurementData & MeasurementDetail metadata files."
},
"allowed_channels": {
"title": "Allowed Channels",
"type": "array",
"items": {
"$ref": "#/definitions/OmeroChannel"
},
"description": "A list of `OmeroChannel` s, where each channel must include the `wavelength_id` attribute and where the `wavelength_id` values must be unique across the list."
},
"image_glob_patterns": {
"title": "Image Glob Patterns",
"type": "array",
"items": {
"type": "string"
},
"description": "If specified, only parse images with filenames that match with all these patterns. Patterns must be defined as in https://docs.python.org/3/library/fnmatch.html, Example: `image_glob_pattern=[\"*_B03_*\"]` => only process well B03 `image_glob_pattern=[\"*_C09_*\", \"*F016*\", \"*Z[0-5][0-9]C*\"]` => only process well C09, field of view 16 and Z planes 0-59."
},
"num_levels": {
"title": "Num Levels",
"default": 5,
"type": "integer",
"description": "Number of resolution-pyramid levels. If set to `5`, there will be the full-resolution level and 4 levels of downsampled images."
},
"coarsening_xy": {
"title": "Coarsening Xy",
"default": 2,
"type": "integer",
"description": "Linear coarsening factor between subsequent levels. If set to `2`, level 1 is 2x downsampled, level 2 is 4x downsampled etc."
},
"image_extension": {
"title": "Image Extension",
"default": "tif",
"type": "string",
"description": "Filename extension of images (e.g. `\"tif\"` or `\"png\"`)"
},
"metadata_table_file": {
"title": "Metadata Table File",
"type": "string",
"description": "If `None`, parse Yokogawa metadata from mrf/mlf files in the input_path folder; else, the full path to a csv file containing the parsed metadata table."
},
"overwrite": {
"title": "Overwrite",
"default": false,
"type": "boolean",
"description": "If `True`, overwrite the task output."
}
},
"required": [
"zarr_urls",
"zarr_dir",
"image_dirs",
"allowed_channels"
],
"additionalProperties": false,
"definitions": {
"Window": {
"title": "Window",
"description": "Custom class for Omero-channel window, based on OME-NGFF v0.4.",
"type": "object",
"properties": {
"min": {
"title": "Min",
"type": "integer",
"description": "Do not change. It will be set to `0` by default."
},
"max": {
"title": "Max",
"type": "integer",
"description": "Do not change. It will be set according to bit-depth of the images by default (e.g. 65535 for 16 bit images)."
},
"start": {
"title": "Start",
"type": "integer",
"description": "Lower-bound rescaling value for visualization."
},
"end": {
"title": "End",
"type": "integer",
"description": "Upper-bound rescaling value for visualization."
}
},
"required": [
"start",
"end"
]
},
"OmeroChannel": {
"title": "OmeroChannel",
"description": "Custom class for Omero channels, based on OME-NGFF v0.4.",
"type": "object",
"properties": {
"wavelength_id": {
"title": "Wavelength Id",
"type": "string",
"description": "Unique ID for the channel wavelength, e.g. `A01_C01`."
},
"index": {
"title": "Index",
"type": "integer",
"description": "Do not change. For internal use only."
},
"label": {
"title": "Label",
"type": "string",
"description": "Name of the channel."
},
"window": {
"$ref": "#/definitions/Window",
"title": "Window",
"description": "Optional `Window` object to set default display settings for napari."
},
"color": {
"title": "Color",
"type": "string",
"description": "Optional hex colormap to display the channel in napari (it must be of length 6, e.g. `00FFFF`)."
},
"active": {
"title": "Active",
"default": true,
"type": "boolean",
"description": "Should this channel be shown in the viewer?"
},
"coefficient": {
"title": "Coefficient",
"default": 1,
"type": "integer",
"description": "Do not change. Omero-channel attribute."
},
"inverted": {
"title": "Inverted",
"default": false,
"type": "boolean",
"description": "Do not change. Omero-channel attribute."
}
},
"required": [
"wavelength_id"
]
}
}
}

0 comments on commit 2174bcf

Please sign in to comment.