{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Fundamentals of ImageJ\n", "This tutorial presents the basic concepts and usage of the ImageJ API." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## The ImageJ gateway" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The first step when working with ImageJ is to get or create an *ImageJ gateway*. This gateway provides access to ImageJ operations and data structures." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Added new repo: scijava.public\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "", "version_major": 2, "version_minor": 0 }, "method": "display_data" }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "20f5c43c-eed4-40c5-865f-9c8445d473fc", "version_major": 2, "version_minor": 0 }, "method": "display_data" }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [ "ImageJ v2.0.0-rc-71 is ready to go." ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "// Behind a firewall? Configure your proxy settings here.\n", "//System.setProperty(\"http.proxyHost\",\"myproxy.domain\")\n", "//System.setProperty(\"http.proxyPort\",\"8080\")\n", "//System.setProperty(\"https.proxyHost\",\"myproxy.domain\")\n", "//System.setProperty(\"https.proxyPort\",\"8080\")\n", "\n", "// Load the ImageJ library from the remote Maven repository.\n", "%classpath config resolver scijava.public https://maven.scijava.org/content/groups/public\n", "%classpath add mvn net.imagej imagej 2.0.0-rc-71\n", "\n", "// OR: Load ImageJ with Fiji plugins from the remote Maven repository.\n", "//%classpath config resolver scijava.public https://maven.scijava.org/content/groups/public\n", "//%classpath add mvn sc.fiji fiji 2.0.0-pre-10\n", "\n", "// OR: Load ImageJ with Fiji plugins from a local Fiji installation.\n", "//%classpath add jar '/Applications/Fiji.app/jars/*'\n", "//%classpath add jar '/Applications/Fiji.app/jars/bio-formats/*'\n", "//%classpath add jar '/Applications/Fiji.app/plugins/*'\n", "\n", "// Create an ImageJ gateway.\n", "ij = new net.imagej.ImageJ()\n", "\"ImageJ v${ij.getVersion()} is ready to go.\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Services" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "ImageJ's functionality is divided into *services*. Each service provides some API methods for performing related tasks.\n", "\n", "The gateway provides easy access to this slew of services. Here are some example service calls:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "There are 1562 plugins available.\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "[WARNING] Ignoring negative sigma value.\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "There are 413 menu items total.\n" ] }, { "data": { "text/plain": [ "null" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "// The plugin service manages the available plugins (see \"Plugins\" below).\n", "pluginCount = ij.plugin().getIndex().size()\n", "println(\"There are \" + pluginCount + \" plugins available.\")\n", "\n", "// The log service is used for logging messages.\n", "ij.log().warn(\"Ignoring negative sigma value.\")\n", "\n", "// The status service is used to report the current status of operations.\n", "// Within a notebook like this, the call does not do anything visible.\n", "ij.status().showStatus(\"Processing data file 34 of 97...\")\n", "\n", "// The menu service organizes a menu hierarchy for modules (see \"Modules\" below).\n", "menuItemCount = ij.menu().getMenu().size()\n", "println(\"There are \" + menuItemCount + \" menu items total.\")\n", "\n", "// The platform service handles platform-specific functionality.\n", "// E.g., it can open a URL in the default web browser for your system:\n", "// ij.platform().open(new URL(\"https://imagej.net/\"))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Comparison with ImageJ 1.x\n", "
