Skip to content

Commit 2174bcf

Browse files
committed
Added "Load example" and "Load current data" buttons
1 parent 615dae6 commit 2174bcf

File tree

2 files changed

+184
-0
lines changed

2 files changed

+184
-0
lines changed

src/routes/sandbox/jsonschema/+page.svelte

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script>
22
import { displayStandardErrorAlert } from '$lib/common/errors';
33
import JSchema from '$lib/components/v2/workflow/JSchema.svelte';
4+
import example from './example.json';
45
56
let schema = undefined;
67
let schemaData = {};
@@ -60,6 +61,18 @@
6061
errorAlert = displayStandardErrorAlert(err, `errorAlert-form`);
6162
}
6263
}
64+
65+
function loadExample() {
66+
jsonSchemaString = JSON.stringify(example, null, 2);
67+
handleJsonSchemaStringChanged();
68+
}
69+
70+
function loadCurrentData() {
71+
if (!jschemaComponent) {
72+
return;
73+
}
74+
jsonDataString = JSON.stringify(jschemaComponent.getArguments(), null, 2);
75+
}
6376
</script>
6477
6578
<h1 class="fw-light">Sandbox page for JSON Schema</h1>
@@ -69,6 +82,9 @@
6982
<div class="col-lg-6 mt-3">
7083
<div class="row">
7184
<div class="col">
85+
<button class="btn btn-outline-primary float-end" on:click={loadExample}>
86+
Load example
87+
</button>
7288
<div class="form-check form-switch">
7389
<input
7490
class="form-check-input"
@@ -117,6 +133,9 @@
117133
{#if valid}
118134
<div class="alert alert-success">Data is valid</div>
119135
{/if}
136+
<button class="btn btn-outline-primary float-end" on:click={loadCurrentData}>
137+
Load current data
138+
</button>
120139
<button class="btn btn-primary" on:click={validate}>Validate</button>
121140
</div>
122141
</div>
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
{
2+
"title": "CellvoyagerToOmeZarrInit",
3+
"type": "object",
4+
"properties": {
5+
"zarr_urls": {
6+
"title": "Zarr Urls",
7+
"type": "array",
8+
"items": {
9+
"type": "string"
10+
},
11+
"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)."
12+
},
13+
"zarr_dir": {
14+
"title": "Zarr Dir",
15+
"type": "string",
16+
"description": "path of the directory where the new OME-Zarrs will be created. (standard argument for Fractal tasks, managed by Fractal server)."
17+
},
18+
"image_dirs": {
19+
"title": "Image Dirs",
20+
"type": "array",
21+
"items": {
22+
"type": "string"
23+
},
24+
"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."
25+
},
26+
"allowed_channels": {
27+
"title": "Allowed Channels",
28+
"type": "array",
29+
"items": {
30+
"$ref": "#/definitions/OmeroChannel"
31+
},
32+
"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."
33+
},
34+
"image_glob_patterns": {
35+
"title": "Image Glob Patterns",
36+
"type": "array",
37+
"items": {
38+
"type": "string"
39+
},
40+
"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."
41+
},
42+
"num_levels": {
43+
"title": "Num Levels",
44+
"default": 5,
45+
"type": "integer",
46+
"description": "Number of resolution-pyramid levels. If set to `5`, there will be the full-resolution level and 4 levels of downsampled images."
47+
},
48+
"coarsening_xy": {
49+
"title": "Coarsening Xy",
50+
"default": 2,
51+
"type": "integer",
52+
"description": "Linear coarsening factor between subsequent levels. If set to `2`, level 1 is 2x downsampled, level 2 is 4x downsampled etc."
53+
},
54+
"image_extension": {
55+
"title": "Image Extension",
56+
"default": "tif",
57+
"type": "string",
58+
"description": "Filename extension of images (e.g. `\"tif\"` or `\"png\"`)"
59+
},
60+
"metadata_table_file": {
61+
"title": "Metadata Table File",
62+
"type": "string",
63+
"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."
64+
},
65+
"overwrite": {
66+
"title": "Overwrite",
67+
"default": false,
68+
"type": "boolean",
69+
"description": "If `True`, overwrite the task output."
70+
}
71+
},
72+
"required": [
73+
"zarr_urls",
74+
"zarr_dir",
75+
"image_dirs",
76+
"allowed_channels"
77+
],
78+
"additionalProperties": false,
79+
"definitions": {
80+
"Window": {
81+
"title": "Window",
82+
"description": "Custom class for Omero-channel window, based on OME-NGFF v0.4.",
83+
"type": "object",
84+
"properties": {
85+
"min": {
86+
"title": "Min",
87+
"type": "integer",
88+
"description": "Do not change. It will be set to `0` by default."
89+
},
90+
"max": {
91+
"title": "Max",
92+
"type": "integer",
93+
"description": "Do not change. It will be set according to bit-depth of the images by default (e.g. 65535 for 16 bit images)."
94+
},
95+
"start": {
96+
"title": "Start",
97+
"type": "integer",
98+
"description": "Lower-bound rescaling value for visualization."
99+
},
100+
"end": {
101+
"title": "End",
102+
"type": "integer",
103+
"description": "Upper-bound rescaling value for visualization."
104+
}
105+
},
106+
"required": [
107+
"start",
108+
"end"
109+
]
110+
},
111+
"OmeroChannel": {
112+
"title": "OmeroChannel",
113+
"description": "Custom class for Omero channels, based on OME-NGFF v0.4.",
114+
"type": "object",
115+
"properties": {
116+
"wavelength_id": {
117+
"title": "Wavelength Id",
118+
"type": "string",
119+
"description": "Unique ID for the channel wavelength, e.g. `A01_C01`."
120+
},
121+
"index": {
122+
"title": "Index",
123+
"type": "integer",
124+
"description": "Do not change. For internal use only."
125+
},
126+
"label": {
127+
"title": "Label",
128+
"type": "string",
129+
"description": "Name of the channel."
130+
},
131+
"window": {
132+
"$ref": "#/definitions/Window",
133+
"title": "Window",
134+
"description": "Optional `Window` object to set default display settings for napari."
135+
},
136+
"color": {
137+
"title": "Color",
138+
"type": "string",
139+
"description": "Optional hex colormap to display the channel in napari (it must be of length 6, e.g. `00FFFF`)."
140+
},
141+
"active": {
142+
"title": "Active",
143+
"default": true,
144+
"type": "boolean",
145+
"description": "Should this channel be shown in the viewer?"
146+
},
147+
"coefficient": {
148+
"title": "Coefficient",
149+
"default": 1,
150+
"type": "integer",
151+
"description": "Do not change. Omero-channel attribute."
152+
},
153+
"inverted": {
154+
"title": "Inverted",
155+
"default": false,
156+
"type": "boolean",
157+
"description": "Do not change. Omero-channel attribute."
158+
}
159+
},
160+
"required": [
161+
"wavelength_id"
162+
]
163+
}
164+
}
165+
}

0 commit comments

Comments
 (0)