NOTICE! This is a static HTML version of a legacy Fiji BugZilla bug.

The Fiji project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Bug 1175 - Macro stops running when no object found 3D object Count
Macro stops running when no object found 3D object Count
Status: RESOLVED INVALID
Product: Fiji
Classification: Unclassified
Component: Plugins
unspecified
Macintosh Mac OS
: P4 normal
Assigned To: ImageJ Bugs Mailing List
Depends on:
Blocks:
 
Reported: 2015-10-15 05:52 CDT by yannick.devaud
Modified: 2015-10-21 11:47 CDT
2 users (show)

See Also:

Description yannick.devaud 2015-10-15 05:52:50 CDT
Hello,
I am running imageJ 2. I want to count objects in a stack. For this I use 3D cell count. It works well when running from the plugin tool, even when there is no object found. In this case it just writes in the Log window that 0 objects were found.
Now I want to make a macro since I have lots of images to analyze. When the 3D objects counter finds objects, everything works fine. However, when no object is found in my stack, a dialogue box pops up saying "No object found" and the macro stopps.
I wonder why this message doesn't appear when I run it manually on one stack but only when I run my macro? And it is annoying since the macro stops, which I don't want.

thanks for the help!!

Information about your version of Java:

  os.arch => x86_64
  os.name => Mac OS X
  os.version => 10.9.5
  java.version => 1.6.0_65
  java.vendor => Apple Inc.
  java.runtime.name => Java(TM) SE Runtime Environment
  java.runtime.version => 1.6.0_65-b14-462-11M4609
  java.vm.name => Java HotSpot(TM) 64-Bit Server VM
  java.vm.version => 20.65-b04-462
  java.vm.vendor => Apple Inc.
  java.vm.info => mixed mode
  java.awt.graphicsenv => apple.awt.CGraphicsEnvironment
  java.specification.name => Java Platform API Specification
  java.specification.version => 1.6
  sun.cpu.endian => little
  sun.desktop => null
  file.separator => /

The up-to-date check says: REMIND_LATER

Information relevant to JAVA_HOME related problems:

  JAVA_HOME is set to: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/
  imagej.dir => /Applications/Fiji.app

Information about the version of each plugin:

Activated update sites:
ImageJ: http://update.imagej.net/ (last check:20150915154157)
Fiji: http://update.fiji.sc/ (last check:20151013215820)
Comment 1 Curtis Rueden 2015-10-19 11:29:18 CDT
See also:
http://forum.imagej.net/t/macro-stops-running-3d-object-counter/104

And in particular, Jan Eglinger's confirmation:

> I was able to reproduce this behavior with the following macro:
>
> newImage("HyperStack", "8-bit color-mode", 121, 154, 1, 114, 1);
> run("3D Objects Counter", "threshold=128 slice=57 min.=10 max.=2124276 " +
>   "objects surfaces centroids centres_of_masses statistics summary");
>
> which displays a "No object found" dialog, whereas if you manually run
> Analyze ▷ 3D Objects Counter, it doesn't display a dialog but logs:
>
> HyperStack: 0 objects detected (Size filter set to 10-2124276 voxels, threshold set to: 0).
Comment 2 yannick.devaud 2015-10-21 03:08:31 CDT
Hello,
yes well, it's the same person who submitted the report. :)
Do you have any clue why this happens?
Comment 3 Curtis Rueden 2015-10-21 11:36:38 CDT
> yes well, it's the same person who submitted the report. :)

I know, but this report is public. I posted the cross-link, for the benefit of any other interested parties who would otherwise not know about it.

> Do you have any clue why this happens?

Not yet. Haven't had time to investigate.
Comment 4 Curtis Rueden 2015-10-21 11:47:56 CDT
This problem occurs when the threshold given is outside the range of the data. The UI does not allow you to input such thresholds, but from a macro it is possible -- hence the error message.

You can work around it with the following code:

  newImage("HyperStack", "8-bit color-mode", 121, 154, 1, 114, 1);
  getStatistics(area, mean, min, max, std, histogram);
  if (max < 128) threshold = max;
  else threshold = 128;
  print "Using threshold of " + threshold);
  run("3D Objects Counter", "threshold=" + threshold +
      " slice=50 min.=10 max.=2124276 " +
      "objects surfaces centroids centres_of_masses statistics summary");

You may need to do something similar for invalid values of other parameters too; I'm not sure.

I guess the plugin could be changed to not show this error message when running from a macro. If anyone wants to adopt the 3D Objects Counter plugin (currently unmaintained), that would be great.