This commit is contained in:
@@ -844,6 +844,8 @@ public class ScreenPanel3 extends Panel {
|
||||
parseUserOverlays();
|
||||
errorOverlay = null;
|
||||
lastMarkerPos = null;
|
||||
lastFrame = null;
|
||||
lastPipelinePars = null;
|
||||
|
||||
if (dataTableDialog != null) {
|
||||
dataTableDialog.dispose();
|
||||
@@ -947,7 +949,7 @@ public class ScreenPanel3 extends Panel {
|
||||
}
|
||||
server.start(pipelineName, instanceName);
|
||||
|
||||
updateServerControls();
|
||||
updatePipelineControls();
|
||||
checkThreshold.setEnabled(true);
|
||||
checkGoodRegion.setEnabled(true);
|
||||
} else {
|
||||
@@ -1023,7 +1025,7 @@ public class ScreenPanel3 extends Panel {
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
renderer.clearOverlays();
|
||||
updateServerControls();
|
||||
updatePipelineControls();
|
||||
if (renderer.getDevice() == null) {
|
||||
//renderer.setZoom(1.0);
|
||||
//renderer.setMode(RendererMode.Zoom);
|
||||
@@ -1302,40 +1304,97 @@ public class ScreenPanel3 extends Panel {
|
||||
updatingColormap = false;
|
||||
}
|
||||
|
||||
boolean updatingServerControls;
|
||||
|
||||
void updateServerControls() {
|
||||
if (server != null) {
|
||||
updatingServerControls = true;
|
||||
try {
|
||||
checkBackground.setSelected(server.getBackgroundSubtraction());
|
||||
Double threshold = (server.getThreshold());
|
||||
checkThreshold.setSelected(threshold != null);
|
||||
spinnerThreshold.setValue((threshold == null) ? 0 : threshold);
|
||||
Map<String, Object> gr = (server.getGoodRegion());
|
||||
checkGoodRegion.setSelected(gr != null);
|
||||
if (gr != null) {
|
||||
spinnerGrThreshold.setValue(((Number) gr.get("threshold")).doubleValue());
|
||||
spinnerGrScale.setValue(((Number) gr.get("gfscale")).doubleValue());
|
||||
}
|
||||
Map<String, Object> slicing = (server.getSlicing());
|
||||
checkSlicing.setSelected(slicing != null);
|
||||
if (slicing != null) {
|
||||
spinnerSlNumber.setValue(((Number) slicing.get("number_of_slices")).intValue());
|
||||
spinnerSlScale.setValue(((Number) slicing.get("scale")).doubleValue());
|
||||
spinnerSlOrientation.setValue((String) slicing.get("orientation"));
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
void updatePipelineProperties(){
|
||||
goodRegion = checkGoodRegion.isSelected();
|
||||
spinnerThreshold.setVisible(checkThreshold.isSelected());
|
||||
setGoodRegionOptionsVisible(goodRegion);
|
||||
slicing = goodRegion && checkSlicing.isSelected();
|
||||
setSlicingOptionsVisible(slicing);
|
||||
updatingServerControls = false;
|
||||
updatingServerControls = false;
|
||||
}
|
||||
|
||||
boolean updatingServerControls;
|
||||
|
||||
void updatePipelineControls() {
|
||||
if (server != null) {
|
||||
updatingServerControls = true;
|
||||
if (server.isStarted()){
|
||||
try {
|
||||
checkBackground.setSelected(server.getBackgroundSubtraction());
|
||||
Double threshold = (server.getThreshold());
|
||||
checkThreshold.setSelected(threshold != null);
|
||||
spinnerThreshold.setValue((threshold == null) ? 0 : threshold);
|
||||
Map<String, Object> gr = (server.getGoodRegion());
|
||||
checkGoodRegion.setSelected(gr != null);
|
||||
if (gr != null) {
|
||||
spinnerGrThreshold.setValue(((Number) gr.get("threshold")).doubleValue());
|
||||
spinnerGrScale.setValue(((Number) gr.get("gfscale")).doubleValue());
|
||||
}
|
||||
Map<String, Object> slicing = (server.getSlicing());
|
||||
checkSlicing.setSelected(slicing != null);
|
||||
if (slicing != null) {
|
||||
spinnerSlNumber.setValue(((Number) slicing.get("number_of_slices")).intValue());
|
||||
spinnerSlScale.setValue(((Number) slicing.get("scale")).doubleValue());
|
||||
spinnerSlOrientation.setValue((String) slicing.get("orientation"));
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
updatePipelineProperties();
|
||||
}
|
||||
}
|
||||
|
||||
boolean changedPipelinePars(Map pars1, Map pars2) {
|
||||
String[] keys = new String[]{"image_background_enable", "image_threshold", "image_good_region",
|
||||
"threshold", "gfscale", "image_slices", "number_of_slices", "scale", "orientation"};
|
||||
for (String key:keys){
|
||||
Object o1 = pars1.get(key);
|
||||
Object o2 = pars2.get(key);
|
||||
if (o1==null){
|
||||
if (o2!=null){
|
||||
return true;
|
||||
}
|
||||
} else if (!o1.equals(o2)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void updatePipelineControls(Map pars) {
|
||||
if (pars!=null){
|
||||
updatingServerControls = true;
|
||||
try {
|
||||
boolean background = (boolean) pars.get("image_background_enable");
|
||||
checkBackground.setSelected(background);
|
||||
Double threshold = (Double) (pars.get("image_threshold"));
|
||||
checkThreshold.setSelected(threshold != null);
|
||||
spinnerThreshold.setValue((threshold == null) ? 0 : threshold);
|
||||
Map<String, Object> gr = (Map<String, Object>) pars.get("image_good_region");
|
||||
checkGoodRegion.setSelected(gr != null);
|
||||
if (gr != null) {
|
||||
Double value = ((Number) gr.get("threshold")).doubleValue();
|
||||
spinnerGrThreshold.setValue(value);
|
||||
Double scale = ((Number) gr.get("gfscale")).doubleValue();
|
||||
spinnerGrScale.setValue(scale);
|
||||
}
|
||||
Map<String, Object> slicing = (Map<String, Object>) (pars.get("image_slices"));
|
||||
checkSlicing.setSelected(slicing != null);
|
||||
if (slicing != null) {
|
||||
int slices = ((Number) slicing.get("number_of_slices")).intValue();
|
||||
spinnerSlNumber.setValue(slices);
|
||||
double scale = ((Number) slicing.get("scale")).doubleValue();
|
||||
spinnerSlScale.setValue(scale);
|
||||
String orientation = (String) slicing.get("orientation");
|
||||
spinnerSlOrientation.setValue(orientation);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
updatePipelineProperties();
|
||||
}
|
||||
}
|
||||
|
||||
void setGoodRegionOptionsVisible(boolean visible) {
|
||||
spinnerGrThreshold.setVisible(visible);
|
||||
@@ -1392,6 +1451,10 @@ public class ScreenPanel3 extends Panel {
|
||||
updatingButtons = false;
|
||||
}
|
||||
}
|
||||
|
||||
Frame lastFrame = null;
|
||||
Map lastPipelinePars = null;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onTimer() {
|
||||
@@ -1415,6 +1478,23 @@ public class ScreenPanel3 extends Panel {
|
||||
updateColormap();
|
||||
updateButtons();
|
||||
checkHistogram.setSelected((histogramDialog != null) && (histogramDialog.isShowing()));
|
||||
|
||||
try{
|
||||
Frame frame = getCurrentFrame();
|
||||
if (frame!=lastFrame){
|
||||
lastFrame = frame;
|
||||
if (frame!=null){
|
||||
Map<String, Object> pars = getProcessingParameters(frame.cache);
|
||||
if((lastPipelinePars==null) || changedPipelinePars(pars, lastPipelinePars)){
|
||||
//System.out.println("Update pipeline: " + pars);
|
||||
lastPipelinePars = pars;
|
||||
updatePipelineControls(pars);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
Pen penFit = new Pen(new Color(192, 105, 0), 0);
|
||||
@@ -3554,7 +3634,7 @@ public class ScreenPanel3 extends Panel {
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
updateServerControls();
|
||||
updatePipelineControls();
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_spinnerThresholdonChange
|
||||
@@ -3568,7 +3648,7 @@ public class ScreenPanel3 extends Panel {
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
updateServerControls();
|
||||
updatePipelineControls();
|
||||
updatingServerControls = true;
|
||||
checkBackground.setSelected(false);
|
||||
updatingServerControls = false;
|
||||
@@ -3589,7 +3669,7 @@ public class ScreenPanel3 extends Panel {
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
updateServerControls();
|
||||
updatePipelineControls();
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_checkThresholdActionPerformed
|
||||
@@ -3608,7 +3688,7 @@ public class ScreenPanel3 extends Panel {
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
updateServerControls();
|
||||
updatePipelineControls();
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_checkGoodRegionActionPerformed
|
||||
@@ -3621,7 +3701,7 @@ public class ScreenPanel3 extends Panel {
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
updateServerControls();
|
||||
updatePipelineControls();
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_spinnerGrThresholdonChange
|
||||
@@ -3655,7 +3735,7 @@ public class ScreenPanel3 extends Panel {
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
updateServerControls();
|
||||
updatePipelineControls();
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_checkSlicingActionPerformed
|
||||
@@ -3668,7 +3748,7 @@ public class ScreenPanel3 extends Panel {
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
updateServerControls();
|
||||
updatePipelineControls();
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_spinnerSlicingChange
|
||||
|
||||
Reference in New Issue
Block a user