{
"cells": [
{
"cell_type": "markdown",
"id": "88d5f7fd-e30e-474e-ab44-01dbed16fd70",
"metadata": {
"tags": []
},
"source": [
"# Compatibility with cupy"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "8b74ef1e-4753-449a-9e10-7cb3d25c2b7d",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import cupy\n",
"import numpy as np\n",
"import stackview"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "0eba88e8-c6da-4b36-a8be-4095652c9e53",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"image = np.random.random((100,100))"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "74ae019e-78df-4958-8396-22d20ca6e059",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"cp_image = cupy.asarray(image)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "ffe39017-c92f-4742-991d-b479cb7354e6",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"\n",
"\n",
" \n",
" | \n",
"\n",
"\n",
"\n",
"| shape | (100, 100) | \n",
"| dtype | float64 | \n",
"| size | 78.1 kB | \n",
"| min | 4.539151408700093e-05 | | max | 0.9998906451062283 | \n",
" \n",
" \n",
" | \n",
"
\n",
"
"
],
"text/plain": [
"StackViewNDArray([[0.33142506, 0.38009008, 0.00561783, ..., 0.596106 ,\n",
" 0.35582806, 0.96856339],\n",
" [0.38169553, 0.08307175, 0.95798897, ..., 0.35096608,\n",
" 0.5319687 , 0.38921576],\n",
" [0.28974828, 0.13063153, 0.2736478 , ..., 0.86333586,\n",
" 0.28118745, 0.47395152],\n",
" ...,\n",
" [0.07649461, 0.97180434, 0.94019598, ..., 0.35760347,\n",
" 0.18371902, 0.87372892],\n",
" [0.83759999, 0.46255862, 0.87663882, ..., 0.01243606,\n",
" 0.26633734, 0.33060908],\n",
" [0.21340784, 0.49404083, 0.31937353, ..., 0.95628988,\n",
" 0.60082549, 0.0117501 ]])"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"stackview.insight(cp_image)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ef68d563-3c4c-4201-a27b-b96674e970b5",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.17"
}
},
"nbformat": 4,
"nbformat_minor": 5
}