Commit 122aa397 authored by Andrey Filippov's avatar Andrey Filippov

maning manual SFE focusing compatible

parent 7e93745b
...@@ -12003,7 +12003,11 @@ if (MORE_BUTTONS) { ...@@ -12003,7 +12003,11 @@ if (MORE_BUTTONS) {
int loopDebugLevel){ int loopDebugLevel){
boolean noMove=false; boolean noMove=false;
if (newMotorPos==null) { if (newMotorPos==null) {
try {
newMotorPos=focusingMotors.readElphel10364Motors().clone(); newMotorPos=focusingMotors.readElphel10364Motors().clone();
} catch (Exception e){
System.out.println("moveAndMaybeProbe(): Failed to read motors");
}
justMove=true; justMove=true;
noMove=true; noMove=true;
} }
...@@ -12098,7 +12102,11 @@ if (MORE_BUTTONS) { ...@@ -12098,7 +12102,11 @@ if (MORE_BUTTONS) {
// System.out.println(">"+focusingMotors.historySize()+": "+focusingMotors.curpos[0]+", "+focusingMotors.curpos[1]+", "+focusingMotors.curpos[2]); // System.out.println(">"+focusingMotors.historySize()+": "+focusingMotors.curpos[0]+", "+focusingMotors.curpos[1]+", "+focusingMotors.curpos[2]);
boolean noMove=false; boolean noMove=false;
if (newMotorPos==null) { if (newMotorPos==null) {
try {
newMotorPos=focusingMotors.readElphel10364Motors().clone(); newMotorPos=focusingMotors.readElphel10364Motors().clone();
} catch (Exception e){
System.out.println("moveMeasureAndSave(): motors unreachable.");
}
noMove=true; noMove=true;
} }
if (!noMove)focusingMotors.moveElphel10364Motors( if (!noMove)focusingMotors.moveElphel10364Motors(
...@@ -2671,7 +2671,7 @@ public class CalibrationHardwareInterface { ...@@ -2671,7 +2671,7 @@ public class CalibrationHardwareInterface {
} }
boolean result=commandToDevice(command); boolean result=commandToDevice(command);
updateCurrents(); if (result) updateCurrents();
return result; return result;
} }
...@@ -2718,7 +2718,8 @@ public class CalibrationHardwareInterface { ...@@ -2718,7 +2718,8 @@ public class CalibrationHardwareInterface {
String msg = e1.getMessage(); String msg = e1.getMessage();
if (msg==null || msg.equals("")) msg = ""+e1; if (msg==null || msg.equals("")) msg = ""+e1;
IJ.showMessage("Error",msg); IJ.showMessage("Error",msg);
throw new IllegalArgumentException (msg); return false;
// throw new IllegalArgumentException (msg);
}catch(ParserConfigurationException pce) { }catch(ParserConfigurationException pce) {
pce.printStackTrace(); pce.printStackTrace();
return false; return false;
...@@ -3471,7 +3472,9 @@ public class CalibrationHardwareInterface { ...@@ -3471,7 +3472,9 @@ public class CalibrationHardwareInterface {
IJ.showStatus(""); IJ.showStatus("");
String error = e1.getMessage(); String error = e1.getMessage();
if (error==null || error.equals("")) error = ""+e1; if (error==null || error.equals("")) error = ""+e1;
IJ.showMessage("commandElphel10364Motors ERRROR", ""+error); System.out.println("commandElphel10364Motors ERRROR: "+error);
// *********** Temporary removed message box (usually "HOST UNREACHABLE") *************
// IJ.showMessage("commandElphel10364Motors ERRROR", ""+error);
return null; return null;
}catch(ParserConfigurationException pce) { }catch(ParserConfigurationException pce) {
pce.printStackTrace(); pce.printStackTrace();
...@@ -6529,7 +6532,9 @@ if (debugLevel>=debugThreshold) System.out.println(i+" "+diff[0]+" "+diff[1]+" " ...@@ -6529,7 +6532,9 @@ if (debugLevel>=debugThreshold) System.out.println(i+" "+diff[0]+" "+diff[1]+" "
} }
public double distFromProbed(int [] position){ public double distFromProbed(int [] position){
double minDist=Double.NaN; double minDist=Double.NaN;
if (this.history.size() <1) return Double.NaN;
if (position==null) position= this.history.get(this.history.size()-1).motorsPos; if (position==null) position= this.history.get(this.history.size()-1).motorsPos;
if (this.history.size()>0){ if (this.history.size()>0){
for (int i=0;i<this.history.size();i++) if (this.history.get(i).isProbed) { for (int i=0;i<this.history.size();i++) if (this.history.get(i).isProbed) {
int [] probedPosition=this.history.get(i).motorsPos; int [] probedPosition=this.history.get(i).motorsPos;
......
...@@ -1691,16 +1691,26 @@ import org.apache.commons.configuration.XMLConfiguration; ...@@ -1691,16 +1691,26 @@ import org.apache.commons.configuration.XMLConfiguration;
if (gridImages!=null) { if (gridImages!=null) {
// this.pathName=""; // modified, keep the path anyway // this.pathName=""; // modified, keep the path anyway
// overwrite saved paths with the provided images, number of images{ should match // overwrite saved paths with the provided images, number of images{ should match
if (this.gIP.length!=gridImages.length){ if (this.gIP.length == gridImages.length){
String msg="Number of provided images ("+gridImages.length+") does not match parameters restored from the "+pathname+" ("+this.gIP.length+")";
IJ.showMessage("Error",msg);
throw new IllegalArgumentException (msg);
}
for (int i=0;i<this.gIP.length;i++){ for (int i=0;i<this.gIP.length;i++){
this.gIP[i].gridImage=gridImages[i]; this.gIP[i].gridImage=gridImages[i];
this.gIP[i].path=null; // not needed, just in case this.gIP[i].path=null; // not needed, just in case
this.gIP[i].enabled=true;// enable all (actually just one) acquired images this.gIP[i].enabled=true;// enable all (actually just one) acquired images
} }
} else {
String msg="Number of provided images ("+gridImages.length+") does not match parameters restored from the "+pathname+" ("+this.gIP.length+")";
IJ.showMessage("Error",msg);
// throw new IllegalArgumentException (msg);
for (int i=0; i<this.gIP.length ; i++){
this.gIP[i].path=null; // not needed, just in case
this.gIP[i].enabled=true;// enable all (actually just one) acquired images
if (i < gridImages.length) {
this.gIP[i].gridImage=gridImages[i];
} else {
this.gIP[i].gridImage=null;
}
}
}
// setGridImages(gridImages); // setGridImages(gridImages);
} }
readAllGrids(patternParameters); // prepare grid parameters for LMA readAllGrids(patternParameters); // prepare grid parameters for LMA
...@@ -2080,7 +2090,7 @@ import org.apache.commons.configuration.XMLConfiguration; ...@@ -2080,7 +2090,7 @@ import org.apache.commons.configuration.XMLConfiguration;
imp_grid=this.gIP[numGridImg].gridImage; imp_grid=this.gIP[numGridImg].gridImage;
} else { } else {
if (this.updateStatus) IJ.showStatus("Reading grid file "+(fileNumber+1)+" (of "+(numImages)+"): "+this.gIP[fileNumber].path); if (this.updateStatus) IJ.showStatus("Reading grid file "+(fileNumber+1)+" (of "+(numImages)+"): "+this.gIP[fileNumber].path);
if (this.debugLevel>1) System.out.print(fileNumber+" ("+this.gIP[fileNumber].getStationNumber()+"): "+this.gIP[fileNumber].path); if (this.debugLevel>-1) System.out.print(fileNumber+" ("+this.gIP[fileNumber].getStationNumber()+"): "+this.gIP[fileNumber].path);
imp_grid=opener.openImage("", this.gIP[fileNumber].path); // or (path+filenames[nFile]) imp_grid=opener.openImage("", this.gIP[fileNumber].path); // or (path+filenames[nFile])
if (imp_grid==null) { if (imp_grid==null) {
String msg="Failed to read grid file "+this.gIP[fileNumber].path; String msg="Failed to read grid file "+this.gIP[fileNumber].path;
......
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