...
 
Commits (2)
......@@ -110,7 +110,8 @@ public class FieldStats extends ModuleCore
new Parameter<>(META_HISTOGRAM, new long[0][0]),
new Parameter<>(META_DERIV_HISTOGRAM, new long[0][0]),
new Parameter<>(META_THR_HISTOGRAM, new double[0][0]),
new Parameter<>(META_IS_REGULAR_FIELD, false)
new Parameter<>(META_IS_REGULAR_FIELD, false),
new Parameter<>(META_IS_HAS_MASK_OR_IS_TIME_DEPENDENT, false)
};
}
......@@ -129,6 +130,7 @@ public class FieldStats extends ModuleCore
histograms[i] = inField.getComponent(i).getHistogram(comp.getMinValue(), comp.getMaxValue(), 256, false, inField.getMask());
}
parameters.set(META_HISTOGRAM, histograms);
parameters.set(META_IS_HAS_MASK_OR_IS_TIME_DEPENDENT, inField.isTimeDependant() || inField.hasMask());
if (inField instanceof RegularField) {
parameters.set(META_DIMS, ((RegularField) inField).getDims());
parameters.set(META_AVG_GRAD, ((RegularField) inField).getAvgGrad());
......@@ -176,9 +178,7 @@ public class FieldStats extends ModuleCore
if (isDifferentField || isNewField) {
DataContainerSchema schema = inField.getSchema();
for (int i = 0; i < inField.getNComponents(); i++) {
if(schema.getComponentSchema(i).isStatisticsComputed() == false) {
inField.getComponent(i).recomputeStatistics();
}
inField.getComponent(i).recomputeStatistics(inField.getMask(), false);
}
}
......
......@@ -68,4 +68,5 @@ public class FieldStatsShared
public static final ParameterName<long[][]> META_DERIV_HISTOGRAM = new ParameterName("META derivHistogram");
public static final ParameterName<double[][]> META_THR_HISTOGRAM = new ParameterName("META thrHistogram");
public static final ParameterName<Boolean> META_IS_REGULAR_FIELD = new ParameterName("META is regular field");
public static final ParameterName<Boolean> META_IS_HAS_MASK_OR_IS_TIME_DEPENDENT = new ParameterName("META field has a mask or is time dependent");
}
......@@ -70,8 +70,9 @@ public class GUI extends javax.swing.JPanel
void updateGUI(ParameterProxy p, boolean resetFully, boolean setRunButtonPending)
{
if (p.get(META_COMPONENT_NAMES).length > 0) {
boolean maskOrTime = p.get(META_IS_HAS_MASK_OR_IS_TIME_DEPENDENT);
if (p.get(META_IS_REGULAR_FIELD)) {
regularFieldStatsPanel.setProperties(parameters, p.get(SELECTED_COMPONENT), p.get(LOG_SCALE), p.get(META_NAME), p.get(META_DIMS), p.get(META_EXTENDS), p.get(META_PHYS_EXTENDS), p.get(META_COMPONENT_NAMES), p.get(META_SCHEMA), p.get(META_HISTOGRAM), p.get(META_AVG_GRAD), p.get(META_STDDEV_GRAD), p.get(META_DERIV_HISTOGRAM), p.get(META_THR_HISTOGRAM));
regularFieldStatsPanel.setProperties(parameters, p.get(SELECTED_COMPONENT), p.get(LOG_SCALE), p.get(META_NAME), p.get(META_DIMS), p.get(META_EXTENDS), p.get(META_PHYS_EXTENDS), p.get(META_COMPONENT_NAMES), p.get(META_SCHEMA), p.get(META_HISTOGRAM), maskOrTime ? null : p.get(META_AVG_GRAD), maskOrTime ? null : p.get(META_STDDEV_GRAD), maskOrTime ? null : p.get(META_DERIV_HISTOGRAM), maskOrTime ? null : p.get(META_THR_HISTOGRAM));
((CardLayout) getLayout()).show(this, "regular");
} else {
irregularFieldStatsPanel.setProperties(parameters, p.get(SELECTED_COMPONENT), p.get(LOG_SCALE), p.get(META_NAME), p.get(META_NNODES), p.get(META_EXTENDS), p.get(META_PHYS_EXTENDS), p.get(META_COMPONENT_NAMES), p.get(META_SCHEMA), p.get(META_HISTOGRAM));
......
......@@ -224,26 +224,66 @@ public class RegularFieldStatsPanel extends javax.swing.JPanel
vMinLabel.setText(minMeanMax[0]);
vMeanLabel.setText(minMeanMax[1]);
vMaxLabel.setText(minMeanMax[2]);
dMeanLabel.setText(EngineeringFormattingUtils.format(avgGrad[n]));
vSDLabel.setText(EngineeringFormattingUtils.format(schema.getComponentSchema(n).getStandardDeviationValue()));
dSDLabel.setText(EngineeringFormattingUtils.format(stdDevGrad[n]));
if(avgGrad != null) {
gradLabel.setVisible(true);
gradALabel.setVisible(true);
gradSDLabel.setVisible(true);
dMeanLabel.setVisible(true);
dSDLabel.setVisible(true);
dMeanLabel.setText(EngineeringFormattingUtils.format(avgGrad[n]));
dSDLabel.setText(EngineeringFormattingUtils.format(stdDevGrad[n]));
}
else {
gradLabel.setVisible(false);
gradALabel.setVisible(false);
gradSDLabel.setVisible(false);
dMeanLabel.setVisible(false);
dSDLabel.setVisible(false);
}
//assuming histograms of length 256
long[] valueHistogram = histograms[n];
long[] derivHistogram = derivHistograms[n];
int downsize = 256 / binCount;
long[] valueHistogramDownsized = new long[binCount];
long[] derivHistogramDownsized = new long[binCount];
int k = 0;
for (int i = 0; i < binCount; i++)
for (int i = 0; i < binCount; i++) {
for (int j = 0; j < downsize; j++) {
valueHistogramDownsized[i] += valueHistogram[k];
derivHistogramDownsized[i] += derivHistogram[k];
k++;
}
}
valueHistogramPlot.setData(valueHistogramDownsized, logBox.isSelected(), schema.getComponentSchema(n).getMinValue(), schema.getComponentSchema(n).getMaxValue());
thrArea.setHisto(thrHistograms[n], logBox.isSelected(), schema.getComponentSchema(n).getMinValue(), schema.getComponentSchema(n).getMaxValue());
derivativeHistogramPlot.setData(derivHistogramDownsized, logBox.isSelected());
if(derivHistograms != null) {
long[] derivHistogram = derivHistograms[n];
long[] derivHistogramDownsized = new long[binCount];
k = 0;
for (int i = 0; i < binCount; i++) {
for (int j = 0; j < downsize; j++) {
derivHistogramDownsized[i] += derivHistogram[k];
k++;
}
}
jLabel8.setVisible(true);
derivHistoPanel.setVisible(true);
derivativeHistogramPlot.setVisible(true);
derivativeHistogramPlot.setData(derivHistogramDownsized, logBox.isSelected());
}
else {
jLabel8.setVisible(false);
derivHistoPanel.setVisible(true);
derivativeHistogramPlot.setVisible(false);
}
if(thrHistograms != null) {
jLabel9.setVisible(true);
thresholdPreferencesPanel.setVisible(true);
thrArea.setVisible(true);
thrArea.setHisto(thrHistograms[n], logBox.isSelected(), schema.getComponentSchema(n).getMinValue(), schema.getComponentSchema(n).getMaxValue());
}
else {
jLabel9.setVisible(false);
thresholdPreferencesPanel.setVisible(false);
thrArea.setVisible(false);
}
}
}
......