roiManager("measure") NullPointerException

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

roiManager("measure") NullPointerException

pradeep kota
Dear all,

I am trying to write a macro to export line ROIs from many tif overlays in a directory, one at a time, into roiManager and then measure lengths and angles of the lines. Each tif file contains 4-8 such lines. Here's the relevant part of the macro that processes each file in a given directory.

open(inputList[fNo]); //Array holding files in a given directory
if(!isOpen("ROI Manager")) {
run("ROI Manager...");
} else {
clearROIManager(); //User-defined utility function to clear all elements of the ROIManager
}
run("To ROI Manager");
if(isOpen("Results")) {
run("Clear Results");
}
run("Set Measurements...", "bounding redirect=None decimal=3");
roiManager("Measure");

This part runs fine, except that it throws a NullPointerException sporadically. Here's the exception returned when I run the macro

(Fiji Is Just) ImageJ 2.0.0-rc-14/1.49g; Java 1.6.0_65 [64-bit]; Mac OS X 10.8.5; 161MB of 4087MB (3%)
 
java.lang.NullPointerException
at ij.gui.Line.getPixels(Line.java:404)
at ij.gui.ProfilePlot.getStraightLineProfile(ProfilePlot.java:169)
at ij.gui.ProfilePlot.<init>(ProfilePlot.java:56)
at ij.gui.ProfilePlot.<init>(ProfilePlot.java:34)
at ij.plugin.filter.Analyzer.measureLength(Analyzer.java:412)
at ij.plugin.filter.Analyzer.measure(Analyzer.java:244)
at ij.plugin.filter.Analyzer.run(Analyzer.java:92)
at ij.plugin.filter.PlugInFilterRunner.processOneImage(PlugInFilterRunner.java:262)
at ij.plugin.filter.PlugInFilterRunner.<init>(PlugInFilterRunner.java:111)
at ij.IJ.runPlugIn(IJ.java:174)
at ij.Executer.runCommand(Executer.java:131)
at ij.Executer.run(Executer.java:64)
at ij.IJ.run(IJ.java:272)
at ij.IJ.run(IJ.java:250)
at ij.plugin.frame.RoiManager.measure(RoiManager.java:853)
at ij.plugin.frame.RoiManager.runCommand(RoiManager.java:1797)
at ij.macro.Functions.roiManager(Functions.java:2559)
at ij.macro.Functions.getFunctionValue(Functions.java:223)
at ij.macro.Interpreter.getFactor(Interpreter.java:1376)
at ij.macro.Interpreter.getTerm(Interpreter.java:1347)
at ij.macro.Interpreter.getStringExpression(Interpreter.java:1487)
at ij.macro.Interpreter.getStringTerm(Interpreter.java:1306)
at ij.macro.Interpreter.getString(Interpreter.java:1263)
at ij.macro.Interpreter.doStatement(Interpreter.java:278)
at ij.macro.Interpreter.doBlock(Interpreter.java:599)
at ij.macro.Interpreter.doStatement(Interpreter.java:269)
at ij.macro.Interpreter.doFor(Interpreter.java:526)
at ij.macro.Interpreter.doStatement(Interpreter.java:251)
at ij.macro.Interpreter.doStatements(Interpreter.java:215)
at ij.macro.Interpreter.run(Interpreter.java:112)
at ij.macro.Interpreter.run(Interpreter.java:82)
at ij.macro.Interpreter.run(Interpreter.java:93)
at ij.plugin.Macro_Runner.runMacro(Macro_Runner.java:153)
at ij.IJ.runMacro(IJ.java:119)
at ij.IJ.runMacro(IJ.java:108)
at net.imagej.legacy.IJ1Helper.runMacro(IJ1Helper.java:782)
at net.imagej.legacy.plugin.IJ1MacroEngine.eval(IJ1MacroEngine.java:116)
at net.imagej.legacy.plugin.IJ1MacroEngine.eval(IJ1MacroEngine.java:156)
at org.scijava.script.ScriptModule.run(ScriptModule.java:175)
at org.scijava.module.ModuleRunner.run(ModuleRunner.java:167)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:126)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:65)
at org.scijava.thread.DefaultThreadService$2.call(DefaultThreadService.java:164)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:695)

It does not throw the exception with the same file in the directory every time, making it harder for me to track it down. Any pointers are greatly appreciated.

best
Pradeep

--
--
Please avoid top-posting, and please make sure to reply-to-all!
 
Mailing list web interface: http://groups.google.com/group/fiji-devel

---
You received this message because you are subscribed to the Google Groups "Fiji-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Loading...