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 969 - "Analyse particles" - potential bug if applied to 4-dimensional stack
"Analyse particles" - potential bug if applied to 4-dimensional stack
Status: RESOLVED FIXED
Product: Fiji
Classification: Unclassified
Component: Plugins
unspecified
PC Windows
: P4 normal
Assigned To: ImageJ Bugs Mailing List
Depends on:
Blocks:
 
Reported: 2014-12-07 16:45 CST by Kay Schink
Modified: 2014-12-13 13:24 CST
2 users (show)

See Also:

Description Kay Schink 2014-12-07 16:45:59 CST
Hi,

I have recently come across a problem in the "Analyse Particles" function which I think might be a bug in handling of hyperstacks or ROI position handling. 

I analyse a thresholded timeseries (Z + T) and add identified particles to the ROI manager. I should note that I get the time series by the "Duplicate" command from a composite image.

At the first timepoint, ROIs are added to the ROI manager for each for each of the Z-Planes. 
However, problems start to occur once the stack reaches the last z-plane of timepoint 1. I would expect that now the ROIs from timepoint 2 should be added to the manager. 

However, when reaching the end of the Z-Stack of timepoint 1, the ROI positions jump not to timepoint 2, but rather to the next timepoint that would come after the Z-Stack, e.g. if the z-stack has 5 planes, the next added ROIs will be localized to Timepoint 6, Z-Position 5.  After this, the ROI-Positions will cycle not through the Z-planes, but rather through the time-axis until the end is reached. After this, the time-axis jumps to a later timepoint (in the case of the "Mitosis 5D" sample timeseries to timepoint 11) and from there on behaves as expected, e.g. ROIs are added first to z-planes and when the last-Z-plane is reached, ROIs will be added to the first Z-plane of the next timepoint..
I do not think that the problem is with the definition of the ROIs as such, since the shape of the ROIs corresponds to the segmented particles at the expected timepoints. I rather think that wrong position info is written to the ROIs when adding them to the ROI manager. 
The problem occurs both in FIJI and in plain ImageJ, both in a current version and in the FIJI lifeline version.
I use Windows 7 64bit version, and run ImageJ / Fiji in 64 bit. However, I have tested the plain ImageJ 32 bit version and find the same behaviour.

I have attached a minimal macro (see below) that calls the "Mitosis" sample, extracts the first channel, applies a threshold  and then runs the Particle analyser which adds the ROIs to the manager. Then the positions of the ROIs in question are printed to the log in order to illustrate the problem.

Thanks a lot for your help

Kay



// Begin sample macro

run("Mitosis (26MB, 5D stack)");
run("Duplicate...", "duplicate channels=1");
//run("Threshold...");
setAutoThreshold("Triangle dark");
setOption("BlackBackground", true);
run("Convert to Mask", "method=Triangle background=Dark black");

run("Analyze Particles...", "size=1-Infinity add stack");

// Printing of the ROI positions to the log, not necessary for bug 

roiManager("Select", 0);
Stack.getPosition(channel, slice, frame);
print("Position (C, Z, T): "+channel+", "+slice+", "+frame);
roiManager("Select", 1);
Stack.getPosition(channel, slice, frame);
print("Position (C, Z, T): "+channel+", "+slice+", "+frame);
roiManager("Select", 2);
Stack.getPosition(channel, slice, frame);
print("Position (C, Z, T): "+channel+", "+slice+", "+frame);
roiManager("Select", 3);
Stack.getPosition(channel, slice, frame);
print("Position (C, Z, T): "+channel+", "+slice+", "+frame);
roiManager("Select", 4);
Stack.getPosition(channel, slice, frame);
print("Position (C, Z, T): "+channel+", "+slice+", "+frame);
//normal behaviour until here, then the "Frame" position jumps not to Frame "2" but to Frame 6 (continues from the "Z" position).
roiManager("Select", 5);
Stack.getPosition(channel, slice, frame);
print("Position (C, Z, T): "+channel+", "+slice+", "+frame);
roiManager("Select", 6);
Stack.getPosition(channel, slice, frame);
print("Position (C, Z, T): "+channel+", "+slice+", "+frame);

//end of the Timeseries for Z=5 reached, jumps to T=11 and Z=1

roiManager("Select", 51);
Stack.getPosition(channel, slice, frame);
print("Position (C, Z, T): "+channel+", "+slice+", "+frame);
roiManager("Select", 52);
Stack.getPosition(channel, slice, frame);
print("Position (C, Z, T): "+channel+", "+slice+", "+frame);
roiManager("Select", 53);
Stack.getPosition(channel, slice, frame);
print("Position (C, Z, T): "+channel+", "+slice+", "+frame);

Information about your version of Java:

  os.arch => amd64
  os.name => Windows 7
  os.version => 6.1
  java.version => 1.6.0_24
  java.vendor => Sun Microsystems Inc.
  java.runtime.name => Java(TM) SE Runtime Environment
  java.runtime.version => 1.6.0_24-b07
  java.vm.name => Java HotSpot(TM) 64-Bit Server VM
  java.vm.version => 19.1-b02
  java.vm.vendor => Sun Microsystems Inc.
  java.vm.info => mixed mode
  java.awt.graphicsenv => sun.awt.Win32GraphicsEnvironment
  java.specification.name => Java Platform API Specification
  java.specification.version => 1.6
  sun.cpu.endian => little
  sun.desktop => windows
  file.separator => \

The up-to-date check says: UP_TO_DATE

Information relevant to JAVA_HOME related problems:

  JAVA_HOME is set to: D:\Fiji.app/java/win64/jdk1.6.0_24//jre
  imagej.dir => D:\Fiji.app

Information about the version of each plugin:

Activated update sites:
ImageJ: http://update.imagej.net/ (last check:20141126221327)
Fiji: http://fiji.sc/update/ (last check:20141125171145)
BigDataViewer: http://sites.imagej.net/Pietzsch/ (last check:20141126120148)
BioVoxxel: http://sites.imagej.net/BioVoxxel/ (last check:20141201130413)
CMCI-EMBL: http://sites.imagej.net/Miura/ (last check:20140718160940)
GDSC: http://sites.imagej.net/GDSC/ (last check:20141118185052)
GDSC-SMLM: http://sites.imagej.net/GDSC-SMLM/ (last check:20140918121334)
NucleusJ: http://sites.imagej.net/PouletAxel/ (last check:20141101103602)

Files not up-to-date:
  8c286564 (LOCAL_ONLY) 20141111230316 macros/BatchMacro.ijm
  ec6d8e8c (LOCAL_ONLY) 20141111182043 macros/Measure_Nuclei.ijm
  10411e90 (LOCAL_ONLY) 20141015104827 plugins/Calc_TIRF.class
  011c812b (LOCAL_ONLY) 20141009112831 plugins/Drop_Script-1.0.0.jar
  ec17890b (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/JHotDraw.jar
  91ece67d (LOCAL_ONLY) 20140714110424 plugins/Omero/omero/JWlz.jar
  36cb5c0a (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/TableLayout.jar
  ff61a1b4 (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/ai_path.jar
  c3a86bd0 (LOCAL_ONLY) 20140714110424 plugins/Omero/omero/assumeng.jar
  364315a9 (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/axis.jar
  0af1624e (LOCAL_ONLY) 20140714110422 plugins/Omero/omero/backport-util-concurrent.jar
  52e3b543 (LOCAL_ONLY) 20140805165734 plugins/Omero/omero/blitz-javadoc.jar
  d336fa64 (LOCAL_ONLY) 20140805165708 plugins/Omero/omero/blitz-sources.jar
  28e0f97f (LOCAL_ONLY) 20140805165740 plugins/Omero/omero/blitz.jar
  189f61fa (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/bufr.jar
  a2a2616b (LOCAL_ONLY) 20140805165522 plugins/Omero/omero/common-javadoc.jar
  793e910c (LOCAL_ONLY) 20140805165520 plugins/Omero/omero/common-sources.jar
  d7cff6e6 (LOCAL_ONLY) 20140805165522 plugins/Omero/omero/common.jar
  940245e0 (LOCAL_ONLY) 20140714110222 plugins/Omero/omero/commons-codec.jar
  64d8a654 (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/commons-collections.jar
  86ab9004 (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/commons-digester.jar
  9e9eb622 (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/commons-discovery.jar
  c62bea1b (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/commons-httpclient.jar
  d59d3e4c (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/commons-io.jar
  f6139801 (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/commons-lang.jar
  7018824c (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/commons-logging.jar
  60a83b54 (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/commons-validator.jar
  abf211c5 (LOCAL_ONLY) 20140714110422 plugins/Omero/omero/ehcache-core.jar
  991b5e8a (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/gicentreUtils.jar
  dbcde867 (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/gluegen-rt.jar
  e33cecc2 (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/grib.jar
  69cd59e7 (LOCAL_ONLY) 20120802213046 plugins/Omero/omero/guava.jar
  85c28658 (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/hibernate-jpa-2.0-api.jar
  1911c9e1 (LOCAL_ONLY) 20140714110422 plugins/Omero/omero/ice-glacier2.jar
  b1d709fb (LOCAL_ONLY) 20140714110422 plugins/Omero/omero/ice-grid.jar
  c49b8fa2 (LOCAL_ONLY) 20140714110422 plugins/Omero/omero/ice-storm.jar
  53aa5393 (LOCAL_ONLY) 20140714110422 plugins/Omero/omero/ice.jar
  6e7614ee (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/ij.jar
  6ce638fb (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/ini4j.jar
  f1b65457 (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/java-getopt.jar
  c827227f (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/java-image-scaling.jar
  e72f9b2b (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/jaxrpc.jar
  4156c7b5 (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/jcommon.jar
  c57f20b0 (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/jfreechart.jar
  df7a0b63 (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/jna.jar
  4c09d41c (LOCAL_ONLY) 20140714110424 plugins/Omero/omero/joda-time.jar
  9a9b947a (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/jogl.jar
  d2af3ac9 (LOCAL_ONLY) 20140714110424 plugins/Omero/omero/kryo.jar
  b2911375 (LOCAL_ONLY) 20140805165430 plugins/Omero/omero/lwf-stubs.jar
  19da6ad6 (LOCAL_ONLY) 20140805165516 plugins/Omero/omero/model-psql-javadoc.jar
  0a346f32 (LOCAL_ONLY) 20140805165508 plugins/Omero/omero/model-psql-sources.jar
  407db314 (LOCAL_ONLY) 20140805165516 plugins/Omero/omero/model-psql.jar
  a127d67c (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/nanoxml.jar
  6c7ec21f (LOCAL_ONLY) 20140714110424 plugins/Omero/omero/native-lib-loader.jar
  a51a31db (LOCAL_ONLY) 20140714110424 plugins/Omero/omero/netcdf.jar
  e665d66a (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/ols-client.jar
  18382f06 (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/ome-java.jar
  7af6ddeb (LOCAL_ONLY) 20131104145522 plugins/Omero/omero/perf4j.jar
  6340be70 (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/physics.jar
  b3056152 (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/platform.jar
  4ef2cfd3 (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/poi.jar
  af4b3176 (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/processing-controlP5.jar
  1cb045e1 (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/processing-core.jar
  2e6cf711 (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/saaj.jar
  eedc0cd9 (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/serializer.jar
  5085d943 (LOCAL_ONLY) 20140714110424 plugins/Omero/omero/slf4j-api.jar
  1deeabc9 (LOCAL_ONLY) 20140805165428 plugins/Omero/omero/specification.jar
  ba32bfdf (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/swingx.jar
  7c4005e7 (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/wsdl4j.jar
  c8694e76 (LOCAL_ONLY) 20131104145444 plugins/Omero/omero/xalan.jar
  8c81f781 (LOCAL_ONLY) 20140805170144 plugins/Omero/omero_ij.jar
  46cc7ddc (LOCAL_ONLY) 20141029210256 plugins/SaveAsMovie_win64.jar
  b2afde18 (LOCAL_ONLY) 20141113134553 plugins/cell_counter.jar
Comment 1 Kay Schink 2014-12-07 17:04:48 CST
I am very sorry, I made a small error with the demo macro I posted.

The macro misses the "stack" parameter at this line :

run("Convert to Mask", "method=Triangle background=Dark black");

should be :

run("Convert to Mask", "method=Triangle background=Dark black stack");

to run properly, otherwise the thresholding fails..
This is independent of the reported error, just the preprocessing of the demo data...

Best wishes

Kay
Comment 2 Wayne Rasband 2014-12-13 13:24:25 CST
This bug is fixed in the latest ImageJ daily build (1.49n13). The following is a modified version of the test macro that displays the position and size of all objects found by the particle analyzer. it omits the

   run("Convert to Mask", "method=Triangle background=Dark black stack");

statement because it is only needed when using the "Convert to Mask" command's "Calculate threshold for each image"option.

  run("Mitosis (26MB, 5D stack)");
  run("Duplicate...", "duplicate channels=1");
  setAutoThreshold("Triangle dark");
  roiManager("reset");
  run("Analyze Particles...", "size=1-Infinity add stack");
  run("Clear Results");
  n = roiManager("count");
  for (i=0; i<n; i++) {
     roiManager("Select", i);
     Stack.getPosition(c, z, t);
     getStatistics(area, mean);
     setResult("z",i,z);
     setResult("t",i,t);
     setResult("area",i,area);
     setResult("mean",i,mean);
  }
  updateResults;
  run("Select None");

And here is a version of the macro that uses an overlay instead of the ROI Manager:

  run("Mitosis (26MB, 5D stack)");
  run("Duplicate...", "duplicate channels=1");
  setAutoThreshold("Triangle dark");
  run("Analyze Particles...", "size=1-Infinity show=[Overlay Outlines] stack");
  run("Clear Results");
  n = Overlay.size
  for (i=0; i<n; i++) {
     Overlay.activateSelection(i)
     Stack.getPosition(c, z, t);
     getStatistics(area, mean);
     setResult("z",i,z);
     setResult("t",i,t);
     setResult("area",i,area);
     setResult("mean",i,mean);
  }
  updateResults;
  run("Select None");