{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Cloud and mesh visualization\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import numpy as np\nfrom itom import dataObject\nfrom itom import plot\nfrom itom import polygonMesh\n\ntry:\n from itom import pointCloud\nexcept Exception as ex:\n ui.msgInformation(\n \"PointCloud missing\",\n \"your itom version is compiled without support of pointClouds\",\n )\n raise ex" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Create a ``dataObject`` with X, Y and Z values of a topography\nas well as a 2.5D topography in terms of a ``dataObject``.\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "[X, Y] = np.meshgrid(np.arange(0, 100, 0.25), np.arange(0, 100, 0.25))\nzValues = np.sin(X * 2) + np.cos(Y * 0.5)\n# further intensity\nintensity = np.random.rand(*X.shape)\n# further color information\ncolorValues = dataObject.randN([X.shape[0], X.shape[1]], \"rgba32\")\ntopography = dataObject(zValues).astype(\"float32\")\ntopography.axisScales = (0.1, 0.1)\ntopography[0, 0] = float(\"nan\")\n\nmesh_quads = polygonMesh.fromTopography(topography)\nmesh_triangles = polygonMesh.fromTopography(topography, triangulationType=1)\n\n[i, h] = plot(mesh_quads, \"vtk3dvisualizer\")\nh.call(\"addMesh\", mesh_triangles, \"mesh_triangles\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n\n" ] } ], "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", "version": "3.8.10" } }, "nbformat": 4, "nbformat_minor": 0 }