|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "source": [ |
| 6 | + "# reading an exported VCell dataset from a server-side N5 store\n", |
| 7 | + "1. set up tensorstore to point to remote dataset\n", |
| 8 | + "2. retrieve data as a datastore object which lazily loads data upon request." |
| 9 | + ], |
| 10 | + "metadata": { |
| 11 | + "collapsed": false |
| 12 | + }, |
| 13 | + "id": "29a6cffd5df3cb63" |
| 14 | + }, |
| 15 | + { |
| 16 | + "cell_type": "code", |
| 17 | + "source": "import tensorstore as ts", |
| 18 | + "metadata": { |
| 19 | + "collapsed": false, |
| 20 | + "ExecuteTime": { |
| 21 | + "end_time": "2025-01-24T00:55:40.251947Z", |
| 22 | + "start_time": "2025-01-24T00:55:39.504432Z" |
| 23 | + } |
| 24 | + }, |
| 25 | + "id": "c94978b833082ef7", |
| 26 | + "outputs": [], |
| 27 | + "execution_count": 1 |
| 28 | + }, |
| 29 | + { |
| 30 | + "cell_type": "markdown", |
| 31 | + "source": "### this configuration can be simplified by wrapping in pyvcell library", |
| 32 | + "metadata": { |
| 33 | + "collapsed": false |
| 34 | + }, |
| 35 | + "id": "4b69965b59dd9af5" |
| 36 | + }, |
| 37 | + { |
| 38 | + "cell_type": "code", |
| 39 | + "source": [ |
| 40 | + "# Define the URL and dataset name\n", |
| 41 | + "url = \"https://vcell.cam.uchc.edu/n5Data/ACowan/11a0e2db531a208.n5\"\n", |
| 42 | + "dataset_name = \"5580791597\"\n", |
| 43 | + "\n", |
| 44 | + "# Open the N5 dataset\n", |
| 45 | + "spec = {\n", |
| 46 | + " \"driver\": \"n5\",\n", |
| 47 | + " \"kvstore\": {\n", |
| 48 | + " \"driver\": \"http\",\n", |
| 49 | + " \"base_url\": url\n", |
| 50 | + " },\n", |
| 51 | + " \"path\": dataset_name\n", |
| 52 | + "}\n", |
| 53 | + "\n", |
| 54 | + "# Read the specified dataset\n", |
| 55 | + "dataset = ts.open(spec).result()\n", |
| 56 | + "data = dataset.read().result()\n", |
| 57 | + "\n", |
| 58 | + "# Print the shape of the data\n", |
| 59 | + "print(\"Data shape:\", data.shape)\n" |
| 60 | + ], |
| 61 | + "metadata": { |
| 62 | + "collapsed": false, |
| 63 | + "ExecuteTime": { |
| 64 | + "end_time": "2025-01-24T00:56:05.521770Z", |
| 65 | + "start_time": "2025-01-24T00:55:49.489764Z" |
| 66 | + } |
| 67 | + }, |
| 68 | + "id": "e88a4bb558aba920", |
| 69 | + "outputs": [ |
| 70 | + { |
| 71 | + "name": "stdout", |
| 72 | + "output_type": "stream", |
| 73 | + "text": [ |
| 74 | + "Data shape: (51, 51, 2, 51, 103)\n" |
| 75 | + ] |
| 76 | + } |
| 77 | + ], |
| 78 | + "execution_count": 2 |
| 79 | + } |
| 80 | + ], |
| 81 | + "metadata": { |
| 82 | + "kernelspec": { |
| 83 | + "display_name": "Python 3", |
| 84 | + "language": "python", |
| 85 | + "name": "python3" |
| 86 | + }, |
| 87 | + "language_info": { |
| 88 | + "codemirror_mode": { |
| 89 | + "name": "ipython", |
| 90 | + "version": 2 |
| 91 | + }, |
| 92 | + "file_extension": ".py", |
| 93 | + "mimetype": "text/x-python", |
| 94 | + "name": "python", |
| 95 | + "nbconvert_exporter": "python", |
| 96 | + "pygments_lexer": "ipython2", |
| 97 | + "version": "2.7.6" |
| 98 | + } |
| 99 | + }, |
| 100 | + "nbformat": 4, |
| 101 | + "nbformat_minor": 5 |
| 102 | +} |
0 commit comments