float[] getZAxisProfile(Roi roi, double minThreshold, double maxThreshold) {
ImageStack stack = imp.getStack();
int size = stack.getSize();
float[] values = new float[size];
Calibration cal = imp.getCalibration();
Analyzer analyzer = new Analyzer(imp);
int measurements = analyzer.getMeasurements();
boolean showResults = measurements!=0 && measurements!=LIMIT;
boolean showingLabels = (measurements&LABELS)!=0 || (measurements&SLICE)!=0;
measurements |= MEAN;
if (showResults) {
if (!analyzer.resetCounter())
return null;
}
int current = imp.getCurrentSlice();
for (int i=1; i<=size; i++) {
if (showingLabels) imp.setSlice(i);
ImageProcessor ip = stack.getProcessor(i);
if (minThreshold!=ImageProcessor.NO_THRESHOLD)
ip.setThreshold(minThreshold,maxThreshold,ImageProcessor.NO_LUT_UPDATE);
ip.setRoi(roi);
ImageStatistics stats = ImageStatistics.getStatistics(ip, measurements, cal);
analyzer.saveResults(stats, roi);
if (showResults)
analyzer.displayResults();
values[i-1] = (float)stats.mean;
}
if (showingLabels) imp.setSlice(current);
return values;
}