Commit 3fa095d3 authored by Andrey Filippov's avatar Andrey Filippov

Saving subset of parameters

parent 2f19b216
This diff is collapsed.
......@@ -340,8 +340,20 @@ public class FocusingField {
System.out.println("fieldFitting is not initialized, nothing to save");
return;
}
fieldFitting.setProperties(prefix+"fieldFitting.",properties);
boolean select= (properties.getProperty("selected")!=null);
boolean select_fieldFitting=!select;
boolean select_FOCUSING_FIELD=!select;
if (select) {
GenericDialog gd = new GenericDialog("Select FocusingField parameters to save");
gd.addCheckbox("FieldFitting parameter class", select_fieldFitting);
gd.addCheckbox("FocusingField local parameters", select_FOCUSING_FIELD);
gd.showDialog();
if (gd.wasCanceled()) return;
select_fieldFitting=gd.getNextBoolean();
select_FOCUSING_FIELD=gd.getNextBoolean();
}
if (select_fieldFitting) fieldFitting.setProperties(prefix+"fieldFitting.",properties);
if (select_FOCUSING_FIELD){
properties.setProperty(prefix+"pX0_distortions",pX0_distortions+"");
properties.setProperty(prefix+"pY0_distortions",pY0_distortions+"");
properties.setProperty(prefix+"currentPX0",currentPX0+"");
......@@ -407,8 +419,8 @@ public class FocusingField {
properties.setProperty(prefix+"rslt_mtf50_mode",rslt_mtf50_mode+"");
properties.setProperty(prefix+"rslt_solve",rslt_solve+"");
for (int chn=0; chn<rslt_show_chn.length; chn++) properties.setProperty(prefix+"rslt_show_chn_"+chn,rslt_show_chn[chn]+"");
// always re-calculate here? - only in calibration mode or restore calibration mode? No, only in LMA in calibration mode
// zRanges=calcZRanges(dataWeightsToBoolean());
// always re-calculate here? - only in calibration mode or restore calibration mode? No, only in LMA in calibration mode
// zRanges=calcZRanges(dataWeightsToBoolean());
if (zRanges!=null){
properties.setProperty(prefix+"zRanges_length",zRanges.length+"");
for (int chn=0;chn<zRanges.length;chn++) if (zRanges[chn]!=null) {
......@@ -419,6 +431,7 @@ public class FocusingField {
}
}
}
}
public void getProperties(String prefix,Properties properties){
savedProperties=properties;
......@@ -4574,13 +4587,36 @@ public boolean LevenbergMarquardt(
if (debugLevel>1) System.out.println ("Mechanical properties not yet initialized, will save properties later");
return;
}
properties.setProperty(prefix+"numberOfLocations",numberOfLocations+"");
properties.setProperty(prefix+"centerSelect_X",centerSelect[0]+"");
properties.setProperty(prefix+"centerSelect_Y",centerSelect[1]+"");
mechanicalFocusingModel.setProperties(prefix+"mechanicalFocusingModel.",properties);
boolean select= (properties.getProperty("selected")!=null);
boolean select_mechanicalFocusingModel=!select;
boolean select_curvatureModel=!select;
boolean select_fieldStrategies=!select;
boolean select_FieldFitting=!select;
if (select) {
GenericDialog gd = new GenericDialog("Select FieldFitting parameters to save");
gd.addCheckbox("MechanicalFocusingModel parameter class", select_mechanicalFocusingModel);
gd.addCheckbox("CurvatureModel parameter classes", select_curvatureModel);
gd.addCheckbox("FieldStrategies parameter classes", select_fieldStrategies);
gd.addCheckbox("FieldFitting local parameters", select_FieldFitting);
gd.showDialog();
if (gd.wasCanceled()) return;
select_mechanicalFocusingModel=gd.getNextBoolean();
select_curvatureModel=gd.getNextBoolean();
select_fieldStrategies=gd.getNextBoolean();
select_FieldFitting=gd.getNextBoolean();
}
if (select_mechanicalFocusingModel) mechanicalFocusingModel.setProperties(prefix+"mechanicalFocusingModel.",properties);
if (select_curvatureModel) {
for (int i=0;i<curvatureModel.length;i++){
if (curvatureModel[i]!=null) curvatureModel[i].setProperties(prefix+"curvatureModel_"+i+".",properties);
}
}
if (select_FieldFitting) {
properties.setProperty(prefix+"numberOfLocations",numberOfLocations+"");
properties.setProperty(prefix+"centerSelect_X",centerSelect[0]+"");
properties.setProperty(prefix+"centerSelect_Y",centerSelect[1]+"");
if (channelSelect!=null) for (int i=0;i<channelSelect.length;i++){
properties.setProperty(prefix+"channelSelect_"+i,channelSelect[i]+"");
}
......@@ -4603,7 +4639,7 @@ public boolean LevenbergMarquardt(
properties.setProperty(prefix+"sampleCorrPullZero_"+chn+"_"+i,sampleCorrPullZero[chn][i]+"");
}
// save correction parameters values
// private double [][][] correctionParameters=new double[6][][]; // all
// private double [][][] correctionParameters=new double[6][][]; // all
if (correctionParameters!=null){
for (int chn=0;chn<correctionParameters.length; chn++) if (correctionParameters[chn]!=null){
for (int np=0;np<correctionParameters[chn].length;np++) if (correctionParameters[chn][np]!=null){
......@@ -4613,7 +4649,8 @@ public boolean LevenbergMarquardt(
}
}
}
fieldStrategies.setProperties(prefix+"fieldStrategies.",properties);
}
if (select_fieldStrategies) fieldStrategies.setProperties(prefix+"fieldStrategies.",properties);
}
public void getProperties(String prefix,Properties properties){
if (properties.getProperty(prefix+"numberOfLocations")!=null)
......
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