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

Saving subset of parameters

parent 2f19b216
...@@ -48,6 +48,8 @@ import java.util.regex.Pattern; ...@@ -48,6 +48,8 @@ import java.util.regex.Pattern;
//import FocusingField.FocusingFieldMeasurement; //import FocusingField.FocusingFieldMeasurement;
//import FocusingField.MeasuredSample; //import FocusingField.MeasuredSample;
import Jama.Matrix; // Download here: http://math.nist.gov/javanumerics/jama/ import Jama.Matrix; // Download here: http://math.nist.gov/javanumerics/jama/
...@@ -579,6 +581,7 @@ public static MatchSimulatedPattern.DistortionParameters DISTORTION =new MatchSi ...@@ -579,6 +581,7 @@ public static MatchSimulatedPattern.DistortionParameters DISTORTION =new MatchSi
panelRun.setLayout(new GridLayout(1, 0, 5, 5)); panelRun.setLayout(new GridLayout(1, 0, 5, 5));
addButton("Process Calibration Files",panelRun); addButton("Process Calibration Files",panelRun);
addButton("Save",panelRun); addButton("Save",panelRun);
addButton("Save Selected",panelRun);
addButton("Restore",panelRun,color_restore); addButton("Restore",panelRun,color_restore);
addButton("Restore no autoload",panelRun); addButton("Restore no autoload",panelRun);
addButton("Restore SFE Latest",panelRun,color_restore); addButton("Restore SFE Latest",panelRun,color_restore);
...@@ -1046,11 +1049,18 @@ if (MORE_BUTTONS) { ...@@ -1046,11 +1049,18 @@ if (MORE_BUTTONS) {
String fileName= selectKernelsDirectory(PROCESS_PARAMETERS.kernelsDirectory); String fileName= selectKernelsDirectory(PROCESS_PARAMETERS.kernelsDirectory);
if (fileName!=null) PROCESS_PARAMETERS.kernelsDirectory=fileName; if (fileName!=null) PROCESS_PARAMETERS.kernelsDirectory=fileName;
return; return;
/* ======================================================================== */ /* ======================================================================== */
} else if (label.equals("Save")) { } else if (label.equals("Save")) {
saveProperties(null,PROCESS_PARAMETERS.kernelsDirectory,PROCESS_PARAMETERS.useXML, PROPERTIES); saveProperties(null,PROCESS_PARAMETERS.kernelsDirectory,PROCESS_PARAMETERS.useXML, PROPERTIES);
return; return;
/* ======================================================================== */
} else if (label.equals("Save Selected")) {
Properties selectedProperties=new Properties();
selectedProperties.setProperty("selected", "true");
saveProperties(null,PROCESS_PARAMETERS.kernelsDirectory, PROCESS_PARAMETERS.useXML, selectedProperties);
return;
/* ======================================================================== */ /* ======================================================================== */
} else if (label.equals("Restore") || label.equals("Restore no autoload")) { } else if (label.equals("Restore") || label.equals("Restore no autoload")) {
...@@ -13010,6 +13020,7 @@ private double [][] jacobianByJacobian(double [][] jacobian, boolean [] mask) { ...@@ -13010,6 +13020,7 @@ private double [][] jacobianByJacobian(double [][] jacobian, boolean [] mask) {
} else path+=patterns[0]; } else path+=patterns[0];
if (path==null) return; if (path==null) return;
setAllProperties(properties); setAllProperties(properties);
OutputStream os; OutputStream os;
try { try {
os = new FileOutputStream(path); os = new FileOutputStream(path);
...@@ -13050,6 +13061,7 @@ private double [][] jacobianByJacobian(double [][] jacobian, boolean [] mask) { ...@@ -13050,6 +13061,7 @@ private double [][] jacobianByJacobian(double [][] jacobian, boolean [] mask) {
String directory, String directory,
boolean useXML, boolean useXML,
Properties properties){ Properties properties){
setAllProperties(properties); // NEW. Setting properties from current parameters so missing (in the file) parameters will not cause an error
String [] XMLPatterns= {".conf-xml",".xml"}; String [] XMLPatterns= {".conf-xml",".xml"};
String [] confPatterns={".conf"}; String [] confPatterns={".conf"};
String [] patterns=useXML?XMLPatterns:confPatterns; String [] patterns=useXML?XMLPatterns:confPatterns;
...@@ -13101,42 +13113,159 @@ private double [][] jacobianByJacobian(double [][] jacobian, boolean [] mask) { ...@@ -13101,42 +13113,159 @@ private double [][] jacobianByJacobian(double [][] jacobian, boolean [] mask) {
} }
/* ======================================================================== */ /* ======================================================================== */
public void setAllProperties(Properties properties){ public void setAllProperties(Properties properties){
properties.setProperty("MASTER_DEBUG_LEVEL", MASTER_DEBUG_LEVEL+""); boolean select= (properties.getProperty("selected")!=null);
properties.setProperty("SHOW_AS_STACKS", SHOW_AS_STACKS+"");// Show debug images as stacks (false - individual) boolean select_MASTER_DEBUG_LEVEL=!select;
properties.setProperty("FFT_SIZE", FFT_SIZE+""); boolean select_SHOW_AS_STACKS=!select;
properties.setProperty("MAP_FFT_SIZE", MAP_FFT_SIZE+"");// used to find where grid covers the image boolean select_FFT_SIZE=!select;
properties.setProperty("GAUSS_WIDTH", GAUSS_WIDTH+""); // 0.4 (0 - use Hamming window) boolean select_MAP_FFT_SIZE=!select;
properties.setProperty("FFT_OVERLAP", FFT_OVERLAP+""); // createPSFMap() boolean select_GAUSS_WIDTH=!select;
properties.setProperty("PSF_SUBPIXEL", PSF_SUBPIXEL+""); // sub-pixel decimation boolean select_FFT_OVERLAP=!select;
properties.setProperty("PSF_SAVE_FILE", PSF_SAVE_FILE+"");// save PSF array to a multi-slice TIFF file boolean select_PSF_SUBPIXEL=!select;
properties.setProperty("THREADS_MAX", THREADS_MAX+""); // 100, testing multi-threading, limit maximal number of threads boolean select_PSF_SAVE_FILE=!select;
properties.setProperty("UPDATE_STATUS", UPDATE_STATUS+""); // update ImageJ status info boolean select_THREADS_MAX=!select;
boolean select_UPDATE_STATUS=!select;
SIMUL.setProperties( "SIMUL.", properties); boolean select_SIMUL=!select;
INTERPOLATE.setProperties( "INTERPOLATE.", properties); boolean select_INTERPOLATE=!select;
INVERSE.setProperties( "INVERSE.", properties); boolean select_INVERSE=!select;
PSF_PARS.setProperties( "PSF_PARS.", properties); boolean select_PSF_PARS=!select;
OTF_FILTER.setProperties( "OTF_FILTER.", properties); boolean select_OTF_FILTER=!select;
PATTERN_DETECT.setProperties( "PATTERN_DETECT.", properties); boolean select_PATTERN_DETECT=!select;
COMPONENTS.setProperties( "COMPONENTS.", properties); boolean select_COMPONENTS=!select;
SHOW_RESULTS.setProperties( "SHOW_RESULTS.", properties); boolean select_SHOW_RESULTS=!select;
MULTIFILE_PSF.setProperties( "MULTIFILE_PSF.", properties); boolean select_MULTIFILE_PSF=!select;
PROCESS_PARAMETERS.setProperties("PROCESS_PARAMETERS.", properties); boolean select_PROCESS_PARAMETERS=!select;
DISTORTION.setProperties( "DISTORTION.", properties); boolean select_DISTORTION=!select;
LASER_POINTERS.setProperties("LASER.", properties); boolean select_LASER_POINTERS=!select;
FLATFIELD_PARAMETERS.setProperties("FLATFIELD_PARAMETERS.", properties); boolean select_FLATFIELD_PARAMETERS=!select;
PATTERN_PARAMETERS.setProperties ("PATTERN_PARAMETERS.", properties); boolean select_PATTERN_PARAMETERS=!select;
LENS_DISTORTION_PARAMETERS.setProperties("LENS_DISTORTION_PARAMETERS.", properties); boolean select_LENS_DISTORTION_PARAMETERS=!select;
EYESIS_CAMERA_PARAMETERS.setProperties("EYESIS_CAMERA_PARAMETERS.", properties); boolean select_EYESIS_CAMERA_PARAMETERS=!select;
LASERS.setProperties("LASERS.", properties); boolean select_LASERS=!select;
CAMERAS.setProperties("CAMERAS.", properties); boolean select_CAMERAS=!select;
DISTORTION_PROCESS_CONFIGURATION.setProperties("DISTORTION_PROCESS_CONFIGURATION.", properties); boolean select_DISTORTION_PROCESS_CONFIGURATION=!select;
REFINE_PARAMETERS.setProperties("REFINE_PARAMETERS.", properties); boolean select_REFINE_PARAMETERS=!select;
FOCUS_MEASUREMENT_PARAMETERS.setProperties("FOCUS_MEASUREMENT_PARAMETERS.", properties); boolean select_FOCUS_MEASUREMENT_PARAMETERS=!select;
MOTORS.focusingHistory.setProperties("FOCUSING_HISTORY.", properties); boolean select_MOTORS_focusingHistory=!select;
GONIOMETER_PARAMETERS.setProperties("GONIOMETER_PARAMETERS.", properties); boolean select_GONIOMETER_PARAMETERS=!select;
ABERRATIONS_PARAMETERS.setProperties("ABERRATIONS_PARAMETERS.", properties); boolean select_ABERRATIONS_PARAMETERS=!select;
if (FOCUSING_FIELD!=null) FOCUSING_FIELD.setProperties("FOCUSING_FIELD.", properties); boolean select_FOCUSING_FIELD=!select;
if (select) {
GenericDialog gd = new GenericDialog("Select parameters to save");
gd.addMessage("===== Individual parameters ======");
gd.addCheckbox("MASTER_DEBUG_LEVEL", select_MASTER_DEBUG_LEVEL);
gd.addCheckbox("SHOW_AS_STACKS", select_SHOW_AS_STACKS);
gd.addCheckbox("FFT_SIZE",select_FFT_SIZE);
gd.addCheckbox("MAP_FFT_SIZE",select_MAP_FFT_SIZE);
gd.addCheckbox("GAUSS_WIDTH",select_GAUSS_WIDTH);
gd.addCheckbox("FFT_OVERLAP",select_FFT_OVERLAP);
gd.addCheckbox("PSF_SUBPIXEL",select_PSF_SUBPIXEL);
gd.addCheckbox("PSF_SAVE_FILE",select_PSF_SAVE_FILE);
gd.addCheckbox("THREADS_MAX",select_THREADS_MAX);
gd.addCheckbox("UPDATE_STATUS",select_UPDATE_STATUS);
gd.addMessage("===== Parameter classes ======");
gd.addCheckbox("SIMUL",select_SIMUL);
gd.addCheckbox("INTERPOLATE",select_INTERPOLATE);
gd.addCheckbox("INVERSE",select_INVERSE);
gd.addCheckbox("PSF_PARS",select_PSF_PARS);
gd.addCheckbox("OTF_FILTER",select_OTF_FILTER);
gd.addCheckbox("PATTERN_DETECT",select_PATTERN_DETECT);
gd.addCheckbox("COMPONENTS",select_COMPONENTS);
gd.addCheckbox("SHOW_RESULTS",select_SHOW_RESULTS);
gd.addCheckbox("MULTIFILE_PSF",select_MULTIFILE_PSF);
gd.addCheckbox("PROCESS_PARAMETERS",select_PROCESS_PARAMETERS);
gd.addCheckbox("DISTORTION",select_DISTORTION);
gd.addCheckbox("LASER_POINTERS",select_LASER_POINTERS);
gd.addCheckbox("FLATFIELD_PARAMETERS",select_FLATFIELD_PARAMETERS);
gd.addCheckbox("PATTERN_PARAMETERS",select_PATTERN_PARAMETERS);
gd.addCheckbox("LENS_DISTORTION_PARAMETERS",select_LENS_DISTORTION_PARAMETERS);
gd.addCheckbox("EYESIS_CAMERA_PARAMETERS",select_EYESIS_CAMERA_PARAMETERS);
gd.addCheckbox("LASERS",select_LASERS);
gd.addCheckbox("CAMERAS",select_CAMERAS);
gd.addCheckbox("DISTORTION_PROCESS_CONFIGURATION",select_DISTORTION_PROCESS_CONFIGURATION);
gd.addCheckbox("REFINE_PARAMETERS",select_REFINE_PARAMETERS);
gd.addCheckbox("FOCUS_MEASUREMENT_PARAMETERS",select_FOCUS_MEASUREMENT_PARAMETERS);
gd.addCheckbox("MOTORS_focusingHistory",select_MOTORS_focusingHistory);
gd.addCheckbox("GONIOMETER_PARAMETERS",select_GONIOMETER_PARAMETERS);
gd.addCheckbox("ABERRATIONS_PARAMETERS",select_ABERRATIONS_PARAMETERS);
gd.addCheckbox("FOCUSING_FIELD",select_FOCUSING_FIELD);
WindowTools.addScrollBars(gd);
gd.showDialog();
if (gd.wasCanceled()) return;
select_MASTER_DEBUG_LEVEL=gd.getNextBoolean();
select_SHOW_AS_STACKS=gd.getNextBoolean();
select_FFT_SIZE=gd.getNextBoolean();
select_MAP_FFT_SIZE=gd.getNextBoolean();
select_GAUSS_WIDTH=gd.getNextBoolean();
select_FFT_OVERLAP=gd.getNextBoolean();
select_PSF_SUBPIXEL=gd.getNextBoolean();
select_PSF_SAVE_FILE=gd.getNextBoolean();
select_THREADS_MAX=gd.getNextBoolean();
select_UPDATE_STATUS=gd.getNextBoolean();
select_SIMUL=gd.getNextBoolean();
select_INTERPOLATE=gd.getNextBoolean();
select_INVERSE=gd.getNextBoolean();
select_PSF_PARS=gd.getNextBoolean();
select_OTF_FILTER=gd.getNextBoolean();
select_PATTERN_DETECT=gd.getNextBoolean();
select_COMPONENTS=gd.getNextBoolean();
select_SHOW_RESULTS=gd.getNextBoolean();
select_MULTIFILE_PSF=gd.getNextBoolean();
select_PROCESS_PARAMETERS=gd.getNextBoolean();
select_DISTORTION=gd.getNextBoolean();
select_LASER_POINTERS=gd.getNextBoolean();
select_FLATFIELD_PARAMETERS=gd.getNextBoolean();
select_PATTERN_PARAMETERS=gd.getNextBoolean();
select_LENS_DISTORTION_PARAMETERS=gd.getNextBoolean();
select_EYESIS_CAMERA_PARAMETERS=gd.getNextBoolean();
select_LASERS=gd.getNextBoolean();
select_CAMERAS=gd.getNextBoolean();
select_DISTORTION_PROCESS_CONFIGURATION=gd.getNextBoolean();
select_REFINE_PARAMETERS=gd.getNextBoolean();
select_FOCUS_MEASUREMENT_PARAMETERS=gd.getNextBoolean();
select_MOTORS_focusingHistory=gd.getNextBoolean();
select_GONIOMETER_PARAMETERS=gd.getNextBoolean();
select_ABERRATIONS_PARAMETERS=gd.getNextBoolean();
select_FOCUSING_FIELD=gd.getNextBoolean();
}
if (select_MASTER_DEBUG_LEVEL) properties.setProperty("MASTER_DEBUG_LEVEL", MASTER_DEBUG_LEVEL+"");
if (select_SHOW_AS_STACKS) properties.setProperty("SHOW_AS_STACKS", SHOW_AS_STACKS+"");// Show debug images as stacks (false - individual)
if (select_FFT_SIZE) properties.setProperty("FFT_SIZE", FFT_SIZE+"");
if (select_MAP_FFT_SIZE) properties.setProperty("MAP_FFT_SIZE", MAP_FFT_SIZE+"");// used to find where grid covers the image
if (select_GAUSS_WIDTH) properties.setProperty("GAUSS_WIDTH", GAUSS_WIDTH+""); // 0.4 (0 - use Hamming window)
if (select_FFT_OVERLAP) properties.setProperty("FFT_OVERLAP", FFT_OVERLAP+""); // createPSFMap()
if (select_PSF_SUBPIXEL) properties.setProperty("PSF_SUBPIXEL", PSF_SUBPIXEL+""); // sub-pixel decimation
if (select_PSF_SAVE_FILE) properties.setProperty("PSF_SAVE_FILE", PSF_SAVE_FILE+"");// save PSF array to a multi-slice TIFF file
if (select_THREADS_MAX) properties.setProperty("THREADS_MAX", THREADS_MAX+""); // 100, testing multi-threading, limit maximal number of threads
if (select_UPDATE_STATUS) properties.setProperty("UPDATE_STATUS", UPDATE_STATUS+""); // update ImageJ status info
if (select_SIMUL) SIMUL.setProperties( "SIMUL.", properties);
if (select_INTERPOLATE) INTERPOLATE.setProperties( "INTERPOLATE.", properties);
if (select_INVERSE) INVERSE.setProperties( "INVERSE.", properties);
if (select_PSF_PARS) PSF_PARS.setProperties( "PSF_PARS.", properties);
if (select_OTF_FILTER) OTF_FILTER.setProperties( "OTF_FILTER.", properties);
if (select_PATTERN_DETECT) PATTERN_DETECT.setProperties( "PATTERN_DETECT.", properties);
if (select_COMPONENTS) COMPONENTS.setProperties( "COMPONENTS.", properties);
if (select_SHOW_RESULTS) SHOW_RESULTS.setProperties( "SHOW_RESULTS.", properties);
if (select_MULTIFILE_PSF) MULTIFILE_PSF.setProperties( "MULTIFILE_PSF.", properties);
if (select_PROCESS_PARAMETERS) PROCESS_PARAMETERS.setProperties("PROCESS_PARAMETERS.", properties);
if (select_DISTORTION) DISTORTION.setProperties( "DISTORTION.", properties);
if (select_LASER_POINTERS) LASER_POINTERS.setProperties("LASER.", properties);
if (select_FLATFIELD_PARAMETERS) FLATFIELD_PARAMETERS.setProperties("FLATFIELD_PARAMETERS.", properties);
if (select_PATTERN_PARAMETERS) PATTERN_PARAMETERS.setProperties ("PATTERN_PARAMETERS.", properties);
if (select_LENS_DISTORTION_PARAMETERS) LENS_DISTORTION_PARAMETERS.setProperties("LENS_DISTORTION_PARAMETERS.", properties);
if (select_EYESIS_CAMERA_PARAMETERS) EYESIS_CAMERA_PARAMETERS.setProperties("EYESIS_CAMERA_PARAMETERS.", properties);
if (select_LASERS) LASERS.setProperties("LASERS.", properties);
if (select_CAMERAS) CAMERAS.setProperties("CAMERAS.", properties);
if (select_DISTORTION_PROCESS_CONFIGURATION) DISTORTION_PROCESS_CONFIGURATION.setProperties("DISTORTION_PROCESS_CONFIGURATION.", properties);
if (select_REFINE_PARAMETERS) REFINE_PARAMETERS.setProperties("REFINE_PARAMETERS.", properties);
if (select_FOCUS_MEASUREMENT_PARAMETERS) FOCUS_MEASUREMENT_PARAMETERS.setProperties("FOCUS_MEASUREMENT_PARAMETERS.", properties);
if (select_MOTORS_focusingHistory) MOTORS.focusingHistory.setProperties("FOCUSING_HISTORY.", properties);
if (select_GONIOMETER_PARAMETERS) GONIOMETER_PARAMETERS.setProperties("GONIOMETER_PARAMETERS.", properties);
if (select_ABERRATIONS_PARAMETERS) ABERRATIONS_PARAMETERS.setProperties("ABERRATIONS_PARAMETERS.", properties);
if ((select_FOCUSING_FIELD) && (FOCUSING_FIELD!=null)) FOCUSING_FIELD.setProperties("FOCUSING_FIELD.", properties);
if (select) properties.remove("selected");
} }
/* ======================================================================== */ /* ======================================================================== */
public void getAllProperties(Properties properties){ public void getAllProperties(Properties properties){
......
...@@ -333,92 +333,105 @@ public class FocusingField { ...@@ -333,92 +333,105 @@ public class FocusingField {
} }
public void setProperties(String prefix,Properties properties){
if (debugLevel>1) System.out.println("FocusingField: setProperties()");
if (fieldFitting == null) {
System.out.println("fieldFitting is not initialized, nothing to save");
return;
}
fieldFitting.setProperties(prefix+"fieldFitting.",properties); public void setProperties(String prefix,Properties properties){
properties.setProperty(prefix+"pX0_distortions",pX0_distortions+""); if (debugLevel>1) System.out.println("FocusingField: setProperties()");
properties.setProperty(prefix+"pY0_distortions",pY0_distortions+""); if (fieldFitting == null) {
properties.setProperty(prefix+"currentPX0",currentPX0+""); System.out.println("fieldFitting is not initialized, nothing to save");
properties.setProperty(prefix+"currentPY0",currentPY0+""); return;
properties.setProperty(prefix+"sagittalMaster",sagittalMaster+""); }
properties.setProperty(prefix+"parallelOnly",parallelOnly+""); boolean select= (properties.getProperty("selected")!=null);
properties.setProperty(prefix+"filterInput",filterInput+""); boolean select_fieldFitting=!select;
properties.setProperty(prefix+"filterInputMotorDiff",filterInputMotorDiff+""); boolean select_FOCUSING_FIELD=!select;
properties.setProperty(prefix+"filterInputDiff",filterInputDiff+""); if (select) {
properties.setProperty(prefix+"filterInputFirstLast",filterInputFirstLast+""); GenericDialog gd = new GenericDialog("Select FocusingField parameters to save");
properties.setProperty(prefix+"filterInputTooFar",filterInputTooFar+""); gd.addCheckbox("FieldFitting parameter class", select_fieldFitting);
properties.setProperty(prefix+"filterInputFarRatio",filterInputFarRatio+""); gd.addCheckbox("FocusingField local parameters", select_FOCUSING_FIELD);
properties.setProperty(prefix+"filterInputConcave",filterInputConcave+""); gd.showDialog();
properties.setProperty(prefix+"filterInputConcaveSigma",filterInputConcaveSigma+""); if (gd.wasCanceled()) return;
properties.setProperty(prefix+"filterInputConcaveRemoveFew",filterInputConcaveRemoveFew+""); select_fieldFitting=gd.getNextBoolean();
properties.setProperty(prefix+"filterInputConcaveMinSeries",filterInputConcaveMinSeries+""); select_FOCUSING_FIELD=gd.getNextBoolean();
properties.setProperty(prefix+"filterInputConcaveScale",filterInputConcaveScale+""); }
properties.setProperty(prefix+"filterZ",filterZ+""); if (select_fieldFitting) fieldFitting.setProperties(prefix+"fieldFitting.",properties);
properties.setProperty(prefix+"filterTiltedZ",filterTiltedZ+""); if (select_FOCUSING_FIELD){
properties.setProperty(prefix+"filterByValueScale",filterByValueScale+""); properties.setProperty(prefix+"pX0_distortions",pX0_distortions+"");
properties.setProperty(prefix+"filterTiltedByValueScale",filterTiltedByValueScale+""); properties.setProperty(prefix+"pY0_distortions",pY0_distortions+"");
properties.setProperty(prefix+"filterByScanValue",filterByScanValue+""); properties.setProperty(prefix+"currentPX0",currentPX0+"");
properties.setProperty(prefix+"filterTiltedByScanValue",filterTiltedByScanValue+""); properties.setProperty(prefix+"currentPY0",currentPY0+"");
properties.setProperty(prefix+"minLeftSamples",minLeftSamples+""); properties.setProperty(prefix+"sagittalMaster",sagittalMaster+"");
properties.setProperty(prefix+"minCenterSamplesBest",minCenterSamplesBest+""); properties.setProperty(prefix+"parallelOnly",parallelOnly+"");
properties.setProperty(prefix+"minCenterSamplesTotal",minCenterSamplesTotal+""); properties.setProperty(prefix+"filterInput",filterInput+"");
properties.setProperty(prefix+"centerSamples",centerSamples+""); properties.setProperty(prefix+"filterInputMotorDiff",filterInputMotorDiff+"");
properties.setProperty(prefix+"maxRMS",maxRMS+""); properties.setProperty(prefix+"filterInputDiff",filterInputDiff+"");
properties.setProperty(prefix+"zMin",zMin+""); properties.setProperty(prefix+"filterInputFirstLast",filterInputFirstLast+"");
properties.setProperty(prefix+"zMax",zMax+""); properties.setProperty(prefix+"filterInputTooFar",filterInputTooFar+"");
properties.setProperty(prefix+"zStep",zStep+""); properties.setProperty(prefix+"filterInputFarRatio",filterInputFarRatio+"");
properties.setProperty(prefix+"tMin",tMin+""); properties.setProperty(prefix+"filterInputConcave",filterInputConcave+"");
properties.setProperty(prefix+"tMax",tMax+""); properties.setProperty(prefix+"filterInputConcaveSigma",filterInputConcaveSigma+"");
properties.setProperty(prefix+"tStep",tStep+""); properties.setProperty(prefix+"filterInputConcaveRemoveFew",filterInputConcaveRemoveFew+"");
properties.setProperty(prefix+"filterInputConcaveMinSeries",filterInputConcaveMinSeries+"");
properties.setProperty(prefix+"targetRelFocalShift",targetRelFocalShift+""); properties.setProperty(prefix+"filterInputConcaveScale",filterInputConcaveScale+"");
for (int chn=0; chn<minMeas.length; chn++) properties.setProperty(prefix+"minMeas_"+chn,minMeas[chn]+""); properties.setProperty(prefix+"filterZ",filterZ+"");
for (int chn=0; chn<maxMeas.length; chn++) properties.setProperty(prefix+"maxMeas_"+chn,maxMeas[chn]+""); properties.setProperty(prefix+"filterTiltedZ",filterTiltedZ+"");
for (int chn=0; chn<thresholdMax.length; chn++) properties.setProperty(prefix+"thresholdMax_"+chn,thresholdMax[chn]+""); properties.setProperty(prefix+"filterByValueScale",filterByValueScale+"");
properties.setProperty(prefix+"useMinMeas",useMinMeas+""); properties.setProperty(prefix+"filterTiltedByValueScale",filterTiltedByValueScale+"");
properties.setProperty(prefix+"useMaxMeas",useMaxMeas+""); properties.setProperty(prefix+"filterByScanValue",filterByScanValue+"");
properties.setProperty(prefix+"useThresholdMax",useThresholdMax+""); properties.setProperty(prefix+"filterTiltedByScanValue",filterTiltedByScanValue+"");
properties.setProperty(prefix+"weightMode",weightMode+""); properties.setProperty(prefix+"minLeftSamples",minLeftSamples+"");
properties.setProperty(prefix+"weightRadius",weightRadius+""); properties.setProperty(prefix+"minCenterSamplesBest",minCenterSamplesBest+"");
properties.setProperty(prefix+"k_red",k_red+""); properties.setProperty(prefix+"minCenterSamplesTotal",minCenterSamplesTotal+"");
properties.setProperty(prefix+"k_blue",k_blue+""); properties.setProperty(prefix+"centerSamples",centerSamples+"");
properties.setProperty(prefix+"qb_scan_below",qb_scan_below+""); properties.setProperty(prefix+"maxRMS",maxRMS+"");
properties.setProperty(prefix+"qb_scan_above",qb_scan_above+""); properties.setProperty(prefix+"zMin",zMin+"");
properties.setProperty(prefix+"qb_scan_step",qb_scan_step+""); properties.setProperty(prefix+"zMax",zMax+"");
properties.setProperty(prefix+"qb_use_corrected",qb_use_corrected+""); properties.setProperty(prefix+"zStep",zStep+"");
properties.setProperty(prefix+"qb_invert",qb_invert+""); properties.setProperty(prefix+"tMin",tMin+"");
properties.setProperty(prefix+"z_relative",z_relative+""); properties.setProperty(prefix+"tMax",tMax+"");
properties.setProperty(prefix+"rslt_show_z_axial",rslt_show_z_axial+""); properties.setProperty(prefix+"tStep",tStep+"");
properties.setProperty(prefix+"rslt_show_z_smooth",rslt_show_z_smooth+"");
properties.setProperty(prefix+"rslt_show_z_individual",rslt_show_z_individual+""); properties.setProperty(prefix+"targetRelFocalShift",targetRelFocalShift+"");
properties.setProperty(prefix+"rslt_show_f_axial",rslt_show_f_axial+""); for (int chn=0; chn<minMeas.length; chn++) properties.setProperty(prefix+"minMeas_"+chn,minMeas[chn]+"");
properties.setProperty(prefix+"rslt_show_f_smooth",rslt_show_f_smooth+""); for (int chn=0; chn<maxMeas.length; chn++) properties.setProperty(prefix+"maxMeas_"+chn,maxMeas[chn]+"");
properties.setProperty(prefix+"rslt_show_f_individual",rslt_show_f_individual+""); for (int chn=0; chn<thresholdMax.length; chn++) properties.setProperty(prefix+"thresholdMax_"+chn,thresholdMax[chn]+"");
properties.setProperty(prefix+"rslt_show_smooth_sigma",rslt_show_smooth_sigma+""); properties.setProperty(prefix+"useMinMeas",useMinMeas+"");
properties.setProperty(prefix+"rslt_scan_below",rslt_scan_below+""); properties.setProperty(prefix+"useMaxMeas",useMaxMeas+"");
properties.setProperty(prefix+"rslt_scan_above",rslt_scan_above+""); properties.setProperty(prefix+"useThresholdMax",useThresholdMax+"");
properties.setProperty(prefix+"rslt_scan_step",rslt_scan_step+""); properties.setProperty(prefix+"weightMode",weightMode+"");
properties.setProperty(prefix+"rslt_mtf50_mode",rslt_mtf50_mode+""); properties.setProperty(prefix+"weightRadius",weightRadius+"");
properties.setProperty(prefix+"rslt_solve",rslt_solve+""); properties.setProperty(prefix+"k_red",k_red+"");
for (int chn=0; chn<rslt_show_chn.length; chn++) properties.setProperty(prefix+"rslt_show_chn_"+chn,rslt_show_chn[chn]+""); properties.setProperty(prefix+"k_blue",k_blue+"");
// always re-calculate here? - only in calibration mode or restore calibration mode? No, only in LMA in calibration mode properties.setProperty(prefix+"qb_scan_below",qb_scan_below+"");
// zRanges=calcZRanges(dataWeightsToBoolean()); properties.setProperty(prefix+"qb_scan_above",qb_scan_above+"");
if (zRanges!=null){ properties.setProperty(prefix+"qb_scan_step",qb_scan_step+"");
properties.setProperty(prefix+"zRanges_length",zRanges.length+""); properties.setProperty(prefix+"qb_use_corrected",qb_use_corrected+"");
for (int chn=0;chn<zRanges.length;chn++) if (zRanges[chn]!=null) { properties.setProperty(prefix+"qb_invert",qb_invert+"");
properties.setProperty(prefix+"zRanges_"+chn+"_length",zRanges[chn].length+""); properties.setProperty(prefix+"z_relative",z_relative+"");
for (int sample=0;sample<zRanges[chn].length;sample++) if (zRanges[chn][sample]!=null) { properties.setProperty(prefix+"rslt_show_z_axial",rslt_show_z_axial+"");
properties.setProperty(prefix+"zRanges_"+chn+"_"+sample,zRanges[chn][sample][0]+","+zRanges[chn][sample][1]+","+zRanges[chn][sample][2]); properties.setProperty(prefix+"rslt_show_z_smooth",rslt_show_z_smooth+"");
} properties.setProperty(prefix+"rslt_show_z_individual",rslt_show_z_individual+"");
} properties.setProperty(prefix+"rslt_show_f_axial",rslt_show_f_axial+"");
} properties.setProperty(prefix+"rslt_show_f_smooth",rslt_show_f_smooth+"");
} properties.setProperty(prefix+"rslt_show_f_individual",rslt_show_f_individual+"");
properties.setProperty(prefix+"rslt_show_smooth_sigma",rslt_show_smooth_sigma+"");
properties.setProperty(prefix+"rslt_scan_below",rslt_scan_below+"");
properties.setProperty(prefix+"rslt_scan_above",rslt_scan_above+"");
properties.setProperty(prefix+"rslt_scan_step",rslt_scan_step+"");
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());
if (zRanges!=null){
properties.setProperty(prefix+"zRanges_length",zRanges.length+"");
for (int chn=0;chn<zRanges.length;chn++) if (zRanges[chn]!=null) {
properties.setProperty(prefix+"zRanges_"+chn+"_length",zRanges[chn].length+"");
for (int sample=0;sample<zRanges[chn].length;sample++) if (zRanges[chn][sample]!=null) {
properties.setProperty(prefix+"zRanges_"+chn+"_"+sample,zRanges[chn][sample][0]+","+zRanges[chn][sample][1]+","+zRanges[chn][sample][2]);
}
}
}
}
}
public void getProperties(String prefix,Properties properties){ public void getProperties(String prefix,Properties properties){
savedProperties=properties; savedProperties=properties;
...@@ -4569,52 +4582,76 @@ public boolean LevenbergMarquardt( ...@@ -4569,52 +4582,76 @@ public boolean LevenbergMarquardt(
"Green, sagittal","Green, tangential", "Green, sagittal","Green, tangential",
"Blue, sagittal","Blue, tangential"}; "Blue, sagittal","Blue, tangential"};
public void setProperties(String prefix,Properties properties){ public void setProperties(String prefix,Properties properties){
if (mechanicalFocusingModel==null){ if (mechanicalFocusingModel==null){
if (debugLevel>1) System.out.println ("Mechanical properties not yet initialized, will save properties later"); if (debugLevel>1) System.out.println ("Mechanical properties not yet initialized, will save properties later");
return; return;
} }
properties.setProperty(prefix+"numberOfLocations",numberOfLocations+""); boolean select= (properties.getProperty("selected")!=null);
properties.setProperty(prefix+"centerSelect_X",centerSelect[0]+""); boolean select_mechanicalFocusingModel=!select;
properties.setProperty(prefix+"centerSelect_Y",centerSelect[1]+""); boolean select_curvatureModel=!select;
mechanicalFocusingModel.setProperties(prefix+"mechanicalFocusingModel.",properties); boolean select_fieldStrategies=!select;
for (int i=0;i<curvatureModel.length;i++){ boolean select_FieldFitting=!select;
if (curvatureModel[i]!=null) curvatureModel[i].setProperties(prefix+"curvatureModel_"+i+".",properties); if (select) {
} GenericDialog gd = new GenericDialog("Select FieldFitting parameters to save");
if (channelSelect!=null) for (int i=0;i<channelSelect.length;i++){ gd.addCheckbox("MechanicalFocusingModel parameter class", select_mechanicalFocusingModel);
properties.setProperty(prefix+"channelSelect_"+i,channelSelect[i]+""); gd.addCheckbox("CurvatureModel parameter classes", select_curvatureModel);
} gd.addCheckbox("FieldStrategies parameter classes", select_fieldStrategies);
if (mechanicalSelect!=null) for (int i=0;i<mechanicalSelect.length;i++){ gd.addCheckbox("FieldFitting local parameters", select_FieldFitting);
properties.setProperty(prefix+"mechanicalSelect_"+i,mechanicalSelect[i]+""); gd.showDialog();
} if (gd.wasCanceled()) return;
for (int chn=0;chn<curvatureSelect.length;chn++) if (curvatureSelect[chn]!=null) for (int i=0;i<curvatureSelect[chn].length;i++){ select_mechanicalFocusingModel=gd.getNextBoolean();
properties.setProperty(prefix+"curvatureSelect_"+chn+"_"+i,curvatureSelect[chn][i]+""); select_curvatureModel=gd.getNextBoolean();
} select_fieldStrategies=gd.getNextBoolean();
for (int chn=0;chn<sampleCorrSelect.length;chn++) if (sampleCorrSelect[chn]!=null) for (int i=0;i<sampleCorrSelect[chn].length;i++){ select_FieldFitting=gd.getNextBoolean();
properties.setProperty(prefix+"sampleCorrSelect_"+chn+"_"+i,sampleCorrSelect[chn][i]+""); }
}
for (int chn=0;chn<sampleCorrCost.length;chn++) if (sampleCorrCost[chn]!=null) for (int i=0;i<sampleCorrCost[chn].length;i++){ if (select_mechanicalFocusingModel) mechanicalFocusingModel.setProperties(prefix+"mechanicalFocusingModel.",properties);
properties.setProperty(prefix+"sampleCorrCost_"+chn+"_"+i,sampleCorrCost[chn][i]+""); if (select_curvatureModel) {
} for (int i=0;i<curvatureModel.length;i++){
for (int chn=0;chn<sampleCorrSigma.length;chn++) if (sampleCorrSigma[chn]!=null) for (int i=0;i<sampleCorrSigma[chn].length;i++){ if (curvatureModel[i]!=null) curvatureModel[i].setProperties(prefix+"curvatureModel_"+i+".",properties);
properties.setProperty(prefix+"sampleCorrSigma_"+chn+"_"+i,sampleCorrSigma[chn][i]+""); }
} }
for (int chn=0;chn<sampleCorrPullZero.length;chn++) if (sampleCorrPullZero[chn]!=null) for (int i=0;i<sampleCorrPullZero[chn].length;i++){ if (select_FieldFitting) {
properties.setProperty(prefix+"sampleCorrPullZero_"+chn+"_"+i,sampleCorrPullZero[chn][i]+""); properties.setProperty(prefix+"numberOfLocations",numberOfLocations+"");
} properties.setProperty(prefix+"centerSelect_X",centerSelect[0]+"");
// save correction parameters values properties.setProperty(prefix+"centerSelect_Y",centerSelect[1]+"");
// private double [][][] correctionParameters=new double[6][][]; // all
if (correctionParameters!=null){ if (channelSelect!=null) for (int i=0;i<channelSelect.length;i++){
for (int chn=0;chn<correctionParameters.length; chn++) if (correctionParameters[chn]!=null){ properties.setProperty(prefix+"channelSelect_"+i,channelSelect[i]+"");
for (int np=0;np<correctionParameters[chn].length;np++) if (correctionParameters[chn][np]!=null){ }
for (int i=0;i<correctionParameters[chn][np].length;i++){ if (mechanicalSelect!=null) for (int i=0;i<mechanicalSelect.length;i++){
properties.setProperty(prefix+"correctionParameters_"+chn+"_"+np+"_"+i,correctionParameters[chn][np][i]+""); properties.setProperty(prefix+"mechanicalSelect_"+i,mechanicalSelect[i]+"");
} }
} for (int chn=0;chn<curvatureSelect.length;chn++) if (curvatureSelect[chn]!=null) for (int i=0;i<curvatureSelect[chn].length;i++){
} properties.setProperty(prefix+"curvatureSelect_"+chn+"_"+i,curvatureSelect[chn][i]+"");
} }
fieldStrategies.setProperties(prefix+"fieldStrategies.",properties); for (int chn=0;chn<sampleCorrSelect.length;chn++) if (sampleCorrSelect[chn]!=null) for (int i=0;i<sampleCorrSelect[chn].length;i++){
} properties.setProperty(prefix+"sampleCorrSelect_"+chn+"_"+i,sampleCorrSelect[chn][i]+"");
}
for (int chn=0;chn<sampleCorrCost.length;chn++) if (sampleCorrCost[chn]!=null) for (int i=0;i<sampleCorrCost[chn].length;i++){
properties.setProperty(prefix+"sampleCorrCost_"+chn+"_"+i,sampleCorrCost[chn][i]+"");
}
for (int chn=0;chn<sampleCorrSigma.length;chn++) if (sampleCorrSigma[chn]!=null) for (int i=0;i<sampleCorrSigma[chn].length;i++){
properties.setProperty(prefix+"sampleCorrSigma_"+chn+"_"+i,sampleCorrSigma[chn][i]+"");
}
for (int chn=0;chn<sampleCorrPullZero.length;chn++) if (sampleCorrPullZero[chn]!=null) for (int i=0;i<sampleCorrPullZero[chn].length;i++){
properties.setProperty(prefix+"sampleCorrPullZero_"+chn+"_"+i,sampleCorrPullZero[chn][i]+"");
}
// save correction parameters values
// 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){
for (int i=0;i<correctionParameters[chn][np].length;i++){
properties.setProperty(prefix+"correctionParameters_"+chn+"_"+np+"_"+i,correctionParameters[chn][np][i]+"");
}
}
}
}
}
if (select_fieldStrategies) fieldStrategies.setProperties(prefix+"fieldStrategies.",properties);
}
public void getProperties(String prefix,Properties properties){ public void getProperties(String prefix,Properties properties){
if (properties.getProperty(prefix+"numberOfLocations")!=null) if (properties.getProperty(prefix+"numberOfLocations")!=null)
numberOfLocations=Integer.parseInt(properties.getProperty(prefix+"numberOfLocations")); numberOfLocations=Integer.parseInt(properties.getProperty(prefix+"numberOfLocations"));
...@@ -7124,8 +7161,8 @@ f_corr: d_fcorr/d_zcorr=0, other: a, reff, kx -> ar[1], ar[2], ar[3], ar[4] ...@@ -7124,8 +7161,8 @@ f_corr: d_fcorr/d_zcorr=0, other: a, reff, kx -> ar[1], ar[2], ar[3], ar[4]
} }
gd.enableYesNoCancel("Apply","Keep"); // default OK (on enter) - "Apply" gd.enableYesNoCancel("Apply","Keep"); // default OK (on enter) - "Apply"
WindowTools.addScrollBars(gd); WindowTools.addScrollBars(gd);
gd.showDialog(); gd.showDialog();
if (gd.wasCanceled()) return null; if (gd.wasCanceled()) return null;
if (gd.wasOKed()) { // selected non-default "Apply" if (gd.wasOKed()) { // selected non-default "Apply"
if (detailed){ if (detailed){
......
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