Biomedical Engineering Reference
In-Depth Information
PET, enabling much more compact code. They are as invaluable now in
ImageJ as they were back then and are more often than not the main
driving element of macros. ImageJ does not offer the luxury of 2D arrays
that may negate for loops, so they are an essential way of either running
through images within a folder, or pixels within an image, for example.
Indeed, to run through every pixel in an image, then a for loop nested
within a for loop may be required to scan through every pixel in the x
direction fi rst, before starting scanning through a new y row of pixels.
Multidimensional arrays can, however, be implemented in ImageJ using
Java coding by the more experienced programmer. Additionally, another
take on the for loop can be executed using a 'do . . . while' loop.
Arrays
Arrays are essentially sequences of numbers or alphanumeric values,
which can be defi ned up front or captured by the macro to later be used
as output. When they are numeric they can be processed by ImageJ, for
example they can be sorted. An example of an array within a for loop is:
// Demonstration of for loop containing an array
number = newArray(10);
for (x=0; x<number.length; x++) {
number[x] = (x);
print(number[x]);
}
// end of macro.
// Demonstration of for loop containing an array
number = newArray(10);
for (x=0; x<number.length; x++) {
number[x] = (x);
print(number[x]);
}
// end of macro.
Arrays are particularly useful to capture long strings of data coming from
a macro, which can be stored in a results table on which further analysis
can be performed. Arrays may also be used to input pixel values from an
image, which can then be modifi ed and the new array saved back as an
image. There are built-in functions within ImageJ to handle arrays, such
as to trim, sort and invert them as well as output statistics. When used in
collaboration with for loops to populate and read them, they provide an
alternative to using the central results table used by ImageJ to output
measured parameters. This is useful when it is inconvenient to clear the
results table to make way for a new set of measurements. Arrays can be
large in size and are only limited by the RAM allocation to ImageJ.
￿ ￿ ￿ ￿ ￿
Results and custom tables
ImageJ delivers all measured results into a central results table. In addition
to ImageJ adding results to the table, the user can also add columns and
 
Search WWH ::




Custom Search