ImageJ EE4H, M.Sc 0407191 Computer Vision Dr. Mike Spann

Slides:



Advertisements
Similar presentations
Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
Advertisements

Digital Images in Java Java’s imaging classes. Java imaging library  Java has good support for image processing  Must master a handful of classes and.
Editing In ImageJ John H. Krantz Hanover College.
INTERFACES IN JAVA 1.Java Does not support Multiple Inheritance directly. Multiple inheritance can be achieved in java by the use of interfaces. 2.We need.
L2:CSC © Dr. Basheer M. Nasef Lecture #2 By Dr. Basheer M. Nasef.
Chapter 2: Using Objects Part 1. To learn about variables To understand the concepts of classes and objects To be able to call methods To learn about.
Chapter 3: Beginning Problem Solving Concepts for the Computer Programming Computer Programming Skills /1436 Department of Computer Science.
 2005 Pearson Education, Inc. All rights reserved Introduction.
Java Tutorial – Building GUIs Java with Added Swing Daniel Bryant
Aalborg Media Lab 21-Jun-15 Software Design Lecture 2 “ Data and Expressions”
Multimedia Data Introduction to Image Data Dr Mike Spann Electronic, Electrical and Computer Engineering.
Chapter 2 storing numbers and creating objects Pages in Horstmann.
1 Data types, operations, and expressions Overview l Format of a Java Application l Primitive Data Types l Variable Declaration l Arithmetic Operations.
Chapter 3 - Introduction to Java Applets Outline 3.1Introduction 3.2Thinking About Objects 3.4A Simple Java Applet: Drawing a String 3.5Two More Simple.
Java Review Structure of a graphics program. Computer Graphics and User Interfaces Java is Object-Oriented A program uses objects to model the solution.
Hello, world! Dissect HelloWorld.java Compile it Run it.
ImageJ Tutorial.
JOptionPane class. Dialog Boxes A dialog box is a small graphical window that displays a message to the user or requests input. A variety of dialog boxes.
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
MIT AITI 2002 Abstract Classes, Interfaces. Abstract Classes What is an abstract class? An abstract class is a class in which one or more methods is declared,
Java Programming, 3e Concepts and Techniques Chapter 3 Section 62 – Manipulating Data Using Methods – Day 1.
Software Resources Multimodal Interaction Dr. Mike Spann
C# B 1 CSC 298 Writing a C# application. C# B 2 A first C# application // Display Hello, world on the screen public class HelloWorld { public static void.
Introduction to Matlab & Data Analysis
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
C-Map Tutorial How to create and save a concept map using C-Map, export a C-Map as an image, and export a C-Map as a webpage.
OOP (Java): Simple/ OOP (Java) Objectives – –give some simple examples of Java applications and one applet 2. Simple Java Programs Semester.
Basic Java Syntax CSE301 University of Sunderland Harry R Erwin, PhD.
Basics of Java IMPORTANT: Read Chap 1-6 of How to think like a… Lecture 3.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
Netprog: Java Intro1 Crash Course in Java. Netprog: Java Intro2 Why Java? Network Programming in Java is very different than in C/C++ –much more language.
 JAVA Compilation and Interpretation  JAVA Platform Independence  Building First JAVA Program  Escapes Sequences  Display text with printf  Data.
Programming Fundamentals 2: Simple/ F II Objectives – –give some simple examples of Java applications and one applet 2. Simple Java.
Introduction to Emgu EE4H, M.Sc Computer Vision Dr. Mike Spann
1 ENGI 2420 Structured Programming (Lab Tutorial 7) Memorial University of Newfoundland.
C# C1 CSC 298 Elements of C# code (part 1). C# C2 Style for identifiers  Identifier: class, method, property (defined shortly) or variable names  class,
Variables Art &Technology, 3rd Semester Aalborg University Programming David Meredith
JAVA COURSE 1 Computer Engineering Association. Compile your first program Public class Hello{ public class Hello(){ System.out.println(“Hello”); } puclic.
Data Types – Reference Types Objective To understand what reference types are The need to study reference types To understand Java standard packages To.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 13 GUI Programming.
Starting Out with C++ Early Objects ~~ 7 th Edition by Tony Gaddis, Judy Walters, Godfrey Muganda Modified for CMPS 1044 Midwestern State University 6-1.
A Simple Java Program //This program prints Welcome to Java! public class Welcome { public static void main(String[] args) { public static void main(String[]
Chapter 2 Input, Variables and Data Types. JAVA Input JAVA input is not straightforward and is different depending on the JAVA environment that you are.
Creating visual interfaces in python
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
1 ENGI 2420 Structured Programming (Lab Tutorial 8) Memorial University of Newfoundland.
Data Types and Conversions, Input from the Keyboard CS303E: Elements of Computers and Programming.
Introducing Dreamweaver. Dreamweaver The web development application used to create web pages Part of the Adobe creative suite.
1.2 Primitive Data Types and Variables
1 ENGI 2420 Structured Programming (Lab Tutorial 7) Memorial University of Newfoundland.
Data Types – Reference Types Objective To understand what reference types are The need to study reference types To understand Java standard packages To.
A data type in a programming language is a set of data with values having predefined characteristics.data The language usually specifies:  the range.
1 1 Chapter 2 Elementary Programming. 2 2 Motivations In the preceding chapter, you learned how to create, compile, and run a Java program. Starting from.
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 3.
TOPIC 8 MORE ON WHILE LOOPS 1 Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson,
Announcements Assignment 2 Out Today Quiz today - so I need to shut up at 4:25 1.
Creating Java Applications (Software Development Life Cycle) 1. specify the problem requirements - clarify 2. analyze the problem - Input? Processes? Output.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
Object Oriented Programming Lecture 2: BallWorld.
CSE 110: Programming Language I Matin Saad Abdullah UB 1222.
CompSci From bits to bytes to ints  At some level everything is stored as either a zero or a one  A bit is a binary digit a byte is a binary.
Lecture 3: More Java Basics Michael Hsu CSULA. Recall From Lecture Two  Write a basic program in Java  The process of writing, compiling, and running.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
From bits to bytes to ints
Visual Info Processing Programming Guide (More Details)
Objectives You should be able to describe: Interactive Keyboard Input
Programs and Classes A program is made up from classes
Topics Graphical User Interfaces Using the tkinter Module
Java Basics Data Types in Java.
Names of variables, functions, classes
Presentation transcript:

ImageJ EE4H, M.Sc Computer Vision Dr. Mike Spann

Contents About ImageJ Image representation in ImageJ Displaying images in ImageJ ImageJ utility class Regions of interest Writing plug-ins

About ImageJ All of this material is taken from the ImageJ tutorial accessed from my web-site Also check out the ImageJ home page ImageJ is a free image processing system allowing easy development of Java based image processing algorithms in the form of plug-ins

About ImageJ It comes with a user-friendly GUI and can run either as an application or an applet

About ImageJ It can handle 8,16,24 and 32 bit images It can handle most standard image formats TIFF GIF JPEG BMP DICOM It can handle stacks of images Also there are plug-ins allowing it to handle movie files It can also handle regions of interest (ROI’s)

About ImageJ The key point about ImageJ is that it is simple to add your own algorithms (written as plug-ins) callable from the front-end GUI File I/O taken care of by ImageJ Pixel access easy from image handles defined within ImageJ

Image representation in ImageJ ImageJ has 5 built-in image classes 8 bit grayscale (byte) 8 bit colour (byte) 16 bit grayscale (short) RGB colour (int) 32 bit image (float) It also supports image stacks consisting of images (slices) of the same size

Image representation in ImageJ ImageJ uses 2 classes to represent and manipulate images ImagePlus An image is represented by an ImagePlus object ImageProcessor This holds the pixel data and contains methods to access the pixel data

Image representation in ImageJ Pixel access methods in ImageProcessor include Object getPixels() – returns a reference to the pixel array (need to cast to appropriate type) int getHeight() – returns height of pixel array int getWidth() – returns width of pixel array

Image representation in ImageJ A subclass of ImageProcessor is passed to the run() method of the plug-in filter (see later) ByteProcessor - 8 bit grayscale images ShortProcessor – 16 bit grayscale images ColorProcessor – RGB images FloatProcessor – 32 bit floating point images

Image representation in ImageJ Pixel representation in ImageJ uses the byte datatype for grayscale and colour images and short for 16-bit grayscale byte/short are signed data types byte ranges from –128 to 127 short ranges from –32768 to Obviously grayscale values are usually positive values

Image representation in ImageJ To cast a byte to an integer, we need to eliminate the sign bit Can cast back the other way easily enough byte[] pixels=(byte[]) ip.getPixels(); int grey=0xxff & pixels[j]; pixels[j]=(byte) grey;

Image representation in ImageJ The ColorProcessor return the pixels as int[] and the RGB values are packed into the one int variable int[] pixels=(int[]) ip.getPixels(); int red=(0xxff0000 & pixels[j]) >> 16; int green=(0xx00ff00 & pixels[j]) >> 8; int blue=(0xx0000ff & pixels[j]); 0 bit31

Image representation in ImageJ Can reconstitute an RGB array by shifting the other way : pixels[j]=((red & 0xff)<<16)+((green & 0xff)<<8)+(blue & 0xff);

Displaying images in ImageJ A class ImageWindow is used to display ImagePlus objects We don’t normally need to access methods of ImageWindow These are automatically called from ImagePlus methods show(), draw() and updateAndDraw()

ImageJ utility class ImageJ contains a class called IJ which contains a number of useful static methods Error messages static void error(String message) – displays an error message in a dialog box static boolean showMessageWithCancel(String title, String message) – allows the user to cancel the plug in or continue

ImageJ utility class Displaying text static void write(String s) - Outputs text in a window – useful for displaying textual or numerical results of algorithms Displaying text in a status bar static void showStatus(String s)

ImageJ utility class User input static double getNumber(String prompt, double default) – Allows the user to input a number in a dialog box static String getString(String prompt, String default) – Allows the user to input a string in a dialog box The GenericDialog class is a more sophisticated way of inputting more than a single number or string

Regions of interest (ROI’s) A plug in filter does not always have to work on the whole image ImageJ supports ROI’s which can are usually rectangular but can be other shapes as well. We set/get the ROI using the following method of the ImageProcessor class void setROI(int x, int y, int w int h) Rectangle getROI()

Writing plug-ins To write a plug in requires developing a class which implements either the PlugIn or PlugInFilter interfaces The second is more usual as this is used when the filter requires an input image import ij.*; import ij.plugin.filter.PlugInFilter; import ij.process; class myPlugin implements PlugInFilter

Writing plug-ins Methods setup() and run() must then be provided Method setup() sets up the plugin filter for use String arg allows input arguments to be passed to the plugin Argument imp handled automatically by ImageJ It’s the currently active image int setup(String arg, ImagePlus imp)

Writing plug-ins Method setup() returns a flag word representing the capabilities of the plug-in filter (for example the types of images it can handle). For example : static int DOES_8G static int DOES_RGB static int DOES_ALL static int NO_CHANGES (plug in doesn’t change the image data) static int ROI_REQUIRED etc

Writing plug-ins The run() method is called when the plugin is run from the ImageJ menu It contains the code to process individual pixels If no input image is required If an input image is required void run(String arg) void run(ImageProcessor ip)

Writing plug-ins Once the Java program is written and compiled, the.class file is stored in the plug-in directory which is a sub-directory of the ImageJ home directory The class name should contain an underscore symbol (eg MyAlgorithm_ ) It then appears under the plug-in sub-menu of the ImageJ gui

Conclusions ImageJ is a useful and flexible environment for developing Java-based image processing algorithms User algorithms can be simply added to a GUI using the concept of a plug-in ImageJ allows easy access to image pixel data for a range of image types