Commit 0507d8c6 authored by gonciarz's avatar gonciarz
Browse files

Handling of 3D images fixed in IA plugin (statisctics of 3D stack)

parent 2f8ad20e
......@@ -2,6 +2,9 @@
Changelog
================
* 1.0.22
- Interaction Analysis fix for 3D images
* 1.0.21
- Fix for Interaction Analysis plugin
......
package mosaic.core.detection;
import java.util.Arrays;
import java.util.Vector;
import org.apache.log4j.Logger;
import ij.ImagePlus;
import ij.ImageStack;
import ij.measure.Measurements;
......@@ -17,6 +12,10 @@ import mosaic.core.imageUtils.convolution.Kernel2D;
import mosaic.core.imageUtils.convolution.Kernel3D;
import mosaic.core.utils.DilateImage;
import mosaic.core.utils.DilateImageClij;
import org.apache.log4j.Logger;
import java.util.Arrays;
import java.util.Vector;
/**
* FeaturePointDetector detects the "real" particles in provided frames.
......@@ -59,6 +58,8 @@ public class FeaturePointDetector {
* @return container with disovered particles
*/
public Vector<Particle> featurePointDetection(ImageStack original_ips) {
logger.debug("Input stack dims(x/y/z): " + original_ips.getWidth() + "/" + original_ips.getHeight() + "/" + original_ips.getSize() + " " + iGlobalMin + "-" + iGlobalMax);
/*
* Converting the original imageProcessor to float
* This is a constraint caused by the lack of floating point precision of pixels
......@@ -625,7 +626,7 @@ public class FeaturePointDetector {
*/
public boolean setDetectionParameters(double cutoff, float percentile, int radius, float Threshold, boolean absolute, boolean aUseClij) {
final boolean changed = (radius != iRadius || cutoff != iCutoff || (percentile != iPercentile));// && intThreshold != absIntensityThreshold || mode != getThresholdMode() || thsmode != getThresholdMode();
iCutoff = cutoff;
iPercentile = percentile;
iAbsIntensityThreshold = Threshold;
......
......@@ -84,7 +84,7 @@ public abstract class DistanceCalculations {
logger.debug("Number of points (X/Y): " + iParticlesX.length + " / " + iParticlesY.length);
logger.debug("min/max of x: " + aMinX + "/" + aMaxX + " y: " + aMinY + "/" + aMaxY + " z: " + aMinZ + "/" + aMaxZ);
if (iParticlesX.length == 0 || iParticlesY.length == 0) {
Utils.messageDialog("IA - state density", "Number discaverd (and filtered) particles cannot be 0 for further calculations.\nNumber of particles (x/y): " + iParticlesX.length + " " + iParticlesY.length);
Utils.messageDialog("IA - state density", "Number of discovered particles in must be greater than 0. \nNumber of particles in image X/Y: " + iParticlesX.length + "/" + iParticlesY.length);
throw new RuntimeException("Not enough particles to perform calculations!");
}
......
package mosaic.ia;
import java.util.List;
import java.util.Vector;
import org.scijava.vecmath.Point3d;
import ij.IJ;
import ij.ImagePlus;
import ij.ImageStack;
import ij.gui.GenericDialog;
import ij.measure.Calibration;
import ij.process.ImageStatistics;
import ij.process.StackStatistics;
import mosaic.core.detection.FeaturePointDetector;
import mosaic.core.detection.GUIhelper;
import mosaic.core.detection.MyFrame;
......@@ -26,6 +21,10 @@ import net.imglib2.type.numeric.RealType;
import net.imglib2.type.numeric.integer.UnsignedByteType;
import net.imglib2.type.numeric.integer.UnsignedShortType;
import net.imglib2.type.numeric.real.FloatType;
import org.scijava.vecmath.Point3d;
import java.util.List;
import java.util.Vector;
public class DistanceCalculationsImage extends DistanceCalculations {
......@@ -100,8 +99,8 @@ public class DistanceCalculationsImage extends DistanceCalculations {
aInputImg.show();
// Get parameters from user
final ImageStatistics imageStat = aInputImg.getStatistics();
final FeaturePointDetector featurePointDetector = new FeaturePointDetector((float) imageStat.max, (float) imageStat.min);
final StackStatistics imgStatistics = new StackStatistics(aInputImg);
final FeaturePointDetector featurePointDetector = new FeaturePointDetector((float) imgStatistics.max, (float) imgStatistics.min);
final GenericDialog gd = new GenericDialog("Particle Detection...", IJ.getInstance());
GUIhelper.addUserDefinedParametersDialog(gd, featurePointDetector);
gd.showDialog();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment