Discover millions of audiobooks, ebooks, and so much more with a free trial

From $11.99/month after trial. Cancel anytime.

Image Processing with ImageJ - Second Edition: Extract and analyze data from complex images with ImageJ, the world's leading image processing tool
Image Processing with ImageJ - Second Edition: Extract and analyze data from complex images with ImageJ, the world's leading image processing tool
Image Processing with ImageJ - Second Edition: Extract and analyze data from complex images with ImageJ, the world's leading image processing tool
Ebook468 pages3 hours

Image Processing with ImageJ - Second Edition: Extract and analyze data from complex images with ImageJ, the world's leading image processing tool

Rating: 5 out of 5 stars

5/5

()

Read preview

About this ebook

The book has been created for engineers, scientists, and developers eager to tackle image processing with one of the leading tools available. No prior knowledge of ImageJ is needed. Familiarity with Java programming will be required for readers to code their own routines using ImageJ.
LanguageEnglish
Release dateNov 30, 2015
ISBN9781785881589
Image Processing with ImageJ - Second Edition: Extract and analyze data from complex images with ImageJ, the world's leading image processing tool
Author

Jurjen Broeke

Jurjen Broeke has a PhD in neuroscience from Vrije Universiteit (VU) Amsterdam and uses live-cell imaging techniques to study the fundamental processes of neuronal function. As a neuroscientist, he studies the processes involved in neural communication. Besides acquiring images, Jurjen also develops software to analyze dynamics in ImageJ, MATLAB, and R. When not enjoying the outdoors and taking pictures, he develops technical hardware and software solutions in the Department of Functional Genomics at VU.

Related to Image Processing with ImageJ - Second Edition

Related ebooks

Programming For You

View More

Reviews for Image Processing with ImageJ - Second Edition

Rating: 5 out of 5 stars
5/5

1 rating0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    Image Processing with ImageJ - Second Edition - Jurjen Broeke

    (missing alt)

    Table of Contents

    Image Processing with ImageJ Second Edition

    Credits

    About the Authors

    About the Reviewer

    www.PacktPub.com

    Support files, eBooks, discount offers, and more

    Why subscribe?

    Free access for Packt account holders

    Preface

    What this book covers

    What you need for this book

    Who this book is for

    Conventions

    Reader feedback

    Customer support

    Downloading the example code

    Errata

    Piracy

    Questions

    1. Getting Started with ImageJ

    ImageJ distributions

    The uses of ImageJ

    The current state of ImageJ

    ImageJ2

    SciFIO and OME-XML

    Bio-formats

    Integrated environment for acquisition and processing

    Obtaining and installing ImageJ

    Installation of ImageJ

    Installing on Windows

    Installing on Mac OS X

    Installing on Linux

    The ImageJ folder structure

    Plugins folder

    Macros folder

    Configuring a fresh ImageJ installation

    Summary

    2. Basic Image Processing with ImageJ

    Images in ImageJ

    Image types

    Grayscale images

    Color images

    Stacks and hyperstacks

    Color images and multichannel stacks

    Z-stack images and volumes

    Time series

    Multidimensional images

    Extracting image and pixel information

    Loading and saving images

    Loading images and sequences

    Saving images

    Image calibration

    Viewing images in ImageJ

    Viewing multichannel images

    Viewing time series

    Summary

    3. Advanced Image Processing with ImageJ

    Correcting images

    Technical background

    Correcting Shot noise

    Correcting dark noise

    Uneven illumination – background subtraction

    Image normalization

    Bleach correction

    Stack processing

    Processing Z-stacks

    Stack projections

    Maximum projection

    Volume viewing and rendering

    Processing time series

    Normalizing time series data

    Summary

    4. Image Segmentation and Feature Extraction with ImageJ

    Image segmentation

    Image thresholding

    Thresholding grayscale images

    Thresholding color images

    Morphological processing

    Morphological operators

    Erode and dilate

    Skeletonize and watershed

    Image filtering

    Filtering in the frequency domain

    Image filtering in the spatial domain

    Feature extraction

    Edge detection

    Summary

    5. Basic Measurements with ImageJ

    Selections and regions in ImageJ

    Area selections

    Line selections

    Point selections

    Basic measurements

    Area selections and measurements

    Oval selections

    Polygon selections

    Line selections and measurements

    Kymographs

    Line profiles

    Colocalization

    Semiquantitative colocalization

    Particle analysis

    Preprocessing and preparations

    Summary

    6. Developing Macros in ImageJ

    Recording macros

    Recording a macro for conversion

    Modifying macros

    User input in macros

    Opening a specific file

    Saving an image to a folder

    Adding choices

    Performing input checking

    Showing progress in macros

    Processing the time series

    Running macros in batch process mode

    Installing macros

    Summary

    7. Explanation of ImageJ Constructs

    Frameworks for macros and plugins

    Macros and scripting languages

    BeanShell scripting

    ImageJ main class

    Functions to process images

    Functions for selections

    Saving and running your scripts

    Plugins for ImageJ

    ImageJ main class

    WindowManager

    ImagePlus

    ImageProcessor

    RoiManager

    The Roi class

    The Application Programming Interface

    Setting up NetBeans IDE

    Gathering all components

    Setting up a project

    Building ImageJ

    Creating a plugin

    Creating documentation

    ImageJ Javadoc

    Plugin Javadoc

    Developing plugins using Maven

    Construction of the POM

    Creating a Maven plugin project

    Creating an ImageJ2 plugin

    Pros and cons of using an IDE

    Summary

    8. Anatomy of ImageJ Plugins

    The basic anatomy of a plugin

    Legacy plugins

    The PlugIn type

    The PlugInFilter type

    The PlugInFrame type

    Implementing a legacy plugin

    Combining macros and legacy plugins

    SciJava plugins

    The @Plugin annotation

    Services

    Commands

    Running and debugging plugins

    Compiling plugins

    Compiling SciJava plugins

    Debugging plugins

    Examples of available plugins

    Example plugins available in ImageJ and Fiji

    MultipleKymograph

    ColorTransformer2

    MtrackJ

    Coloc2

    Goutte_pendante

    Summary

    9. Creating ImageJ Plugins for Analysis

    Plugin background and goal

    Basic project setup

    Creating a basic PlugInFilter

    Testing our current implementation

    Implementing the setup method

    The return type and autocomplete

    Javadoc for methods

    Finishing the setup method

    Implementing the run method

    Detecting an object

    Refining the detection

    Detecting multiple objects

    Implementing the measurements

    Adding user interaction and preferences

    Settings and options dialog

    Adding external libraries

    Adding the dependency for Apache POI

    Creating an Excel file

    Sharing your plugin

    Creating a site

    Uploading your plugin

    Summary

    10. Where to Go from Here?

    Basic development

    Additional tools

    Project management and feedback

    Other resources

    Summary

    Index

    Image Processing with ImageJ Second Edition


    Image Processing with ImageJ Second Edition

    Copyright © 2015 Packt Publishing

    All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

    Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

    Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

    First published: September 2013

    Second edition: November 2015

    Production reference: 1241115

    Published by Packt Publishing Ltd.

    Livery Place

    35 Livery Street

    Birmingham B3 2PB, UK.

    ISBN 978-1-78588-983-7

    www.packtpub.com

    Credits

    Authors

    Jurjen Broeke

    José María Mateos Pérez

    Javier Pascau

    Reviewer

    Jan Eglinger

    Commissioning Editor

    Neil Alexander

    Acquisition Editor

    Manish Nainani

    Content Development Editor

    Sumeet Sawant

    Technical Editor

    Parag Topre

    Copy Editor

    Karuna Narayanan

    Project Coordinator

    Shweta H Birwatkar

    Proofreader

    Safis Editing

    Indexer

    Monica Ajmera Mehta

    Graphics

    Disha Haria

    Production Coordinator

    Conidon Miranda

    Cover Work

    Conidon Miranda

    About the Authors

    Jurjen Broeke has a PhD in neuroscience from Vrije Universiteit (VU) Amsterdam and uses live-cell imaging techniques to study the fundamental processes of neuronal function. As a neuroscientist, he studies the processes involved in neural communication. Besides acquiring images, Jurjen also develops software to analyze dynamics in ImageJ, MATLAB, and R. When not enjoying the outdoors and taking pictures, he develops technical hardware and software solutions in the Department of Functional Genomics at VU.

    José María Mateos Pérez is a Spanish postdoctoral fellow at the Montreal Neurological Institute (http://www.mcgill.ca/neuro/), where his main research lines deal with neurodevelopment and machine learning applied to clinical prediction. He has also been an experienced ImageJ user and has developed several macros and plugins. One of them, jClustering, has been published in PLOS ONE, a peer-reviewed journal. When he has enough time to procrastinate, he also likes to develop data analysis tools in Python and R.

    Javier Pascau received his PhD from Polytechnic University in Madrid in 2006 and is currently a visiting professor at Carlos III University, Madrid. He has been a part of Biomedical Imaging and Instrumentation Group, a research laboratory with a multidisciplinary team of engineers, physicists, biologists, and physicians located both in the university as well as Hospital General Universitario Gregorio Marañón (biig.uc3m.es). Javier's research and teaching cover areas such as medical image processing, analysis, quantification, and multimodal registration, both in preclinical and clinical environments. He has been involved in the development of small animal PET and CT devices. In the last few years, Javier has led several projects on intraoperative radiation therapy and image-guided surgery. He has authored more than 40 papers published in peer-reviewed journals over the last 15 years.

    I want to thank all my colleagues at the university and the hospital, since my knowledge on image processing is the result of multiple interactions in this multidisciplinary environment.

    About the Reviewer

    Jan Eglinger works as an image processing specialist at Friedrich Miescher Institute for Biomedical Research in Basel, Switzerland. Jan received a master's degree in biotechnology from ESBS in Strasbourg, France, and a PhD in cell biology from MPI-CBG in Dresden, Germany. He has been contributing to Fiji and ImageJ development since 2010.

    www.PacktPub.com

    Support files, eBooks, discount offers, and more

    For support files and downloads related to your book, please visit www.PacktPub.com.

    Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at for more details.

    At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.

    Support files, eBooks, discount offers, and more

    https://www2.packtpub.com/books/subscription/packtlib

    Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.

    Why subscribe?

    Fully searchable across every book published by Packt

    Copy and paste, print, and bookmark content

    On demand and accessible via a web browser

    Free access for Packt account holders

    If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access.

    Preface

    Advances in image processing are vital for the science and technology communities. However, as images become larger and more complex, even more advanced processing techniques are required. Automation becomes necessary too so that you can perform simple tasks easily and focus on more sophisticated issues. ImageJ is here to help—as one of the key powerful tools in the development of image processing, it lets you extract even more useful data from your images.

    What this book covers

    Chapter 1, Getting Started with ImageJ, takes a look at the origin and use of ImageJ and discusses how to download and install it on different platforms. We will also take a look at the basic folder structure of ImageJ installation and configure it to be used.

    Chapter 2, Basic Image Processing with ImageJ, discusses the different image types that are supported by ImageJ. You will also learn how to load images from a disk or URL. We will take a look at the anatomy of an image window in ImageJ and the information that can be viewed. It will also deal with image scaling, calibration, lookup tables, adjusting image size, and adjusting channels.

    Chapter 3, Advanced Image Processing with ImageJ, investigates the processing of different types of images. We will take a look at different sources of noise that can corrupt images and degrade their quality. You will also learn how to apply different corrections to images to fix these problems.

    Chapter 4, Image Segmentation and Feature Extraction with ImageJ, looks at the ways to separate an image into a foreground and background. We will consider different methods to set the threshold in grayscale and color images.

    Chapter 5, Basic Measurements with ImageJ, considers some methods to measure the parameters within images and time series. We will apply some of the techniques discussed in previous chapters to extract data from our images. You will also learn how to visualize dynamic data in a single image (kymographs).

    Chapter 6, Developing Macros in ImageJ, discusses how to create a macro using a recorder to discover the commands and functions that we can apply. Next, we will take a look at processing a folder full of images and saving the resulting images to the hard disk. Finally, we will look at the Batch Process mode, which allows ImageJ to process a folder in a similar way.

    Chapter 7, Explanation of ImageJ Constructs, looks at the framework of macros and plugins that are available in ImageJ. We will discuss some of the constructs that the ImageJ API exposes for use in scripting and plugins. Finally, we will describe how to set up an IDE to develop ImageJ and plugins using it as a standalone or Maven-based project.

    Chapter 8, Anatomy of ImageJ Plugins, takes a look at the anatomy of plugins for ImageJ1.x and ImageJ2. We will also take a look at some of the specific constructs that are used in plugins for both frameworks. This chapter examines how to compile, run, and debug plugins using the IDE or tools provided by ImageJ.

    Chapter 9, Creating ImageJ Plugins for Analysis, develops a plugin from scratch using the Maven system and NetBeans IDE. We will discuss how to add a basic user interface to our plugin, allowing the user to change some of the parameters that influence the way the plugin functions. We will also add an external library to provide additional functionality that was not present in ImageJ.

    Chapter 10, Where to Go from Here, sums up the topics that are discussed in previous chapters and provides further resources that are available for you to continue developing your own plugins. The chapter also looks at some of the more advanced techniques that are available for developers.

    What you need for this book

    You'll need the following software for the book:

    ImageJ 1.4x or Fiji

    NetBeans 8.0.2+

    Who this book is for

    This book is created for engineers, scientists, and developers eager to tackle image processing with one of the leading tools in the field for image processing and analysis. No prior knowledge of ImageJ is needed. Familiarity with Java programming will be needed for readers to code their own routines using ImageJ.

    Conventions

    In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

    Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: The two most important folders are the macros and plugins folders.

    A block of code is set as follows:

    varmyTools = newMenu(My awesome tools,

    newArray(Macro_1, Macro_2, -, Macro_3));

     

    macroMy awesome tools - C037T0b11MT7b09aTcb09t {

      cmd = getArgument();

      if(cmd== Macro_1)

      runMacro(/PATH/TO/Macro_1_tool);

      else if(cmd == Macro_2)

      runMacro(/PATH/TO/some_other_tool);

    }

    New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: We can now perform the particle analysis by selecting Analyze | Analyze Particles… from the menu.

    Note

    Warnings or important notes appear in a box like this.

    Tip

    Tips and tricks appear like this.

    Reader feedback

    Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

    To send us general feedback, simply send an e-mail to <[email protected]>, and mention the book title via the subject of your message.

    If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

    Customer support

    Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

    Downloading the example code

    You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

    Errata

    Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

    Piracy

    Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

    Please contact us at <[email protected]> with a link to the suspected pirated material.

    We appreciate your help in protecting our authors, and our ability to bring you valuable content.

    Questions

    You can contact us at <[email protected]> if you are having a problem with any aspect of the book, and we will do our best to address it.

    Chapter 1. Getting Started with ImageJ

    Welcome to the second edition of Image Processing with ImageJ. ImageJ is a versatile and open source software package designed for scientific image processing and analysis. It is written in the Java programming language, allowing for a uniform cross-platform experience. It is based on the NIH Image software package on the Macintosh platform, developed in 1987 by Wayne Rasband. Rasband, who is still an active contributor of ImageJ, published the first ImageJ distribution in 1997. It was developed as a project to provide a solution to a problem. In 2012, ImageJ celebrated its twenty-fifth birthday with a publication in the journal Nature Methods.

    ImageJ distributions

    Currently, there are different distributions that are based on or are extensions of the original ImageJ. The basic ImageJ package is available on the ImageJ website at the National Institute of Health (http://imagej.nih.gov/ij/download.html). The current version of the package is version 1.50b, and the website is updated monthly. This is the core distribution of ImageJ, which contains the main interface and all the basic tools to load, view, process, and export images and data. Other distributions contain this core package and most of its features, but you need to add additional features and plugins to create an optimized interface for specific fields. Some of these other distributions are still easily recognizable as ImageJ, while others offer a completely different interface.

    For different scientific fields, different distributions were developed based on the core of ImageJ. One of the major distributions for the life sciences is called Fiji (Fiji Is Just ImageJ), which can be found on the Fiji website (http://fiji.sc/Fiji). The basis of Fiji is ImageJ, but it comes with a large complement of preinstalled features (macros and plugins) that are commonly used for image processing in the life sciences. It is focused on fluorescence microscopy, with built-in tools for segmentation, visualization, and co-localization. It also contains plugins for image registration, particle tracking, and super-resolution processing and reconstruction. It also has an extensive library of image formats that can be opened. This library includes proprietary image formats from all the major acquisition software packages via the Bio-Formats plugin, as described in the upcoming section. The advantages of this distribution are the large number of supplied plugins that come with it as well as a very user-friendly script editor. It also has an extensive update mechanism for both ImageJ as well as some plugins.

    For the field of astronomy, a different distribution of ImageJ was developed, named AstroImageJ (http://www.astro.louisville.edu/software/astroimagej/). This distribution takes the core implementation of ImageJ and supplements it with specific plugins and macros developed for analysis in the field of astronomy. It is not directly compatible with ImageJ. The core of ImageJ was slightly modified for this distribution.

    An example of a distribution derived from ImageJ but with a different user interface is Icy (http://icy.bioimageanalysis.org/). The Icy distribution has integrated ImageJ, and many plugins are compatible. However, not every plugin developed for ImageJ will work within Icy and vice versa. In the Icy distribution, there is a strong emphasis on cellular and spot detection and tracking. There is also a strong emphasis on plugin development. Plugins that are developed for the Icy platform will have documentation and automated updating implemented by design. There are also possibilities for users to directly provide feedback to the developers from within the interface, which is a feature not present within other distributions based on ImageJ. A disadvantage may be that it requires several external libraries to be installed, most importantly VTK, which can cause issues on Linux systems.

    Another distribution that uses ImageJ not only for the processing of data but also aids in the acquisition of data is called μManager, which can be found at https://www.micro-manager.org/. It is loaded from within ImageJ as a plugin, but provides a unique interface geared towards image acquisition and hardware control. Camera and microscope drivers allow the control of supported hardware used in image acquisition, which can then be fed directly to ImageJ for processing and analysis. An example of the use of μManager is in the Open SPIM project, where it is used to control a DIY light sheet microscope, acquire images, and process them.

    The uses of ImageJ

    ImageJ is a great tool to process images and perform analysis. It is used in many scientific peer-reviewed publications, with over 1000 articles in diverse fields such as life sciences, astronomy, and physics. In life sciences, it is used to quantify medical images to aid in the detection of pathological markers. It is also used to process and quantify data from single-cell or single-molecule experiments using super-resolution

    Enjoying the preview?
    Page 1 of 1