Dear all,
I'm working on a Java routine combining Weka segmentation and the Particle Analyzer. I call these functions from R using rJava, so it is important to notice that the JVM will remain active between repeated runs of the code.
I'm experiencing the peculiar issue that the Particle Analyzer throws a Null Pointer Exception, but only after the first run. The first run of the code works perfectly!
During each run, the main class is initialized, and the following code is run during construction.
rois = new RoiManager();
rois.setVisible(false);
ParticleAnalyzer.setRoiManager(rois);
analyzer
= new ParticleAnalyzer(ParticleAnalyzer.ADD_TO_MANAGER | ParticleAnalyzer.INCLUDE_HOLES | ParticleAnalyzer.SHOW_NONE, 0, new ResultsTable(), min_area, 999);
...
try {
analyzer.analyze(new ImagePlus("", imp_classified.getProcessor()));
} catch (NullPointerException e) {
throw new IllegalStateException("Rerunning this code gave a NullPointerException", e);
}
I'm at a loss, since there is more than enough memory space available and all the variables, including the Java classes, are destroyed in R at the start of each run. I tried forcing garbage collection after the analyzer finished, but without much succes.
I really hope some of you are able to assist me with this.
Thanks in advance!
Jasper J.M. Kouwenberg
PhD Candidate
RadioIsotopes for Health (RIH), TU Delft
From DKFZ, Germany
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html