{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11) \n",
      "[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)]\n"
     ]
    }
   ],
   "source": [
    "import sys\n",
    "print(sys.version)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# @ImageJ ij\n",
    "\n",
    "# Ops tutorial\n",
    "\n",
    "# create a new blank image\n",
    "from jarray import array\n",
    "dims = array([150, 100], 'l')\n",
    "blank = ij.op().create().img(dims)\n",
    "\n",
    "# fill in the image with a sinusoid using a formula\n",
    "formula = \"10 * (Math.cos(0.3*p[0]) + Math.sin(0.3*p[1]))\"\n",
    "sinusoid = ij.op().image().equation(blank, formula)\n",
    "\n",
    "# add a constant value to an image\n",
    "ij.op().math().add(sinusoid, 13.0)\n",
    "\n",
    "# generate a gradient image using a formula\n",
    "gradient = ij.op().image().equation(ij.op().create().img(dims), \"p[0]+p[1]\")\n",
    "\n",
    "# add the two images\n",
    "composite = ij.op().create().img(dims)\n",
    "ij.op().math().add(composite, sinusoid, gradient)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Scijava - Python",
   "language": "Python",
   "name": "scijava-python"
  },
  "language_info": {
   "codemirror_mode": "Python",
   "file_extension": "[py]",
   "mimetype": "[text/python, application/python, text/x-python, application/x-python]",
   "name": "Python",
   "nbconverter_exporter": "",
   "pygments_lexer": "Python",
   "version": "2.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
