I am out of my league with this question.   The following code starts the java imaging program ImageJ from within R, and displays an image (assuming ImageJ is installed on your computer).

library(RImageJ)
img  <-  IJ$openImage( file.choose() )   #pick an available .tif file
img$show()    #  make the image object visible 
# An image is now displayed

# find out about the objects involved
> str(IJ)
Formal class 'jobjRef' [package "rJava"] with 2 slots
  ..@ jobj  :<externalptr> 
  ..@ jclass: chr "ij/IJ"

> str(img)
Formal class 'jobjRef' [package "rJava"] with 2 slots
  ..@ jobj  :<externalptr> 
  ..@ jclass: chr "java/lang/Object"
 
# now use an IJ java method to find out existing screen size
IJ$getScreenSize()
[1] "Java-Object{java.awt.Dimension[width=1680,height=1050]}"

> str(IJ$getScreenSize())
Formal class 'jobjRef' [package "rJava"] with 2 slots
  ..@ jobj  :<externalptr> 
  ..@ jclass: chr "java/lang/Object"

I am gathering that the RJava library (which is required by the RImageJ library) is using 'slots' which are related to S4????  My question is whether there is any way to extract the width and height information from the IJ$getScreenSize() command which has the vague appearance of being a string vector or list but is obviously something far more complex like a java str object?

Question 2.  Is there recommended reading on how one coerces objects back and forth in this type of situation.  For example the ImageJ documentation for the IJ class shows the following for the makeOval method:
static void makeOval(int x, int y, int width, int height)

Creates an elliptical selection.

Here is what happens in R:

> IJ$makeOval(694, 265, 274, 129);
Error in .jrcall(x, name, ...) : 
  Cannot find Java method `makeOval' matching the supplied parameters.


Can anyone point me in the direction of much-needed self-education :-)

Thanks for any insight.

Rob



---------------------
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicne
A. T. Still University of Health Sciences
800 W. Jefferson St.
Kirksville, MO 63501
	[[alternative HTML version deleted]]


