Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Image Processing with ImageJ

You're reading from   Image Processing with ImageJ Get familiar with one of the world's most highly regarded Digital Image processors, ImageJ. This tutorial takes you through every aspect of viewing, processing, and analysing 2D, 3D, and 4D images, clearly and comprehensively.

Arrow left icon
Product type Paperback
Published in Sep 2013
Publisher Packt
ISBN-13 9781783283958
Length 140 pages
Edition 1st Edition
Tools
Arrow right icon
Toc

Defining functions


A function is a piece of code that does a very specific operation. Defining functions in the ImageJ macro language is simple. You just need to use the function keyword, followed by the function name. A function may receive as many arguments as desired and may or may not return a value. Consider the following function:

functiongetMax(a, b) {
  if (a > b) {
    return a;
  }
  else{
    return b;
  }
}
print(getMax(5, 4));
print(getMax(5, 6));

As you can see from the previous example, the function definition does nothing by itself. In order to execute it, it needs to be called.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime