-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add n5_download_demo.ipynb similar to ImageJ download using tensorstore
- Loading branch information
Showing
2 changed files
with
103 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"source": [ | ||
"# reading an exported VCell dataset from a server-side N5 store\n", | ||
"1. set up tensorstore to point to remote dataset\n", | ||
"2. retrieve data as a datastore object which lazily loads data upon request." | ||
], | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"id": "29a6cffd5df3cb63" | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"source": "import tensorstore as ts", | ||
"metadata": { | ||
"collapsed": false, | ||
"ExecuteTime": { | ||
"end_time": "2025-01-24T00:55:40.251947Z", | ||
"start_time": "2025-01-24T00:55:39.504432Z" | ||
} | ||
}, | ||
"id": "c94978b833082ef7", | ||
"outputs": [], | ||
"execution_count": 1 | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"source": "### this configuration can be simplified by wrapping in pyvcell library", | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"id": "4b69965b59dd9af5" | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"source": [ | ||
"# Define the URL and dataset name\n", | ||
"url = \"https://vcell.cam.uchc.edu/n5Data/ACowan/11a0e2db531a208.n5\"\n", | ||
"dataset_name = \"5580791597\"\n", | ||
"\n", | ||
"# Open the N5 dataset\n", | ||
"spec = {\n", | ||
" \"driver\": \"n5\",\n", | ||
" \"kvstore\": {\n", | ||
" \"driver\": \"http\",\n", | ||
" \"base_url\": url\n", | ||
" },\n", | ||
" \"path\": dataset_name\n", | ||
"}\n", | ||
"\n", | ||
"# Read the specified dataset\n", | ||
"dataset = ts.open(spec).result()\n", | ||
"data = dataset.read().result()\n", | ||
"\n", | ||
"# Print the shape of the data\n", | ||
"print(\"Data shape:\", data.shape)\n" | ||
], | ||
"metadata": { | ||
"collapsed": false, | ||
"ExecuteTime": { | ||
"end_time": "2025-01-24T00:56:05.521770Z", | ||
"start_time": "2025-01-24T00:55:49.489764Z" | ||
} | ||
}, | ||
"id": "e88a4bb558aba920", | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Data shape: (51, 51, 2, 51, 103)\n" | ||
] | ||
} | ||
], | ||
"execution_count": 2 | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 2 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython2", | ||
"version": "2.7.6" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters