@@ -240,6 +240,128 @@ def ortho(
240240 launch_orthoviewer (zarr_uri , channel_axis = multichannel , theme = theme , perf = perf )
241241
242242
243+ @app .command ()
244+ def view (
245+ path : Annotated [
246+ str | None ,
247+ typer .Argument (
248+ help = "Path or URI to the OME-Zarr store (local path, s3://, gs://, https://)." ,
249+ show_default = False ,
250+ ),
251+ ] = None ,
252+ path_option : Annotated [
253+ str | None ,
254+ typer .Option (
255+ "--path" ,
256+ help = (
257+ "Path or URI to the OME-Zarr store"
258+ " (alternative to positional argument)."
259+ ),
260+ show_default = False ,
261+ ),
262+ ] = None ,
263+ make_example : Annotated [
264+ bool ,
265+ typer .Option (
266+ "--make-example" ,
267+ help = "Create a synthetic anisotropic OME-Zarr and open it in the viewer." ,
268+ ),
269+ ] = False ,
270+ multichannel : Annotated [
271+ int | None ,
272+ typer .Option (
273+ "--multichannel" ,
274+ help = (
275+ "Dimension index to treat as the channel axis, enabling multichannel"
276+ " mode. If omitted, the channel axis is auto-detected from the"
277+ " OME-Zarr metadata when present."
278+ ),
279+ show_default = False ,
280+ ),
281+ ] = None ,
282+ theme : Annotated [
283+ str ,
284+ typer .Option (
285+ "--theme" ,
286+ help = (
287+ "Theme name to apply. Run 'oz-viewer theme list' to see"
288+ " available themes."
289+ ),
290+ ),
291+ ] = "dark" ,
292+ perf_startup : Annotated [
293+ bool ,
294+ typer .Option (
295+ "--perf-startup/--no-perf-startup" ,
296+ help = "Enable startup performance logging diagnostics." ,
297+ ),
298+ ] = False ,
299+ perf_log_file : Annotated [
300+ Path | None ,
301+ typer .Option (
302+ "--perf-log-file" ,
303+ help = "Write startup performance logs to a file instead of stderr." ,
304+ show_default = False ,
305+ ),
306+ ] = None ,
307+ perf_table : Annotated [
308+ bool ,
309+ typer .Option (
310+ "--perf-table/--no-perf-table" ,
311+ help = "Display startup timings as a Rich table at startup completion." ,
312+ ),
313+ ] = False ,
314+ perf_table_title : Annotated [
315+ str ,
316+ typer .Option (
317+ "--perf-table-title" ,
318+ help = "Title used for the startup performance Rich table." ,
319+ ),
320+ ] = "Viewer startup timings" ,
321+ ) -> None :
322+ """Open an OME-Zarr store in the 2D / 3D toggle viewer."""
323+ from oz_viewer .viewer import launch_viewer
324+
325+ perf_enabled = perf_startup or perf_enabled_from_env ()
326+ configure_perf_logging (
327+ enabled = perf_enabled ,
328+ log_file = str (perf_log_file ) if perf_log_file is not None else None ,
329+ )
330+ perf = StartupPerfTracer (
331+ enabled = perf_enabled ,
332+ show_table = perf_table ,
333+ table_title = perf_table_title ,
334+ )
335+ perf .mark ("cli.view.start" , make_example = make_example , theme = theme )
336+
337+ if make_example :
338+ from oz_viewer .data ._blobs import make_example_zarr
339+
340+ zarr_path = make_example_zarr ()
341+ zarr_uri = f"file://{ zarr_path } "
342+ perf .mark ("cli.view.example_created" , zarr_path = zarr_path )
343+ else :
344+ raw = path or path_option
345+ if raw is None :
346+ typer .echo (
347+ "Error: provide a path as a positional argument, via --path, "
348+ "or use --make-example." ,
349+ err = True ,
350+ )
351+ raise typer .Exit (code = 1 )
352+ if path is not None and path_option is not None :
353+ typer .echo (
354+ "Error: provide the path as a positional argument or --path, not both." ,
355+ err = True ,
356+ )
357+ raise typer .Exit (code = 1 )
358+ zarr_uri = _resolve_zarr_uri (raw )
359+ perf .mark ("cli.view.uri_resolved" , zarr_uri = zarr_uri )
360+
361+ perf .mark ("cli.view.launch" )
362+ launch_viewer (zarr_uri , channel_axis = multichannel , theme = theme , perf = perf )
363+
364+
243365@app .command (name = "theme" )
244366def theme_cmd (
245367 action : Annotated [
0 commit comments