Commit acf7af6f authored by Andrey Filippov's avatar Andrey Filippov

Implemented autoloading files in "restore" command for mixed-resolution

sensors
parent d33f7855
......@@ -2823,6 +2823,7 @@ if (MORE_BUTTONS) {
/* ======================================================================== */
if (label.equals("Reset Sensor")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
ABERRATIONS_PARAMETERS.sensorsPath = ""; // null;
if (LENS_DISTORTIONS==null) {
IJ.showMessage("LENS_DISTORTION is not set");
return;
......@@ -10231,7 +10232,8 @@ if (MORE_BUTTONS) {
}
if ((LENS_DISTORTIONS.fittingStrategy != null) && ABERRATIONS_PARAMETERS.autoFilter) { // trying to fix restore
if (DEBUG_LEVEL>0) System.out.println("LENS_DISTORTIONS.fittingStrategy != null -> Extra after loading");
int minGridsNoPointer=1000;
int minGridsNoPointer=40; // 1000;
System.out.println("Using minGridsNoPointer="+minGridsNoPointer+", TODO: Use pattern grid size fraction?");
int [] numImages=DISTORTION_CALIBRATION_DATA.filterImages(
false, // resetHinted,
0, // 2, // minPointers,
......@@ -10563,7 +10565,7 @@ if (MORE_BUTTONS) {
public boolean restoreFocusingHistory(boolean interactive){
if (!interactive && ((FOCUS_MEASUREMENT_PARAMETERS.focusingHistoryFile==null) || (FOCUS_MEASUREMENT_PARAMETERS.focusingHistoryFile.length()==0))){
System.out.println("*** No focusing history to load!");
System.out.println("*** No focusing history to load! (used only for SFE focusing) ****");
return false;
}
FOCUSING_FIELD=new FocusingField(
......@@ -11050,12 +11052,16 @@ if (MORE_BUTTONS) {
}
distortions.fittingStrategy.debugLevel=debugLevel;
distortions.fittingStrategy.adjustNumberOfImages(dcd.gIP.length);
} else {
System.out.println("No fitting strategy is provided");
}
if (configPaths[2] !=null){ // load grid file
patternParameters.debugLevel=debugLevel;
patternParameters.updateStatus=updateStstus;
if (DEBUG_LEVEL>0) System.out.println("Autolading grid file "+configPaths[2]);
patternParameters.selectAndRestore(true,configPaths[2],dcd.eyesisCameraParameters.numStations); // returns path or null on failure
} else {
System.out.println("No pattern grid file (ground gtruth) is provided");
}
if ((configPaths[3] !=null) && (configPaths[3] != "")){ // load sensor
if (distortions.fittingStrategy==null) return false; // Why?
......@@ -11067,6 +11073,9 @@ if (MORE_BUTTONS) {
aberrationParameters.autoRestoreSensorOverwriteOrientation,
aberrationParameters.autoRestoreSensorOverwriteDistortion
);
System.out.println("... overwriting subcamera parameters");
} else {
System.out.println("No sensor calibration files are provided");
}
return true;
}
......@@ -1573,7 +1573,7 @@ if (sfiles == null) {
firstInterAxisAngle = this.gIS[i].interAxisAngle;
sb.append(i+"\t"+IJ.d2s(this.gIS[i].timeStamp,6));
if (this.eyesisCameraParameters.numStations>1) sb.append(i+"\t"+ this.gIS[i].getStationNumber());
if (this.eyesisCameraParameters.numStations>1) sb.append("\t"+ this.gIS[i].getStationNumber());
sb.append("\t"+(Double.isNaN(this.gIS[i].goniometerAxial)?"---":((this.gIS[i].orientationEstimated?"(":"")+IJ.d2s(axial_corr_sign,3)+(this.gIS[i].orientationEstimated?")":""))));
sb.append("\t"+(Double.isNaN(this.gIS[i].goniometerTilt)?"---":((this.gIS[i].orientationEstimated?"(":"")+IJ.d2s(this.gIS[i].goniometerTilt,3)+(this.gIS[i].orientationEstimated?")":""))));
......@@ -2564,20 +2564,7 @@ if (sfiles == null) {
updateSetOrientation(null); // update orientation of image sets (built in readAllGrids() UPDATE - not anymore)
}
/*
public DistortionCalibrationData(
String pathname,
PatternParameters patternParameters,
EyesisCameraParameters eyesisCameraParameters) {
setFromXML(
pathname,
eyesisCameraParameters);
System.out.println("DistortionCalibrationData("+pathname+",eyesisCameraParameters) 1 -> this.gIS.length="+((this.gIS==null)?"null":this.gIS.length));
readAllGrids(patternParameters); // prepare grid parameters for LMA (now will preserve this.gIS if it is non-null)
System.out.println("DistortionCalibrationData("+pathname+",eyesisCameraParameters) 2 -> this.gIS.length="+((this.gIS==null)?"null":this.gIS.length));
updateSetOrientation(null); // update orientation of image sets (built in readAllGrids())
}
*/
public void setFromXML(String pathname,
EyesisCameraParameters eyesisCameraParameters, // should have cartesian set
EyesisAberrations.AberrationParameters aberrationParameters) {
......@@ -3036,7 +3023,7 @@ if (sfiles == null) {
System.out.println("readAllGrids(), numImages="+numImages+", total number of grid nodes="+numOfGridNodes+", unused nodes "+numOfGridNodes_extra);
}
// probably - do not need to verify that this.gIS is null - should do that anyway. UPDATE: no, now reading config file creates gIS
buildImageSets(this.gIS!=null);
buildImageSets(this.gIS!=null); // with non-null just copies motors from any of the images that has it
return true;
}
......
......@@ -4745,7 +4745,9 @@ if (globalDebugLevel>2)globalDebugLevel=0; //***********************************
return result;
}
public boolean [] getChannelSelection(Distortions distortions){
if (distortions==null) return null;
if ((distortions==null) ||
(distortions.fittingStrategy == null) ||
(distortions.fittingStrategy.distortionCalibrationData == null)) return null;
int numChannels=distortions.fittingStrategy.distortionCalibrationData.getNumChannels(); // number of used channels
if (this.selectedChannels==null) {
this.selectedChannels=new boolean[1];
......@@ -4762,8 +4764,9 @@ if (globalDebugLevel>2)globalDebugLevel=0; //***********************************
}
public boolean selectChannelsToProcess(String title, Distortions distortions) {
boolean [] newSelecttion=getChannelSelection(distortions).clone(); //java.lang.NullPointerException
boolean [] newSelecttion=getChannelSelection(distortions); // .clone(); //java.lang.NullPointerException
if (newSelecttion==null) return false;
newSelecttion = newSelecttion.clone();
int numChannels=newSelecttion.length;
while (true) {
GenericDialog gd = new GenericDialog(title);
......
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