I Can't save ParticleAnalyser Table results in xls file without showing ImageJ1 API

This question is related to the previous question

I am using ImageJ2 libraries where I converted from ImageJ2 ImgPlus() to ImageJ1 ImagePlus() so that I can use the Particle Analyser. All I need is to have an xls file with the table results of the Particle Analyser Class. I can run it but I have to show ImageJ1 App in order to show the Table Window while I want to avoid that. Whenever I don’t show ImageJ1 API, I get the Table printed on the console of the IDE still I can’t save it in xls file.

Below is the code where I get null for the table object.



image

The rt parameter that I added in the option field of the constructor of the ParticleAnalyser Class is not the parameter that is actually created inside the particleAnalyser object. Accessing rt throws a runtime error in the MethodHandler Class in the invoke method

any advice that would help of what I am missing?

My Mistake was that I defined the rt object as public outside the method definition somehow that didn’t work and I deleted the line for setting rt.

RoiManager roi = new RoiManager();
ResultsTable rt = new ResultsTable();  // brought it inside the method definition 
ParticleAnalyzer particleAnalyzer = new ParticleAnalyzer(ParticleAnalyzer.INCLUDE_HOLES+
         ParticleAnalyzer.SHOW_RESULTS, 0, rt, 1, Double.MAX_VALUE, 0, 1);

particleAnalyzer.setRoiManager(roi);
ParticleAnalyzer.setResultsTable(rt);      
imagePlusfiltered.setC(2);
particleAnalyzer.analyze(imagePlusfiltered);

rt.size;    // is not null