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

maning manual SFE focusing compatible

parent 7e93745b
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -12003,7 +12003,11 @@ if (MORE_BUTTONS) {
			int       loopDebugLevel){
		boolean noMove=false;
		if (newMotorPos==null) {
			try {
				newMotorPos=focusingMotors.readElphel10364Motors().clone();
			} catch (Exception e){
				System.out.println("moveAndMaybeProbe(): Failed to read motors");
			}
			justMove=true;
			noMove=true;
		}
@@ -12098,7 +12102,11 @@ if (MORE_BUTTONS) {
//		System.out.println(">"+focusingMotors.historySize()+": "+focusingMotors.curpos[0]+", "+focusingMotors.curpos[1]+", "+focusingMotors.curpos[2]);
		boolean noMove=false;
		if (newMotorPos==null) {
			try {
				newMotorPos=focusingMotors.readElphel10364Motors().clone();
			} catch (Exception e){
				System.out.println("moveMeasureAndSave(): motors unreachable.");
			}
			noMove=true;
		}
		if (!noMove)focusingMotors.moveElphel10364Motors(
+8 −3
Original line number Diff line number Diff line
@@ -2671,7 +2671,7 @@ public class CalibrationHardwareInterface {
    		}
    		
    		boolean result=commandToDevice(command);
    		updateCurrents();
    		if (result)	updateCurrents();
    		return result;

    	}
@@ -2718,7 +2718,8 @@ public class CalibrationHardwareInterface {
    				String msg = e1.getMessage();
    				if (msg==null || msg.equals(""))  msg = ""+e1;
					IJ.showMessage("Error",msg); 
					throw new IllegalArgumentException (msg);
					return false;
//					throw new IllegalArgumentException (msg);
    			}catch(ParserConfigurationException pce) {
    				pce.printStackTrace();
    				return false;
@@ -3471,7 +3472,9 @@ public class CalibrationHardwareInterface {
    		IJ.showStatus("");
    		String error = e1.getMessage();
    		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;
    	}catch(ParserConfigurationException pce) {
    		pce.printStackTrace();
@@ -6529,7 +6532,9 @@ if (debugLevel>=debugThreshold) System.out.println(i+" "+diff[0]+" "+diff[1]+" "
    	}
    	public double distFromProbed(int [] position){
    		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 (this.history.size()>0){
    			for (int i=0;i<this.history.size();i++) if (this.history.get(i).isProbed) {
    				int [] probedPosition=this.history.get(i).motorsPos;
+18 −8
Original line number Diff line number Diff line
@@ -1691,15 +1691,25 @@ import org.apache.commons.configuration.XMLConfiguration;
			if (gridImages!=null) {
//				this.pathName="";  // modified, keep the path anyway
// overwrite saved paths with the provided images, number of images{ should match
				if (this.gIP.length!=gridImages.length){
				if (this.gIP.length == gridImages.length){
					for (int i=0;i<this.gIP.length;i++){
						this.gIP[i].gridImage=gridImages[i];
						this.gIP[i].path=null; // not needed, just in case
						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);
				}
//		    		throw new IllegalArgumentException (msg);
					for (int i=0; i<this.gIP.length ; i++){
					this.gIP[i].gridImage=gridImages[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);
			}
@@ -2080,7 +2090,7 @@ import org.apache.commons.configuration.XMLConfiguration;
        			imp_grid=this.gIP[numGridImg].gridImage;
        		} else {
        			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])
        			if (imp_grid==null) {
        				String msg="Failed to read grid file "+this.gIP[fileNumber].path;