Commit 96c4558f authored by Andrey Filippov's avatar Andrey Filippov

Debugging fitting strategies, initial image parameter setup

parent f1c19f00
...@@ -2634,6 +2634,7 @@ if (MORE_BUTTONS) { ...@@ -2634,6 +2634,7 @@ if (MORE_BUTTONS) {
parFilter, parFilter,
""); //String defaultPath ""); //String defaultPath
if ((pathname==null) || (pathname=="")) return; if ((pathname==null) || (pathname=="")) return;
System.out.println("*** Will not work with different size senspors !!!");
DISTORTION_CALIBRATION_DATA.setMaskFromImageStack(pathname); DISTORTION_CALIBRATION_DATA.setMaskFromImageStack(pathname);
if (LENS_DISTORTIONS!=null) LENS_DISTORTIONS.updateSensorMasks(); if (LENS_DISTORTIONS!=null) LENS_DISTORTIONS.updateSensorMasks();
return; return;
...@@ -3642,8 +3643,8 @@ if (MORE_BUTTONS) { ...@@ -3642,8 +3643,8 @@ if (MORE_BUTTONS) {
double threadPitch=0.35; // M1.6 double threadPitch=0.35; // M1.6
double dPx0=camPars.eyesisSubCameras[stationNumber][0].px0-(camPars.sensorWidth/2)-FOCUS_MEASUREMENT_PARAMETERS.centerDeltaX; double dPx0=camPars.eyesisSubCameras[stationNumber][0].px0-(camPars.getSensorWidth(0)/2)-FOCUS_MEASUREMENT_PARAMETERS.centerDeltaX;
double dPy0=camPars.eyesisSubCameras[stationNumber][0].py0-(camPars.sensorHeight/2)-FOCUS_MEASUREMENT_PARAMETERS.centerDeltaY; double dPy0=camPars.eyesisSubCameras[stationNumber][0].py0-(camPars.getSensorHeight(0)/2)-FOCUS_MEASUREMENT_PARAMETERS.centerDeltaY;
double psi=camPars.eyesisSubCameras[stationNumber][0].psi; // degrees, rotation (of the sensor) around the optical axis. Positive if camera is rotated clockwise looking to the target double psi=camPars.eyesisSubCameras[stationNumber][0].psi; // degrees, rotation (of the sensor) around the optical axis. Positive if camera is rotated clockwise looking to the target
FOCUS_MEASUREMENT_PARAMETERS.result_PX0=camPars.eyesisSubCameras[stationNumber][0].px0; FOCUS_MEASUREMENT_PARAMETERS.result_PX0=camPars.eyesisSubCameras[stationNumber][0].px0;
...@@ -5026,8 +5027,8 @@ if (MORE_BUTTONS) { ...@@ -5026,8 +5027,8 @@ if (MORE_BUTTONS) {
if (DEBUG_LEVEL>2) System.out.println("sfeParameters["+numSFE+"].length="+sfeParameters[numSFE].length); if (DEBUG_LEVEL>2) System.out.println("sfeParameters["+numSFE+"].length="+sfeParameters[numSFE].length);
if (DEBUG_LEVEL>2) System.out.println("sfeParameters["+numSFE+"]["+iLens+"].length="+sfeParameters[numSFE][iLens].length); if (DEBUG_LEVEL>2) System.out.println("sfeParameters["+numSFE+"]["+iLens+"].length="+sfeParameters[numSFE][iLens].length);
sfeParameters[numSFE][iLens][iState]=FOCUS_MEASUREMENT_PARAMETERS.clone(); sfeParameters[numSFE][iLens][iState]=FOCUS_MEASUREMENT_PARAMETERS.clone();
sensorDimensions[numSFE][0]=EYESIS_CAMERA_PARAMETERS.sensorWidth; // should be the same for all lenses/states sensorDimensions[numSFE][0]=EYESIS_CAMERA_PARAMETERS.getSensorWidth(numSFE); // should be the same for all lenses/states
sensorDimensions[numSFE][1]=EYESIS_CAMERA_PARAMETERS.sensorHeight; sensorDimensions[numSFE][1]=EYESIS_CAMERA_PARAMETERS.getSensorHeight(numSFE);
iState++; iState++;
} }
iLens++; iLens++;
...@@ -5492,12 +5493,12 @@ if (MORE_BUTTONS) { ...@@ -5492,12 +5493,12 @@ if (MORE_BUTTONS) {
String path=dFile+Prefs.getFileSeparator()+lensPrefix+CAMERAS.getLastTimestampUnderscored()+ String path=dFile+Prefs.getFileSeparator()+lensPrefix+CAMERAS.getLastTimestampUnderscored()+
(modeAverage?"-summary.csv":"-tempscan.csv"); (modeAverage?"-summary.csv":"-tempscan.csv");
if (MASTER_DEBUG_LEVEL>0) System.out.println ((modeAverage?"Saving averaged measurements to ":"Saving temperature measurement log data to ")+path); if (MASTER_DEBUG_LEVEL>0) System.out.println ((modeAverage?"Saving averaged measurements to ":"Saving temperature measurement log data to ")+path);
int sensorWidth=2992,sensorHeight=1936; int sensorWidth=2592,sensorHeight=1936;
if ((LENS_DISTORTIONS!=null) && (LENS_DISTORTIONS.fittingStrategy!=null) && (LENS_DISTORTIONS.fittingStrategy!=null)&& if ((LENS_DISTORTIONS!=null) && (LENS_DISTORTIONS.fittingStrategy!=null) && (LENS_DISTORTIONS.fittingStrategy!=null)&&
(LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData!=null) && (LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData!=null) &&
(LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.eyesisCameraParameters!=null)){ (LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.eyesisCameraParameters!=null)){
sensorWidth=LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.eyesisCameraParameters.sensorWidth; sensorWidth=LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.eyesisCameraParameters.getSensorWidth(0);
sensorHeight=LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.eyesisCameraParameters.sensorHeight; sensorHeight=LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.eyesisCameraParameters.getSensorHeight(0);
} }
if (FOCUSING_FIELD!=null){ if (FOCUSING_FIELD!=null){
sensorWidth=FOCUSING_FIELD.sensorWidth; sensorWidth=FOCUSING_FIELD.sensorWidth;
...@@ -5918,7 +5919,12 @@ if (MORE_BUTTONS) { ...@@ -5918,7 +5919,12 @@ if (MORE_BUTTONS) {
IJ.showMessage("LENS_DISTORTION.fittingStrategy is not set"); IJ.showMessage("LENS_DISTORTION.fittingStrategy is not set");
return; return;
} }
LENS_DISTORTIONS.listImageSets(); GenericDialog gd=new GenericDialog ("Select list mode");
gd.addNumericField("Mode 0 - old, 1 - shift/Rots", 0, 0);
gd.showDialog();
if (gd.wasCanceled()) return;
int listMode= (int) gd.getNextNumber();
LENS_DISTORTIONS.listImageSets(listMode);
return; return;
} }
/* ======================================================================== */ /* ======================================================================== */
...@@ -8986,12 +8992,20 @@ if (MORE_BUTTONS) { ...@@ -8986,12 +8992,20 @@ if (MORE_BUTTONS) {
for (int nChn=0;nChn<masks.length;nChn++) if ((nChn<selectedChannels.length)&&!selectedChannels[nChn]) masks[nChn]=null; for (int nChn=0;nChn<masks.length;nChn++) if ((nChn<selectedChannels.length)&&!selectedChannels[nChn]) masks[nChn]=null;
} }
if (showSensorMasks) this.SDFA_INSTANCE.showArrays( //java.lang.ArrayIndexOutOfBoundsException: 313632 if (showSensorMasks) {
masks, boolean same_size = true;
LENS_DISTORTIONS.pixelCorrectionWidth/ LENS_DISTORTIONS.pixelCorrectionDecimation, for (int i = 1; i < masks.length; i++) same_size &= (masks[i].length == masks[0].length);
LENS_DISTORTIONS.pixelCorrectionHeight/LENS_DISTORTIONS.pixelCorrectionDecimation, if (same_size) {
true, this.SDFA_INSTANCE.showArrays( //java.lang.ArrayIndexOutOfBoundsException: 313632
"nonVinetting masks"); masks,
LENS_DISTORTIONS.getSensorWidth(0)/ LENS_DISTORTIONS.getDecimateMasks(0),
LENS_DISTORTIONS.getSensorHeight(0)/LENS_DISTORTIONS.getDecimateMasks(0),
true,
"nonVinetting masks");
} else {
System.out.println("**** Can't show sesnor masks for different size sesnors as a stack! ");
}
}
double [][][][] sensorGrids=LENS_DISTORTIONS.calculateGridFlatField( double [][][][] sensorGrids=LENS_DISTORTIONS.calculateGridFlatField(
serNumber, serNumber,
masks, masks,
...@@ -9556,7 +9570,7 @@ if (MORE_BUTTONS) { ...@@ -9556,7 +9570,7 @@ if (MORE_BUTTONS) {
true, // boolean read_grids true, // boolean read_grids
MASTER_DEBUG_LEVEL); MASTER_DEBUG_LEVEL);
if (MASTER_DEBUG_LEVEL <100) return true; /// if (MASTER_DEBUG_LEVEL <100) return true;
// patterns are not yet read here! // patterns are not yet read here!
/* /*
...@@ -9639,6 +9653,11 @@ if (MORE_BUTTONS) { ...@@ -9639,6 +9653,11 @@ if (MORE_BUTTONS) {
path, path,
PROCESS_PARAMETERS.useXML, PROCESS_PARAMETERS.useXML,
null); // Properties properties null); // Properties properties
if (LENS_DISTORTIONS==null) {
System.out.println("Creating new LENS_DISTORTIONS");
LENS_DISTORTIONS=new Distortions(LENS_DISTORTION_PARAMETERS,PATTERN_PARAMETERS,REFINE_PARAMETERS,this.SYNC_COMMAND.stopRequested);
}
// ABERRATIONS_PARAMETERS.selectCalibrationDirectory(true, ABERRATIONS_PARAMETERS.calibrationDirectory, true);
return EYESIS_CAMERA_PARAMETERS.importSystem( return EYESIS_CAMERA_PARAMETERS.importSystem(
properties, properties,
prefix, prefix,
...@@ -25,6 +25,9 @@ package com.elphel.imagej.cameras; ...@@ -25,6 +25,9 @@ package com.elphel.imagej.cameras;
import java.util.Properties; import java.util.Properties;
public class EyesisSubCameraParameters{ public class EyesisSubCameraParameters{
public int sensorWidth= 2592; // moving here from the camera as a whole
public int sensorHeight= 1936;
public int decimateMasks= 1;
// origin is on the rotation axis of the tube body closest to the goniometer horizontal axis // origin is on the rotation axis of the tube body closest to the goniometer horizontal axis
public boolean cartesian = false; // cartesian coordinates mode (false - cylindrical) public boolean cartesian = false; // cartesian coordinates mode (false - cylindrical)
public int lensDistortionModel=0; public int lensDistortionModel=0;
...@@ -80,6 +83,9 @@ import java.util.Properties; ...@@ -80,6 +83,9 @@ import java.util.Properties;
*/ */
public EyesisSubCameraParameters( public EyesisSubCameraParameters(
int sensorWidth,
int sensorHeight,
int decimateMasks,
boolean cartesian, boolean cartesian,
int lensDistortionModel, int lensDistortionModel,
boolean enableNoLaser, boolean enableNoLaser,
...@@ -111,6 +117,9 @@ import java.util.Properties; ...@@ -111,6 +117,9 @@ import java.util.Properties;
int sensor_port, int sensor_port,
int subchannel int subchannel
){ ){
this.decimateMasks = decimateMasks;
this.sensorWidth= sensorWidth;
this.sensorHeight=sensorHeight;
this.cartesian = cartesian; this.cartesian = cartesian;
this.lensDistortionModel=lensDistortionModel; this.lensDistortionModel=lensDistortionModel;
this.enableNoLaser=enableNoLaser; this.enableNoLaser=enableNoLaser;
...@@ -156,6 +165,9 @@ import java.util.Properties; ...@@ -156,6 +165,9 @@ import java.util.Properties;
@Override @Override
public EyesisSubCameraParameters clone() { public EyesisSubCameraParameters clone() {
return new EyesisSubCameraParameters( return new EyesisSubCameraParameters(
this.sensorWidth,
this.sensorHeight,
this.decimateMasks,
this.cartesian, this.cartesian,
this.lensDistortionModel, this.lensDistortionModel,
this.enableNoLaser, this.enableNoLaser,
...@@ -196,6 +208,9 @@ import java.util.Properties; ...@@ -196,6 +208,9 @@ import java.util.Properties;
} }
// TODO: add/restore new properties // TODO: add/restore new properties
public void setProperties(String prefix,Properties properties){ public void setProperties(String prefix,Properties properties){
properties.setProperty(prefix+"sensorWidth", this.sensorWidth+"");
properties.setProperty(prefix+"sensorHeight", this.sensorHeight+"");
properties.setProperty(prefix+"decimateMasks", this.decimateMasks+"");
properties.setProperty(prefix+"cartesian", this.cartesian+""); properties.setProperty(prefix+"cartesian", this.cartesian+"");
properties.setProperty(prefix+"lensDistortionModel", this.lensDistortionModel+""); properties.setProperty(prefix+"lensDistortionModel", this.lensDistortionModel+"");
properties.setProperty(prefix+"enableNoLaser", this.enableNoLaser+""); properties.setProperty(prefix+"enableNoLaser", this.enableNoLaser+"");
...@@ -239,6 +254,12 @@ import java.util.Properties; ...@@ -239,6 +254,12 @@ import java.util.Properties;
getProperties(prefix,properties, -1); getProperties(prefix,properties, -1);
} }
public void getProperties(String prefix,Properties properties, int channel){ public void getProperties(String prefix,Properties properties, int channel){
if (properties.getProperty(prefix+"sensorWidth")!=null)
this.sensorWidth=Integer.parseInt(properties.getProperty(prefix+"sensorWidth"));
if (properties.getProperty(prefix+"sensorHeight")!=null)
this.sensorHeight=Integer.parseInt(properties.getProperty(prefix+"sensorHeight"));
if (properties.getProperty(prefix+"decimateMasks")!=null)
this.decimateMasks=Integer.parseInt(properties.getProperty(prefix+"decimateMasks"));
if (properties.getProperty(prefix+"cartesian")!=null) if (properties.getProperty(prefix+"cartesian")!=null)
this.cartesian=Boolean.parseBoolean(properties.getProperty(prefix+"cartesian")); this.cartesian=Boolean.parseBoolean(properties.getProperty(prefix+"cartesian"));
if (properties.getProperty(prefix+"lensDistortionModel")!=null) if (properties.getProperty(prefix+"lensDistortionModel")!=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