Skip to content

Commit

Permalink
Adding new/updated cellcanvas_napari-cellcanvas_0.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
kephale committed Aug 13, 2024
1 parent d8f2f36 commit a77d368
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 9 deletions.
Binary file modified album_catalog_index.db
Binary file not shown.
3 changes: 3 additions & 0 deletions solutions/cellcanvas/napari-cellcanvas/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.0.5] - 2024-08-13
Update to implement fetch_config functionality

## [0.0.4] - 2024-08-11
Remove defaults

Expand Down
88 changes: 83 additions & 5 deletions solutions/cellcanvas/napari-cellcanvas/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,65 @@
- pyqt
- numpy
- paramiko
- requests
- smbprotocol
- pip:
- album
- "copick[all]"
- "git+https://github.com/kephale/napari-cellcanvas.git"
- "sshfs>=2024.6.0"
"""

def run():
from napari import Viewer
from napari_cellcanvas import CellCanvasWidget
import napari
import requests
import json
import os

# Retrieve the arguments passed to the solution
args = get_args()

copick_config_path = args.copick_config_path
hostname = args.hostname
port = args.port
fetch_config = args.fetch_config
overlay_remote = args.overlay_remote
static_remote = args.static_remote
overlay_path = args.overlay_path
static_path = args.static_path

if fetch_config:
# Construct the URL for the API request
url = f"http://{hostname}:{port}/get-copick-config"

# Prepare the parameters for the API request
params = {
"overlay_remote": overlay_remote,
"static_remote": static_remote
}

# Send the GET request to the server to fetch the config
response = requests.get(url, params=params)

if response.status_code != 200:
raise Exception(f"Failed to fetch config: {response.text}")

config = response.json()["config"]

# If paths are not remote, insert the local paths provided
if not overlay_remote:
config["overlay_root"] = overlay_path or config["overlay_root"]
if not static_remote:
config["static_root"] = static_path or config["static_root"]

# Write the final configuration to the specified file
os.makedirs(os.path.dirname(copick_config_path), exist_ok=True)
with open(copick_config_path, 'w') as f:
json.dump(config, f, indent=4)

print(f"Configuration fetched and written to {copick_config_path}")

# Initialize the Napari viewer
viewer = Viewer()
Expand All @@ -45,9 +87,9 @@ def run():
setup(
group="cellcanvas",
name="napari-cellcanvas",
version="0.0.4",
version="0.0.5",
title="napari-CellCanvas",
description="A solution launches napari-cellcanvas.",
description="A solution that launches napari-cellcanvas with optional config fetching.",
solution_creators=["Kyle Harrington"],
tags=["napari", "cellcanvas", "plugin", "visualization"],
license="MIT",
Expand All @@ -57,19 +99,55 @@ def run():
"name": "copick_config_path",
"type": "string",
"default": "/Users/kharrington/Data/copick/cellcanvas_server/local_sshOverlay_localStatic.json",
"description": "Path to the Copick configuration file."
"description": "Path to the Copick configuration file.",
"required": True
},
{
"name": "hostname",
"type": "string",
"default": "localhost",
"description": "Hostname for the server."
"description": "Hostname for the server.",
"required": True
},
{
"name": "port",
"type": "integer",
"default": 8080,
"description": "Port number for the server."
"description": "Port number for the server.",
"required": True
},
{
"name": "fetch_config",
"type": "boolean",
"default": False,
"description": "Whether to fetch the config from the server.",
"required": False
},
{
"name": "overlay_remote",
"type": "boolean",
"default": False,
"description": "Set to true if the overlay path should be remote (SSH).",
"required": False
},
{
"name": "static_remote",
"type": "boolean",
"default": False,
"description": "Set to true if the static path should be remote (SSH).",
"required": False
},
{
"name": "overlay_path",
"type": "string",
"description": "The local path for the overlay root if not remote.",
"required": False
},
{
"name": "static_path",
"type": "string",
"description": "The local path for the static root if not remote.",
"required": False
}
],
run=run,
Expand Down
34 changes: 30 additions & 4 deletions solutions/cellcanvas/napari-cellcanvas/solution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,43 @@ args:
- default: /Users/kharrington/Data/copick/cellcanvas_server/local_sshOverlay_localStatic.json
description: Path to the Copick configuration file.
name: copick_config_path
required: true
type: string
- default: localhost
description: Hostname for the server.
name: hostname
required: true
type: string
- default: 8080
description: Port number for the server.
name: port
required: true
type: integer
changelog: Remove defaults
description: A solution launches napari-cellcanvas.
- default: false
description: Whether to fetch the config from the server.
name: fetch_config
required: false
type: boolean
- default: false
description: Set to true if the overlay path should be remote (SSH).
name: overlay_remote
required: false
type: boolean
- default: false
description: Set to true if the static path should be remote (SSH).
name: static_remote
required: false
type: boolean
- description: The local path for the overlay root if not remote.
name: overlay_path
required: false
type: string
- description: The local path for the static root if not remote.
name: static_path
required: false
type: string
changelog: Update to implement fetch_config functionality
description: A solution that launches napari-cellcanvas with optional config fetching.
group: cellcanvas
license: MIT
name: napari-cellcanvas
Expand All @@ -24,6 +50,6 @@ tags:
- cellcanvas
- plugin
- visualization
timestamp: '2024-08-11T10:14:00.420411'
timestamp: '2024-08-13T11:22:16.420429'
title: napari-CellCanvas
version: 0.0.4
version: 0.0.5

0 comments on commit a77d368

Please sign in to comment.