{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# DummyGrabber\n\nThis demo shows with the example of the ``DummyGrabber``\nhow grabber and cameras are used in ``itom``.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from itom import dataIO\nfrom itom import dataObject\nfrom itom import plot\nfrom itom import liveImage" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Start camera (e.g.: ``DummyGrabber``)\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "camera = dataIO(\"DummyGrabber\") # noise camera\ncameraGaussian = dataIO(\"DummyGrabber\", imageType=\"gaussianSpot\") # moving Gaussian spot \ncameraGaussianArray = dataIO(\"DummyGrabber\", imageType=\"gaussianSpotArray\") # moving 4 Gaussian spots" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Set region of interest (ROI).\nx: [100,499] -> width: 400 (borders are included!)\ny: [40, 349] -> height: 310\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "camera.setParam(\"roi\", [100, 40, 400, 300])\n# or:\n# camera.setParam(\"roi[0]\", 100)\n# camera.setParam(\"roi[2]\", 400) #...\n\nprint(\"width:\", camera.getParam(\"sizex\"))\nprint(\"height:\", camera.getParam(\"sizey\"))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Set bits per pixel (bpp). \n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "camera.setParam(\"bpp\", 8)\n\n# print available parameters of that device\nprint(\"DummyGrabber has the following parameters:\")\nprint(camera.getParamList())\n\n# print detailed information about parameters:\nprint(camera.getParamListInfo())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Read parameters from device.\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "sizex = camera.getParam(\"sizex\")\nsizey = camera.getParam(\"sizey\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Start camera.\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "camera.startDevice()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Acquire single image.\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "camera.acquire()\n\n# Create empty dataObject for getting the image\ndata = dataObject()\n\n# get a reference to the acquired image\n# the reference is then available by the recently created dataObject\ncamera.getVal(data)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
The method **getVal** returns only a shallow copy of the plugin internal memory.\n Therefore, the content of data will change when the next image is acquired.\n In order to create a deep copy of data, type:\n\n```python\ncamera.copyVal(data)