{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import sys\n", "from pathlib import Path\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "import laspy\n", "\n", "triskele_path = Path('../triskele/python/')\n", "sys.path.append(str(triskele_path.resolve()))\n", "import triskele\n", "\n", "figsize = (16, 3)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Read and Write" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "R = np.random.random((1000,4000))\n", "\n", "plt.figure(figsize=figsize)\n", "plt.imshow(R)\n", "plt.colorbar()\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "R.dtype" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## F64 " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "triskele.write('../Res/rw_test.tiff', R)\n", "R2 = triskele.read('../Res/rw_test.tiff')\n", "R2.dtype" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plt.figure(figsize=figsize)\n", "plt.imshow(R2)\n", "plt.colorbar()\n", "plt.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## F32" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plt.figure(figsize=figsize)\n", "plt.imshow(R.astype(np.float32))\n", "plt.colorbar()\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "triskele.write('../Res/rw_test.tiff', R.astype(np.float32))\n", "R2 = triskele.read('../Res/rw_test.tiff')\n", "R2.dtype" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plt.figure(figsize=figsize)\n", "plt.imshow(R2)\n", "plt.colorbar()\n", "plt.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Int32" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "R = np.random.random_integers(0, 10000, (1000,4000)).astype(np.int32)\n", "\n", "plt.figure(figsize=figsize)\n", "plt.imshow(R)\n", "plt.colorbar()\n", "plt.show()\n", "\n", "R.dtype" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "triskele.write('../Res/rw_test.tiff', R)\n", "R2 = triskele.read('../Res/rw_test.tiff')\n", "R2.dtype" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plt.figure(figsize=figsize)\n", "plt.imshow(R2)\n", "plt.colorbar()\n", "plt.show()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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" } }, "nbformat": 4, "nbformat_minor": 2 }