Commit d33f7855 authored by Andrey Filippov's avatar Andrey Filippov

implemented multi-size strategies, bug fix

parent 96c4558f
...@@ -1490,19 +1490,46 @@ if (sfiles == null) { ...@@ -1490,19 +1490,46 @@ if (sfiles == null) {
public void listImageSet( public void listImageSet(
int mode, int mode,
int [] numPoints, int [] numPoints, // All arrays may be twice long, then 1 - EO, second - LWIR
double [] setRMS, double [] setRMS,
boolean [] hasNaNInSet){ boolean [] hasNaNInSet){
if ((this.gIS==null) || (this.gIS.length==0)){ if ((this.gIS==null) || (this.gIS.length==0)){
return; return;
} }
boolean showXYZ = true;
boolean hasLwir = false;
if (numPoints!=null) {
hasLwir = numPoints.length > this.gIS.length; // twice longer
} else if (setRMS != null) {
hasLwir = setRMS.length > this.gIS.length; // twice longer
} else if (hasNaNInSet != null) {
hasLwir = hasNaNInSet.length > this.gIS.length; // twice longer
}
String header="#\ttimestamp"; String header="#\ttimestamp";
if (this.eyesisCameraParameters.numStations>1) header+="\tStation"; if (this.eyesisCameraParameters.numStations>1) header+="\tStation";
// header+="\tAxial\tTilt\thorPhi\thorPsi\tX\tY\tZ\tMotor2\tMotor3"; // header+="\tAxial\tTilt\thorPhi\thorPsi\tX\tY\tZ\tMotor2\tMotor3";
header+="\tAxial\tTilt\tdTilt\tInter\tMotor2\tMotor3"; header+="\tAxial\tTilt\tdTilt\tInter";
if (numPoints!=null) header+="\tNumPoints"; if (showXYZ) {
header+="\tGXY0\tGXY1\tGXY2";
}
header+="\tMotor2\tMotor3";
if (numPoints!=null) {
if (hasLwir) {
header+="\tNumPointsEO\tNumPointsLWIR";
} else {
header+="\tNumPoints";
}
}
header+="\tEnabled\tMatched"; header+="\tEnabled\tMatched";
if (setRMS!=null) header+="\tRMS\tWeight"; if (setRMS!=null) {
if (hasLwir) {
header+="\tRMS-EO\tRMS-LWIR\tWeight";
} else {
header+="\tRMS\tWeight";
}
}
for (int n=0;n<this.gIS[0].imageSet.length;n++) header+="\t"+n; for (int n=0;n<this.gIS[0].imageSet.length;n++) header+="\t"+n;
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
...@@ -1553,12 +1580,25 @@ if (sfiles == null) { ...@@ -1553,12 +1580,25 @@ if (sfiles == null) {
sb.append("\t"+(Double.isNaN(dTilt)?"---":IJ.d2s(dTilt,3))); sb.append("\t"+(Double.isNaN(dTilt)?"---":IJ.d2s(dTilt,3)));
sb.append("\t"+(Double.isNaN(firstInterAxisAngle)?"---":IJ.d2s(firstInterAxisAngle,3))); sb.append("\t"+(Double.isNaN(firstInterAxisAngle)?"---":IJ.d2s(firstInterAxisAngle,3)));
if (showXYZ) {
sb.append(String.format("\t%.1f\t%.1f\t%.1f", this.gIS[i].GXYZ[0], this.gIS[i].GXYZ[1], this.gIS[i].GXYZ[2]));
}
if (this.gIS[i].motors==null) { if (this.gIS[i].motors==null) {
sb.append("\t"+"bug"+"\t"+"bug"); sb.append("\t"+"bug"+"\t"+"bug");
} else { } else {
sb.append("\t"+this.gIS[i].motors[1]+"\t"+this.gIS[i].motors[2]); // null pointer here???? sb.append("\t"+this.gIS[i].motors[1]+"\t"+this.gIS[i].motors[2]); // null pointer here????
} }
if (numPoints!=null) sb.append("\t"+numPoints[i]); if (numPoints!=null) {
if (hasLwir) {
sb.append("\t"+numPoints[2 * i + 0]);
sb.append("\t"+numPoints[2 * i + 1]);
} else {
sb.append("\t"+numPoints[i]);
}
}
int numEnImages=0; int numEnImages=0;
for (int n=0;n<this.gIS[i].imageSet.length;n++)if (this.gIS[i].imageSet[n]!=null){ for (int n=0;n<this.gIS[i].imageSet.length;n++)if (this.gIS[i].imageSet[n]!=null){
if (this.gIS[i].imageSet[n].enabled) numEnImages++; if (this.gIS[i].imageSet[n].enabled) numEnImages++;
...@@ -1572,9 +1612,15 @@ if (sfiles == null) { ...@@ -1572,9 +1612,15 @@ if (sfiles == null) {
} }
sb.append("\t"+matchedPointersInSet); sb.append("\t"+matchedPointersInSet);
if (setRMS!=null) { if (setRMS!=null) {
if (hasLwir) {
sb.append("\t"+(((hasNaNInSet!=null) && hasNaNInSet[2 * i + 0])?"*":"")+IJ.d2s(setRMS[2 * i + 0],3));
sb.append("\t"+(((hasNaNInSet!=null) && hasNaNInSet[2 * i + 1])?"*":"")+IJ.d2s(setRMS[2 * i + 1],3)); //393
sb.append("\t"+IJ.d2s(this.gIS[i].setWeight,3));
} else {
sb.append("\t"+(((hasNaNInSet!=null) && hasNaNInSet[i])?"*":"")+IJ.d2s(setRMS[i],3)); sb.append("\t"+(((hasNaNInSet!=null) && hasNaNInSet[i])?"*":"")+IJ.d2s(setRMS[i],3));
sb.append("\t"+IJ.d2s(this.gIS[i].setWeight,3)); sb.append("\t"+IJ.d2s(this.gIS[i].setWeight,3));
} }
}
switch (mode) { switch (mode) {
case 0: case 0:
for (int n=0;n<this.gIS[i].imageSet.length;n++){ for (int n=0;n<this.gIS[i].imageSet.length;n++){
...@@ -3331,7 +3377,7 @@ if (sfiles == null) { ...@@ -3331,7 +3377,7 @@ if (sfiles == null) {
return small_sensors; return small_sensors;
} }
public boolean isSmallSensor(int numImg) { public boolean isSmallSensor(int numImg) {
if ((this.gIP != null) && (numImg < this.gIP.length) && (small_sensors == null)){ if ((this.gIP != null) && (numImg < this.gIP.length) && (small_sensors != null)){
return small_sensors[this.gIP[numImg].getChannel()]; return small_sensors[this.gIP[numImg].getChannel()];
} }
return false; return false;
...@@ -3410,32 +3456,52 @@ if (sfiles == null) { ...@@ -3410,32 +3456,52 @@ if (sfiles == null) {
} }
return n; return n;
} }
// check if the channel is the first in group
public boolean firstInGroup(int chn) {
if (chn >= 24) return (chn == 24);
if ((chn == getVnir0()) || (chn == getLwir0())) return true;
int [] num = {0,0};
for (int i = 0; i < chn; i++) {
if ((small_sensors != null) && small_sensors[i]) num[1]++;
else num[0]++;
}
if ((small_sensors != null) && small_sensors[chn]) return (num[1] == 1);
else return (num[0] == 1);
}
public String getSubName(int chn) { public String getSubName(int chn, boolean full) {
int groups = getSubGroups(); int groups = getSubGroups();
if (groups == 1) return "sub"; // single camera if (groups == 1) return full?"Single subcamera":"sub"; // single camera
int num_sub = getNumSubCameras(); int num_sub = getNumSubCameras();
if (num_sub == 26) { // eyesis4pi-26 if (num_sub == 26) { // eyesis4pi-26
if (chn == 0) return "sub-head-0"; if (chn == 0) return full?"Camera head subcamera 0":"sub-head-0";
if (chn < 24) return "sub-head-other"; if (chn < 24) return full?"Camera head other subcameras":"sub-head-other";
return "sub-bottom"; if (chn == 24) return full?"Camera bottom 0":"sub-bottom-0";
return full?"Camera bottom other":"sub-bottom-other";
} }
if (hasSmallSensors()) { if (hasSmallSensors()) {
if (small_sensors[chn]) { // current is LWIR if (small_sensors[chn]) { // current is LWIR
if (chn != getLwir0()) return "sub-lwir-other"; if (chn != getLwir0()) return full?"Subcamera LWIR other":"sub-lwir-other";
if (getNumLwir() > 1) return "sub-lwir0"; if (getNumLwir() > 1) return full?"Subcamera LWIR 0":"sub-lwir0";
return "sub-lwir"; return full?"Subcamera LWIR":"sub-lwir";
} else { // current is VNIR } else { // current is VNIR
if (chn != getVnir0()) return "sub-vnir-other"; if (chn != getVnir0()) return full?"Subcamera VNIR other":"sub-vnir-other";
if (getNumVnir() > 1) return "sub-vnir0"; if (getNumVnir() > 1) return full?"Subcamera VNIR 0":"sub-vnir0";
return "sub-vnir"; return full?"Subcamera VNIR":"sub-vnir";
} }
} }
if (chn != getVnir0()) return "sub-other"; if (chn != getVnir0()) return full?"Subcamera other":"sub-other";
return "sub0"; return full?"Subcamera 0":"sub0";
} }
// get subcamera index this one should copy parameters from (-1 if it is first in group
public int masterSub(int chn) {
if (firstInGroup(chn)) return -1;
for (int mchn = chn -1; mchn >= 0; mchn--) {
if (firstInGroup(mchn)) return mchn;
}
return -1; // should never get here
}
......
...@@ -780,9 +780,35 @@ public class Distortions { ...@@ -780,9 +780,35 @@ public class Distortions {
int [] numPairs=calcNumPairs(); int [] numPairs=calcNumPairs();
int [][] imageSets=this.fittingStrategy.distortionCalibrationData.listImages(false); // true - only enabled images int [][] imageSets=this.fittingStrategy.distortionCalibrationData.listImages(false); // true - only enabled images
int [] numSetPoints=new int [imageSets.length]; boolean hasLWIR = this.fittingStrategy.distortionCalibrationData.hasSmallSensors();
double [] rmsPerSet=new double[imageSets.length];
boolean [] hasNaNInSet=new boolean[imageSets.length]; int [] numSetPoints=new int [imageSets.length*(hasLWIR?2:1)];
double [] rmsPerSet=new double[imageSets.length*(hasLWIR?2:1)];
boolean [] hasNaNInSet=new boolean[imageSets.length*(hasLWIR?2:1)];
if (hasLWIR) {
for (int setNum=0;setNum<imageSets.length;setNum++){
double [] error2= {0.0,0.0};
int [] numInSet= {0,0};
hasNaNInSet[2*setNum]=false;
hasNaNInSet[2*setNum+1]=false;
for (int imgInSet=0;imgInSet<imageSets[setNum].length;imgInSet++) {
int imgNum=imageSets[setNum][imgInSet];
int isLwir = this.fittingStrategy.distortionCalibrationData.isSmallSensor(imgNum)?1:0;
int num=numPairs[imgNum];
if (Double.isNaN(errors[imgNum])){
hasNaNInSet[2 * setNum + isLwir]=true;
} else {
error2[isLwir]+=errors[imgNum]*errors[imgNum]*num;
numInSet[isLwir]+=num;
}
}
numSetPoints[2 * setNum + 0]= numInSet[0];
rmsPerSet [2 * setNum + 0]= Math.sqrt(error2[0]/numInSet[0]);
numSetPoints[2 * setNum + 1]= numInSet[1];
rmsPerSet [2 * setNum + 1]= Math.sqrt(error2[1]/numInSet[1]);
}
} else {
for (int setNum=0;setNum<imageSets.length;setNum++){ for (int setNum=0;setNum<imageSets.length;setNum++){
double error2=0.0; double error2=0.0;
int numInSet=0; int numInSet=0;
...@@ -800,6 +826,7 @@ public class Distortions { ...@@ -800,6 +826,7 @@ public class Distortions {
numSetPoints[setNum]=numInSet; numSetPoints[setNum]=numInSet;
rmsPerSet[setNum]=Math.sqrt(error2/numInSet); rmsPerSet[setNum]=Math.sqrt(error2/numInSet);
} }
}
this.fittingStrategy.distortionCalibrationData.listImageSet( this.fittingStrategy.distortionCalibrationData.listImageSet(
mode, mode,
numSetPoints, numSetPoints,
......
...@@ -84,8 +84,8 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit ...@@ -84,8 +84,8 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
private boolean [][] selectedImages=null; // images selected for each step (will be masked with enabled images) private boolean [][] selectedImages=null; // images selected for each step (will be masked with enabled images)
private boolean [][] selectedValidImages=null; // images selected for each step same as selected, but only if number of weight>0.0 nodes > threshold private boolean [][] selectedValidImages=null; // images selected for each step same as selected, but only if number of weight>0.0 nodes > threshold
public boolean [] stopAfterThis=null; public boolean [] stopAfterThis=null;
final public int modeFixed=0,modeCommon=1,modeSupercommon=2,modeIndividual=3,modeGroup=4; final public static int modeFixed=0,modeCommon=1,modeSupercommon=2,modeIndividual=3,modeGroup=4;
final public int modeStation=5,modeSuperStation=6,modeWeakCommon=7,modeWeakStation=8,modeTiltEqualize=9; final public static int modeStation=5,modeSuperStation=6,modeWeakCommon=7,modeWeakStation=8,modeTiltEqualize=9;
public String[] definedModes={ public String[] definedModes={
"fixed", // modeFixed=0 "fixed", // modeFixed=0
"common", // modeCommon=1 "common", // modeCommon=1
...@@ -121,13 +121,16 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit ...@@ -121,13 +121,16 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
"tilt equalize" // modeTiltEqualize "tilt equalize" // modeTiltEqualize
}; };
public String[] definedModesAll= definedModesTiltEq; public String[] definedModesAll= definedModesTiltEq;
public int [][] parameterMode=null; // per series, per-parameter public int [][] parameterMode=null; // per series, per-parameter - see modeFixed...modeTiltEqualize. Higher numbers - mean "same as"
// and master subcamera index is calculated by subtracting this.definedModesAll.length
public int [][][] parameterGroups=null; // per series, per-parameter - null or array of group numbers (1 element per image) public int [][][] parameterGroups=null; // per series, per-parameter - null or array of group numbers (1 element per image)
public int [][] zGroups=null; public int [][] zGroups=null;
public boolean saveUnusedGroups=false; // purge groups for parameters when saving to XML, preserve if true public boolean saveUnusedGroups=false; // purge groups for parameters when saving to XML, preserve if true
public double [] lambdas=null; // LMA initial lambda for each step public double [] lambdas=null; // LMA initial lambda for each step
public double defaultLambda=0.001; public double defaultLambda=0.001;
public int [][] parameterList=null; // list of all parameters in the system, each has subcamera number and parameters index public int [][] parameterList=null; // list of all parameters in the system, each has subcamera number and parameters index
// [][0] - subcamera (0 also for non-subcamera specific), [][1] - parameter "name"
public boolean [] parameterEnable=null; // select which parameters (of some 320 to display in selector) public boolean [] parameterEnable=null; // select which parameters (of some 320 to display in selector)
public int [] masterImages=null; // number of image no take "common" parameters from if they are different public int [] masterImages=null; // number of image no take "common" parameters from if they are different
public double defaultStepDone=1.0E-6; public double defaultStepDone=1.0E-6;
...@@ -411,7 +414,7 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit ...@@ -411,7 +414,7 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
(this.distortionCalibrationData.isSubcameraParameter(nPar)?("_sub"+nSub):""), (this.distortionCalibrationData.isSubcameraParameter(nPar)?("_sub"+nSub):""),
this.parameterMode[i][j]); this.parameterMode[i][j]);
// cleaning up output - removing unused groups (may disable // cleaning up output - removing unused groups (may disable
if (((this.parameterMode[i][j]==this.modeGroup) || this.saveUnusedGroups ) && (this.parameterGroups[i][j]!=null)){ if (((this.parameterMode[i][j]==modeGroup) || this.saveUnusedGroups ) && (this.parameterGroups[i][j]!=null)){
for (int ni=0;ni<this.parameterGroups[i][j].length;ni++){ for (int ni=0;ni<this.parameterGroups[i][j].length;ni++){
hConfig.addProperty(sSeries+".parameterMode."+ hConfig.addProperty(sSeries+".parameterMode."+
this.distortionCalibrationData.parameterDescriptions[nPar][0]+ this.distortionCalibrationData.parameterDescriptions[nPar][0]+
...@@ -680,14 +683,14 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit ...@@ -680,14 +683,14 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
double masterTS=this.distortionCalibrationData.getImageTimestamp(this.masterImages[numSeries]); // timestamp of the master image double masterTS=this.distortionCalibrationData.getImageTimestamp(this.masterImages[numSeries]); // timestamp of the master image
int [] masterVectorIndices = new int [numTPars]; int [] masterVectorIndices = new int [numTPars];
// iterate through all global/subcamera parameters // iterate through all global/subcamera parameters
for (int numTPar=0;numTPar<numTPars;numTPar++) if (this.parameterMode[numSeries][numTPar]!=this.modeFixed){ // skip "fixed" for (int numTPar=0;numTPar<numTPars;numTPar++) if (this.parameterMode[numSeries][numTPar]!=modeFixed){ // skip "fixed"
boolean isCommon= boolean isCommon=
(this.parameterMode[numSeries][numTPar]==this.modeCommon) || (this.parameterMode[numSeries][numTPar]==modeCommon) ||
(this.parameterMode[numSeries][numTPar]==this.modeSupercommon); (this.parameterMode[numSeries][numTPar]==modeSupercommon);
boolean isStation= boolean isStation=
(this.parameterMode[numSeries][numTPar]==this.modeStation) || (this.parameterMode[numSeries][numTPar]==modeStation) ||
(this.parameterMode[numSeries][numTPar]==this.modeSuperStation); (this.parameterMode[numSeries][numTPar]==modeSuperStation);
boolean isGroup=(this.parameterMode[numSeries][numTPar]==this.modeGroup); boolean isGroup=(this.parameterMode[numSeries][numTPar]==modeGroup);
int numSub=this.parameterList[numTPar][0]; // number of sub-camera for this total parameter index int numSub=this.parameterList[numTPar][0]; // number of sub-camera for this total parameter index
int numPar=this.parameterList[numTPar][1]; // number of per-image parameter for this total parameter index int numPar=this.parameterList[numTPar][1]; // number of per-image parameter for this total parameter index
boolean isSubCamera=this.distortionCalibrationData.isSubcameraParameter(numPar); boolean isSubCamera=this.distortionCalibrationData.isSubcameraParameter(numPar);
...@@ -695,13 +698,14 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit ...@@ -695,13 +698,14 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
int sameAs = this.parameterMode[numSeries][numTPar] - this.definedModesAll.length; // number of subcamera to use int sameAs = this.parameterMode[numSeries][numTPar] - this.definedModesAll.length; // number of subcamera to use
int numTParMaster = -1; int numTParMaster = -1;
int vectorIndexMaster = -1; int vectorIndexMaster = -1;
if (sameAs < 0 ) sameAs = -1; if (sameAs < 0 ) {
else { sameAs = -1;
} else {
for (numTParMaster = 0; numTParMaster < numTPar; numTParMaster++){ for (numTParMaster = 0; numTParMaster < numTPar; numTParMaster++){
if ((this.parameterList[numTParMaster][0] == sameAs) && (this.parameterList[numTParMaster][1] == numPar)) break; if ((this.parameterList[numTParMaster][0] == sameAs) && (this.parameterList[numTParMaster][1] == numPar)) break;
} }
// find master index for this parameter // find master index for this parameter
if (numTParMaster == numTPar) { // bug, reposrt and terat as fixed if (numTParMaster == numTPar) { // bug, report and treat as fixed
System.out.println("Bug in buildParameterMap("+numSeries+"): could not find master parameter for numTPar="+numTPar+", sameAs="+sameAs); System.out.println("Bug in buildParameterMap("+numSeries+"): could not find master parameter for numTPar="+numTPar+", sameAs="+sameAs);
System.out.println("Treaing as fixed"); System.out.println("Treaing as fixed");
continue; continue;
...@@ -1420,7 +1424,7 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit ...@@ -1420,7 +1424,7 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
this.selectedImages[i][j]=false; this.selectedImages[i][j]=false;
} }
for (int j=0;j<this.parameterMode[i].length;j++){ for (int j=0;j<this.parameterMode[i].length;j++){
this.parameterMode[i][j]=this.modeFixed; // fixed this.parameterMode[i][j]=modeFixed; // fixed
this.parameterGroups[i][j]=null; // no groups yet defined this.parameterGroups[i][j]=null; // no groups yet defined
} }
this.lambdas[i]=defaultLambda; this.lambdas[i]=defaultLambda;
...@@ -1434,16 +1438,21 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit ...@@ -1434,16 +1438,21 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
initParameterList(); initParameterList();
for (int i=0;i<numPars;i++){ for (int i=0;i<numPars;i++){
this.parameterEnable[i]=true; // initially enable all parameters for the first camera this.parameterEnable[i]=!this.distortionCalibrationData.isNonRadial(i); // true; // initially enable all parameters for the first camera
} }
for (int i=1;i<numSubCams;i++){ for (int i=1;i<numSubCams;i++){
int i1=numPars+numSubPars*(i-1); int i1=numPars+numSubPars*(i-1);
int j1=0; int j1=0;
for (int j=0;j<numPars;j++) if (this.distortionCalibrationData.isSubcameraParameter(j)){ for (int j=0;j<numPars;j++) if (this.distortionCalibrationData.isSubcameraParameter(j)){
this.parameterEnable[i1+j1]=false; // initially disable all other subcamera parameters this.parameterEnable[i1+j1]=
this.distortionCalibrationData.firstInGroup(i) &&
!this.distortionCalibrationData.isNonRadial(j); // false; // initially disable all other subcamera parameters
j1++; j1++;
} }
} }
// Improve - add main parameters (up to A8?) for each master channel
} }
private void initParameterList(){ private void initParameterList(){
...@@ -1906,7 +1915,6 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit ...@@ -1906,7 +1915,6 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
break; break;
case 6: // start from current selection case 6: // start from current selection
selection=selected.clone(); selection=selected.clone();
break;
case 5: // start from empty selection case 5: // start from empty selection
if (!selectImageSets( if (!selectImageSets(
selection, selection,
...@@ -2020,16 +2028,46 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit ...@@ -2020,16 +2028,46 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
sb.append("\n"); sb.append("\n");
// parameters // parameters
for (int ipar =0; ipar<this.parameterEnable.length;ipar++) if (this.parameterEnable[ipar] && for (int ipar =0; ipar<this.parameterEnable.length;ipar++) if (this.parameterEnable[ipar] &&
(!zeroAndOther || (this.parameterList[ipar][0] <= 1) || (this.parameterList[ipar][0] ==24))){ // in "zeroAndOther" mode do not show other subcameras // (!zeroAndOther || (this.parameterList[ipar][0] <= 1) || (this.parameterList[ipar][0] ==24))){ // in "zeroAndOther" mode do not show other subcameras
(!zeroAndOther || this.distortionCalibrationData.firstInGroup(this.parameterList[ipar][0]))){ // in "zeroAndOther" mode do not show other subcameras
int parIndex=this.parameterList[ipar][1]; int parIndex=this.parameterList[ipar][1];
int subCam=this.parameterList[ipar][0]; int subCam=this.parameterList[ipar][0];
boolean isSub=this.distortionCalibrationData.isSubcameraParameter(parIndex); boolean isSub=this.distortionCalibrationData.isSubcameraParameter(parIndex);
String sChn=(zeroAndOther && (subCam>=1)&& (subCam<24))?"-head-other": // String sChn=(zeroAndOther && (subCam>=1)&& (subCam<24))?"-head-other":
((zeroAndOther && (subCam>=24))?"-bottom":("-"+subCam)); // ((zeroAndOther && (subCam>=24))?"-bottom":("-"+subCam));
String sChn=this.distortionCalibrationData.getSubName(subCam,false);
boolean noWeak=!this.distortionCalibrationData.eyesisCameraParameters.isExtrinsic(parIndex); boolean noWeak=!this.distortionCalibrationData.eyesisCameraParameters.isExtrinsic(parIndex);
boolean isTilt=this.distortionCalibrationData.eyesisCameraParameters.isTilt(parIndex); boolean isTilt=this.distortionCalibrationData.eyesisCameraParameters.isTilt(parIndex);
// for non-subcamera or subcam 0 - no extra choices. For "zeroAndOther" - only "0". For other subCam - all less than this // for non-subcamera or subcam 0 - no extra choices. For "zeroAndOther" - only "0". For other subCam - all less than this
int subMaxNum = (this.distortionCalibrationData.isSubcameraParameter(parIndex) && (subCam > 0)) ? (zeroAndOther? 0 : (subCam-1)):-1; // if zeroAndOther:
// non-sub: -1
// sub0 : -1
// sub: 0
// not zeroAndOther:
// non-sub - -1:
// sub: subCam-1 (previous index)
//int subMaxNum = (this.distortionCalibrationData.isSubcameraParameter(parIndex) && (subCam > 0)) ? (zeroAndOther? 0 : (subCam-1)):-1;
//
// new:
// if zeroAndOther:
// non-sub: -1
// firstInGroup : -1
// sub(other): their group number - no, 0 - later add this.definedModesAll.length to master subcamera
// not zeroAndOther:
// non-sub - -1:
// sub(>0): subCam-1 (previous index) - will suggest any with smaller index - may be useless with lwir < vnir indices
// int subMaxNum = (this.distortionCalibrationData.isSubcameraParameter(parIndex) && (subCam > 0)) ? (zeroAndOther? 0 : (subCam-1)):-1;
int subMaxNum = -1;
if (this.distortionCalibrationData.isSubcameraParameter(parIndex)) { // only for subcamera parameters
if (zeroAndOther) {
subMaxNum = this.distortionCalibrationData.firstInGroup(subCam)?-1:0; //this.distortionCalibrationData.getSubGroup(subCam);
} else {
subMaxNum = subCam-1; // 0 will be -1 - this may be wrong to align to higher index
}
}
/*=========*/
String [] commonChoices = (isTilt?this.definedModesTiltEq:(noWeak?this.definedModesNoWeak:this.definedModes)); String [] commonChoices = (isTilt?this.definedModesTiltEq:(noWeak?this.definedModesNoWeak:this.definedModes));
String [] theseChoices; String [] theseChoices;
String thisChoice = ""; String thisChoice = "";
...@@ -2038,15 +2076,23 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit ...@@ -2038,15 +2076,23 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
sb.append(this.distortionCalibrationData.getParameterName(parIndex)+"\t"+(isSub?(" sub"+sChn):"com ")); sb.append(this.distortionCalibrationData.getParameterName(parIndex)+"\t"+(isSub?(" sub"+sChn):"com "));
for (int numSeries=fromSer;numSeries<toSer;numSeries++) if (isSeriesValid(numSeries)) { for (int numSeries=fromSer;numSeries<toSer;numSeries++) if (isSeriesValid(numSeries)) {
if (subMaxNum < 0){ if (subMaxNum < 0){
// theseChoices = commonChoices;
thisChoice = this.definedModesAll[this.parameterMode[numSeries][ipar]]; thisChoice = this.definedModesAll[this.parameterMode[numSeries][ipar]];
} else { // only can happen if (!isTilt) && (noWeak) } else { // only can happen if (!isTilt) && (noWeak)
choice_offsets[ipar] = commonChoices.length; choice_offsets[ipar] = commonChoices.length;
theseChoices = new String [commonChoices.length + subMaxNum + 1]; theseChoices = new String [commonChoices.length + subMaxNum + 1];
for (int ch = 0; ch < commonChoices.length; ch++) theseChoices[ch] = commonChoices[ch]; for (int ch = 0; ch < commonChoices.length; ch++) theseChoices[ch] = commonChoices[ch];
for (int ch = 0; ch <= subMaxNum; ch++) theseChoices[ch + commonChoices.length] = "same as "+ch; if (zeroAndOther) {
if (subMaxNum >=0) { // can only be 0
theseChoices[commonChoices.length] = "same as "+this.distortionCalibrationData.masterSub(subCam);
}
} else {
for (int ch = 0; ch <= subMaxNum; ch++) {
theseChoices[ch + commonChoices.length] = "same as "+ch;
}
}
// choice index for "same as ..." starts with this.definedModesAll.length, but in the listbox index is lower // choice index for "same as ..." starts with this.definedModesAll.length, but in the listbox index is lower
int indx = this.parameterMode[numSeries][ipar]; int indx = this.parameterMode[numSeries][ipar];
if (indx >= this.definedModesAll.length) { if (indx >= this.definedModesAll.length) {
indx -= (this.definedModesAll.length - choice_offsets[ipar]); indx -= (this.definedModesAll.length - choice_offsets[ipar]);
} }
...@@ -2074,6 +2120,7 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit ...@@ -2074,6 +2120,7 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
* @param useParameters Select parameters for this series * @param useParameters Select parameters for this series
* @param askNextSeries Ask for next series number * @param askNextSeries Ask for next series number
* @param zeroAndOther use 2 channels 0 and "other", propagate settings for channel 1 to all the rest * @param zeroAndOther use 2 channels 0 and "other", propagate settings for channel 1 to all the rest
* Updated for more groups (up to 4 in LWIR/VNIR) - use 1 channel for each group, propagate to the rest of the group
* @return -2 - cancel, -1, done, otherwise - number of step to edit * @return -2 - cancel, -1, done, otherwise - number of step to edit
*/ */
public int selectStrategyStep( public int selectStrategyStep(
...@@ -2136,11 +2183,11 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit ...@@ -2136,11 +2183,11 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
boolean [] constrainByStation=new boolean[numStations]; boolean [] constrainByStation=new boolean[numStations];
for (int i=0;i<constrainByStation.length;i++) constrainByStation[i]=true; for (int i=0;i<constrainByStation.length;i++) constrainByStation[i]=true;
if (this.distortionCalibrationData.eyesisCameraParameters.numStations>1){ if (this.distortionCalibrationData.eyesisCameraParameters.numStations>1){
gd.addMessage("Constrain by stations"); gd.addMessage("Constrain (select/remove all) by stations");
for (int i=0;i<this.distortionCalibrationData.eyesisCameraParameters.numStations;i++) gd.addCheckbox("Station "+i, constrainByStation[i]); for (int i=0;i<this.distortionCalibrationData.eyesisCameraParameters.numStations;i++) gd.addCheckbox("Station "+i, constrainByStation[i]);
} }
if (this.distortionCalibrationData.hasSmallSensors()) { if (this.distortionCalibrationData.hasSmallSensors()) {
gd.addMessage("Constrain by High/Low resolution sensors (such as VNIR/LWIR)"); gd.addMessage("Constrain (select/remove all) by High/Low resolution sensors (such as VNIR/LWIR)");
gd.addCheckbox("Select high-res sensors", true); gd.addCheckbox("Select high-res sensors", true);
gd.addCheckbox("Select low-res sensors", true); gd.addCheckbox("Select low-res sensors", true);
} }
...@@ -2169,18 +2216,22 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit ...@@ -2169,18 +2216,22 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
if (useParameters) { if (useParameters) {
gd.addMessage("Select parameters to fit"); gd.addMessage("Select parameters to fit");
for (int i =0; i<this.parameterEnable.length;i++) if (this.parameterEnable[i] && for (int i =0; i<this.parameterEnable.length;i++) if (this.parameterEnable[i] &&
(!zeroAndOther || (this.parameterList[i][0] <= 1) || (this.parameterList[i][0] ==24))){ // in "zeroAndOther" mode do not show other subcameras /// (!zeroAndOther || (this.parameterList[i][0] <= 1) || (this.parameterList[i][0] ==24))){ // in "zeroAndOther" mode do not show other subcameras
(!zeroAndOther || this.distortionCalibrationData.firstInGroup(this.parameterList[i][0]))){ // in "zeroAndOther" mode do not show other subcameras
int parIndex=this.parameterList[i][1]; int parIndex=this.parameterList[i][1];
int subCam=this.parameterList[i][0]; int subCam=this.parameterList[i][0];
boolean isSub=this.distortionCalibrationData.isSubcameraParameter(parIndex); boolean isSub=this.distortionCalibrationData.isSubcameraParameter(parIndex);
boolean defined=false; boolean defined=false;
double min=0.0,max=0.0; double min=0.0,max=0.0;
for (int imgNumber=0;imgNumber<this.distortionCalibrationData.getNumImages(); imgNumber++) int sub_group = this.distortionCalibrationData.getSubGroup(subCam);
for (int imgNumber=0;imgNumber<this.distortionCalibrationData.getNumImages(); imgNumber++) {
if (this.selectedImages[numSeries][imgNumber] && this.distortionCalibrationData.gIP[imgNumber].enabled){ if (this.selectedImages[numSeries][imgNumber] && this.distortionCalibrationData.gIP[imgNumber].enabled){
int sub=this.distortionCalibrationData.gIP[imgNumber].channel; int sub=this.distortionCalibrationData.gIP[imgNumber].channel;
if (!isSub || (sub==subCam) || // global or same subcamera if (!isSub || (sub==subCam) || // global or same subcamera
(zeroAndOther && (subCam>=1) && (subCam<24) && (sub>=1) && (sub<24)) || // both head "other" // (zeroAndOther && (subCam>=1) && (subCam<24) && (sub>=1) && (sub<24)) || // both head "other"
(zeroAndOther && (subCam>=24) && (sub>=24) ) // (zeroAndOther && (subCam>=24) && (sub>=24) )
(zeroAndOther && (sub_group == this.distortionCalibrationData.getSubGroup(sub)))
) { // both subcameras are "other" subcameras ) { // both subcameras are "other" subcameras
double parValue=this.distortionCalibrationData.getParameterValue(imgNumber,parIndex); double parValue=this.distortionCalibrationData.getParameterValue(imgNumber,parIndex);
if (!defined) { if (!defined) {
...@@ -2192,14 +2243,46 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit ...@@ -2192,14 +2243,46 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
if (parValue>max) max=parValue; if (parValue>max) max=parValue;
} }
} }
}
// undefined, min, max // undefined, min, max
String sValue=(defined)?((min==max)?(min+""):(min+"..."+max)):"undefined"; String sValue=(defined)?((min==max)?(min+""):(min+"..."+max)):"undefined";
String sChn=(zeroAndOther && (subCam>=1)&& (subCam<24))?"-head-other": /// String sChn=(zeroAndOther && (subCam>=1)&& (subCam<24))?"-head-other":
((zeroAndOther && (subCam>=24))?"-bottom":("-"+subCam)); /// ((zeroAndOther && (subCam>=24))?"-bottom":("-"+subCam));
String sChn = this.distortionCalibrationData.getSubName(subCam,false);
boolean noWeak=!this.distortionCalibrationData.eyesisCameraParameters.isExtrinsic(parIndex); boolean noWeak=!this.distortionCalibrationData.eyesisCameraParameters.isExtrinsic(parIndex);
boolean isTilt=this.distortionCalibrationData.eyesisCameraParameters.isTilt(parIndex); boolean isTilt=this.distortionCalibrationData.eyesisCameraParameters.isTilt(parIndex);
// for non-subcamera or subcam 0 - no extra choices. For "zeroAndOther" - only "0". For other subCam - all less than this // for non-subcamera or subcam 0 - no extra choices. For "zeroAndOther" - only "0". For other subCam - all less than this
int subMaxNum = (this.distortionCalibrationData.isSubcameraParameter(parIndex) && (subCam > 0)) ? (zeroAndOther? 0 : (subCam-1)):-1;
/// int subMaxNum = (this.distortionCalibrationData.isSubcameraParameter(parIndex) && (subCam > 0)) ? (zeroAndOther? 0 : (subCam-1)):-1;
// for non-subcamera or subcam 0 - no extra choices. For "zeroAndOther" - only "0". For other subCam - all less than this
// if zeroAndOther:
// non-sub: -1
// sub0 : -1
// sub: 0
// not zeroAndOther:
// non-sub - -1:
// sub: subCam-1 (previous index)
//int subMaxNum = (this.distortionCalibrationData.isSubcameraParameter(parIndex) && (subCam > 0)) ? (zeroAndOther? 0 : (subCam-1)):-1;
//
// new:
// if zeroAndOther:
// non-sub: -1
// firstInGroup : -1
// sub(other): their group number - no, 0
// not zeroAndOther:
// non-sub - -1:
// sub(>0): subCam-1 (previous index) - will suggest any with smaller index - may be useless with lwir < vnir indices
// int subMaxNum = (this.distortionCalibrationData.isSubcameraParameter(parIndex) && (subCam > 0)) ? (zeroAndOther? 0 : (subCam-1)):-1;
int subMaxNum = -1;
if (this.distortionCalibrationData.isSubcameraParameter(parIndex)) { // only for subcamera parameters
if (zeroAndOther) {
subMaxNum = this.distortionCalibrationData.firstInGroup(subCam)?-1:0; //this.distortionCalibrationData.getSubGroup(subCam);
} else {
subMaxNum = subCam-1; // 0 will be -1 - this may be wrong to align to higher index
}
}
String [] commonChoices = (isTilt?this.definedModesTiltEq:(noWeak?this.definedModesNoWeak:this.definedModes)); String [] commonChoices = (isTilt?this.definedModesTiltEq:(noWeak?this.definedModesNoWeak:this.definedModes));
String [] theseChoices; String [] theseChoices;
String thisChoice = ""; String thisChoice = "";
...@@ -2211,7 +2294,15 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit ...@@ -2211,7 +2294,15 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
choice_offsets[i] = commonChoices.length; choice_offsets[i] = commonChoices.length;
theseChoices = new String [commonChoices.length + subMaxNum + 1]; theseChoices = new String [commonChoices.length + subMaxNum + 1];
for (int ch = 0; ch < commonChoices.length; ch++) theseChoices[ch] = commonChoices[ch]; for (int ch = 0; ch < commonChoices.length; ch++) theseChoices[ch] = commonChoices[ch];
for (int ch = 0; ch <= subMaxNum; ch++) theseChoices[ch + commonChoices.length] = "same as "+ch; if (zeroAndOther) {
if (subMaxNum >=0) {
theseChoices[commonChoices.length] = "same as "+this.distortionCalibrationData.masterSub(subCam);
}
} else {
for (int ch = 0; ch <= subMaxNum; ch++) {
theseChoices[ch + commonChoices.length] = "same as "+ch;
}
}
// choice index for "same as ..." starts with this.definedModesAll.length, but in the listbox index is lower // choice index for "same as ..." starts with this.definedModesAll.length, but in the listbox index is lower
int indx = this.parameterMode[numSeries][i]; int indx = this.parameterMode[numSeries][i];
if (indx >= this.definedModesAll.length) { if (indx >= this.definedModesAll.length) {
...@@ -2221,10 +2312,12 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit ...@@ -2221,10 +2312,12 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
System.out.println("selectStrategyStep(): this.parameterMode["+numSeries+"]["+i+"]=" + this.parameterMode[numSeries][i]+" indx = "+indx); System.out.println("selectStrategyStep(): this.parameterMode["+numSeries+"]["+i+"]=" + this.parameterMode[numSeries][i]+" indx = "+indx);
} }
gd.addChoice( // ArrayIndexOutOfBoundsException: 9 gd.addChoice( // ArrayIndexOutOfBoundsException: 9
(this.distortionCalibrationData.isSubcameraParameter(parIndex)?"":"* ") +
this.distortionCalibrationData.getParameterName(parIndex)+ this.distortionCalibrationData.getParameterName(parIndex)+
" ("+sValue+" "+ " ("+sValue+" "+
this.distortionCalibrationData.getParameterUnits(parIndex)+")"+ this.distortionCalibrationData.getParameterUnits(parIndex)+")"+
(this.distortionCalibrationData.isSubcameraParameter(parIndex)?(" sub"+sChn):"com "), // (this.distortionCalibrationData.isSubcameraParameter(parIndex)?(" sub"+sChn):"com "),
(this.distortionCalibrationData.isSubcameraParameter(parIndex)?(" "+sChn):" common"),
theseChoices, theseChoices,
thisChoice); thisChoice);
} }
...@@ -2338,7 +2431,13 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit ...@@ -2338,7 +2431,13 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
if (removeAllImages || selectAllImages) { if (removeAllImages || selectAllImages) {
for (int i =0; i<this.distortionCalibrationData.getNumImages();i++){ for (int i =0; i<this.distortionCalibrationData.getNumImages();i++){
this.selectedImages[numSeries][i]=selectAllImages || ((i==0) && removeAllImages); // invalidate - all, regardless of .enabled this.selectedImages[numSeries][i]=selectAllImages || ((i==0) && removeAllImages); // invalidate - all, regardless of .enabled
this.selectedImages[numSeries][i]&=constrainByStation[this.distortionCalibrationData.gIP[i].getStationNumber()]; this.selectedImages[numSeries][i] &= constrainByStation[this.distortionCalibrationData.gIP[i].getStationNumber()];
if (selectHiLowRes != null) {
int small_01 = this.distortionCalibrationData.isSmallSensor(i)?1:0;
// System.out.println(i+":"+small_01);
this.selectedImages[numSeries][i] &= selectHiLowRes[small_01];
}
} }
return numSeries; // caller will repeat with the same series return numSeries; // caller will repeat with the same series
} }
...@@ -2355,30 +2454,31 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit ...@@ -2355,30 +2454,31 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
if (this.masterImages[numSeries]<0)this.masterImages[numSeries]=0; if (this.masterImages[numSeries]<0)this.masterImages[numSeries]=0;
if (this.masterImages[numSeries]>=this.selectedImages[numSeries].length)this.masterImages[numSeries]=this.selectedImages[numSeries].length; if (this.masterImages[numSeries]>=this.selectedImages[numSeries].length)this.masterImages[numSeries]=this.selectedImages[numSeries].length;
} }
if (selectHiLowRes != null) { // if (selectHiLowRes != null) {
for (int i =0; i<this.distortionCalibrationData.getNumImages();i++) { // for (int i =0; i<this.distortionCalibrationData.getNumImages();i++) {
boolean low_res = this.distortionCalibrationData.isSmallSensor(i); // boolean low_res = this.distortionCalibrationData.isSmallSensor(i);
if ((low_res && !selectHiLowRes[1]) && (!low_res && !selectHiLowRes[0])){ // if ((low_res && !selectHiLowRes[1]) && (!low_res && !selectHiLowRes[0])){
this.selectedImages[numSeries][i]= false; // this.selectedImages[numSeries][i]= false;
} // }
} // }
} // }
if (useParameters) { if (useParameters) {
int [] lastGroups=null; int [] lastGroups=null;
for (int i =0; i<this.parameterEnable.length;i++) if (this.parameterEnable[i] && for (int i =0; i<this.parameterEnable.length;i++) if (this.parameterEnable[i] &&
(!zeroAndOther || (this.parameterList[i][0] <=1) || (this.parameterList[i][0]==24))){ // in "zeroAndOther" mode do not show other subcameras // (!zeroAndOther || (this.parameterList[i][0] <=1) || (this.parameterList[i][0]==24))){ // in "zeroAndOther" mode do not show other subcameras
// for (int i =0; i<this.parameterEnable.length;i++) if (this.parameterEnable[i]){ (!zeroAndOther || this.distortionCalibrationData.firstInGroup(this.parameterList[i][0]))){ // in "zeroAndOther" mode do not show other subcameras
this.parameterMode[numSeries][i]=gd.getNextChoiceIndex(); this.parameterMode[numSeries][i]=gd.getNextChoiceIndex();
// make adjustment for "same as (other lower numbered subcamera)" // make adjustment for "same as (other lower numbered subcamera)"
if ((choice_offsets[i] > 0) && (this.parameterMode[numSeries][i] >= choice_offsets[i])){ if ((choice_offsets[i] > 0) && (this.parameterMode[numSeries][i] >= choice_offsets[i])){
System.out.print("selectStrategyStep(): choice_offsets["+i+"]="+choice_offsets[i]+ " this.parameterMode["+numSeries+"]["+i+"]=" + this.parameterMode[numSeries][i]); System.out.print("selectStrategyStep(): choice_offsets["+i+"]="+choice_offsets[i]+ " this.parameterMode["+numSeries+"]["+i+"]=" + this.parameterMode[numSeries][i]);
this.parameterMode[numSeries][i] += (this.definedModesAll.length - choice_offsets[i]); this.parameterMode[numSeries][i] += (this.definedModesAll.length - choice_offsets[i]);
System.out.println(", corrected=" + this.parameterMode[numSeries][i]); System.out.println(", corrected=" + this.parameterMode[numSeries][i]);
} }
if (this.parameterMode[numSeries][i]==this.modeGroup) { if (this.parameterMode[numSeries][i]==modeGroup) {
if (this.parameterGroups[numSeries][i]!=null) lastGroups=this.parameterGroups[numSeries][i]; // default groups if (this.parameterGroups[numSeries][i]!=null) lastGroups=this.parameterGroups[numSeries][i]; // default groups
else if (lastGroups!=null) this.parameterGroups[numSeries][i]=lastGroups.clone(); // may be null else if (lastGroups!=null) this.parameterGroups[numSeries][i]=lastGroups.clone(); // may be null
selectGroups(numSeries,i); selectGroups(numSeries,i);
...@@ -2386,13 +2486,16 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit ...@@ -2386,13 +2486,16 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
} }
if (zeroAndOther){ if (zeroAndOther){
for (int i =0; i<this.parameterEnable.length;i++) { for (int i =0; i<this.parameterEnable.length;i++) {
if ((this.parameterList[i][0]>1) && (this.parameterList[i][0]!=24)){ // "other" subchannels - copy from subchannel1 // if ((this.parameterList[i][0]>1) && (this.parameterList[i][0]!=24)){ // "other" subchannels - copy from subchannel1
int refChannel=(this.parameterList[i][0]<24)?1:24; if (!this.distortionCalibrationData.firstInGroup(this.parameterList[i][0])){ // "other" subchannels - copy from subchannel1
// int refChannel=(this.parameterList[i][0]<24)?1:24;
int refChannel= this.distortionCalibrationData.masterSub(this.parameterList[i][0]);
int iSub1=getParameterNumber(refChannel, this.parameterList[i][1]); int iSub1=getParameterNumber(refChannel, this.parameterList[i][1]);
if (this.parameterEnable[iSub1]){ if (this.parameterEnable[iSub1]){
// System.out.println( "parameter number="+i+" this.parameterList[i][0]="+this.parameterList[i][0]+" this.parameterList[i][1]="+this.parameterList[i][1]+" iSub1="+iSub1); // System.out.println( "parameter number="+i+" this.parameterList[i][0]="+this.parameterList[i][0]+" this.parameterList[i][1]="+this.parameterList[i][1]+" iSub1="+iSub1);
this.parameterMode[numSeries][i]=this.parameterMode[numSeries][iSub1]; this.parameterMode[numSeries][i]=this.parameterMode[numSeries][iSub1];
if (this.parameterMode[numSeries][i]==this.modeGroup) { // copy groups from channel 1 if (this.parameterMode[numSeries][i]==modeGroup) { // copy groups from channel 1
if (this.parameterGroups[numSeries][i]!=null) this.parameterGroups[numSeries][i]=this.parameterGroups[numSeries][iSub1].clone(); // may be null if (this.parameterGroups[numSeries][i]!=null) this.parameterGroups[numSeries][i]=this.parameterGroups[numSeries][iSub1].clone(); // may be null
else this.parameterGroups[numSeries][i]=null; else this.parameterGroups[numSeries][i]=null;
} }
...@@ -2557,7 +2660,7 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit ...@@ -2557,7 +2660,7 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
gd.addCheckbox ("Select parameters",selectParameters); gd.addCheckbox ("Select parameters",selectParameters);
gd.addCheckbox ("Ask for initial lambda",askLambdas); gd.addCheckbox ("Ask for initial lambda",askLambdas);
gd.addCheckbox ("Ask for parameter mask",askParameterMask); gd.addCheckbox ("Ask for parameter mask",askParameterMask);
gd.addCheckbox ("Use only channel 0 and \"all other channels\"",zeroAndOther); gd.addCheckbox ("Use only 'master' channels",zeroAndOther);
gd.addCheckbox ("Ask for next series",askNextSeries); gd.addCheckbox ("Ask for next series",askNextSeries);
if (oldLength>0) gd.addNumericField("Increase number of series in this strategy", oldLength, 0); if (oldLength>0) gd.addNumericField("Increase number of series in this strategy", oldLength, 0);
gd.enableYesNoCancel("OK", "Done"); gd.enableYesNoCancel("OK", "Done");
...@@ -2594,44 +2697,45 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit ...@@ -2594,44 +2697,45 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
return true; return true;
} }
//TODO: Use Tabbed dialog
public boolean setParameterSelectionMask(boolean zeroAndOther){ public boolean setParameterSelectionMask(boolean zeroAndOther){
GenericDialog gd = new GenericDialog("Set Parameter Selection Mask"); GenericDialog gd = new GenericDialog("Set Parameter Selection Mask");
gd.addMessage("Common parameters and sub-camera 0 parameters"); // gd.addMessage("Common parameters and sub-camera 0 parameters");
int subCam=0; // gd.addMessage("Common parameters");
boolean showParameter=true; int lastSub = -2;
boolean [] show_parameter = new boolean[this.parameterList.length];
for (int i=0;i<this.parameterList.length;i++){ for (int i=0;i<this.parameterList.length;i++){
if (this.parameterList[i][0]!=subCam){ show_parameter[i]=true;
subCam=this.parameterList[i][0]; int subCam = this.parameterList[i][0];
int parIndex=this.parameterList[i][1];
boolean isSub=this.distortionCalibrationData.isSubcameraParameter(parIndex);
if (!isSub) subCam = -1;
show_parameter[i] = true; // show all non-subcamera parameters
if (subCam >= 0) {
if (zeroAndOther) { if (zeroAndOther) {
showParameter=true; if (this.distortionCalibrationData.firstInGroup(subCam)) {
if (subCam==1) gd.addMessage("Other sub-cameras parameters"); if (subCam != lastSub) gd.addMessage(this.distortionCalibrationData.getSubName(subCam,true));
else if (subCam==24) gd.addMessage("Bottom sub-cameras parameters"); } else {
// else break; show_parameter[i] = false;
else {
showParameter=false;
// continue;
} }
} else { } else {
gd.addMessage("Sub-camera "+subCam+" parameters"); gd.addMessage("Sub-camera "+subCam+" parameters");
} }
} else {
if (subCam != lastSub) gd.addMessage("Common parameters");
}
lastSub = subCam;
if (show_parameter[i]) {
gd.addCheckbox (this.distortionCalibrationData.getParameterName(parameterList[i][1]),this.parameterEnable[i]);
} }
if (showParameter) gd.addCheckbox (this.distortionCalibrationData.getParameterName(parameterList[i][1]),this.parameterEnable[i]);
} }
WindowTools.addScrollBars(gd); WindowTools.addScrollBars(gd);
// gd.setBackground(Color.white); // gd.setBackground(Color.white);
gd.showDialog(); gd.showDialog();
if (gd.wasCanceled()) return false; if (gd.wasCanceled()) return false;
subCam=0; //May add disabling all other subcameras, but try keeping it for later running with zeroAndOther==false
showParameter=true; for (int i=0;i<this.parameterList.length;i++) if(show_parameter[i]) {
//May add disablong all other subcameras, but try keeping it for later running with zeroAndOther==false this.parameterEnable[i]=gd.getNextBoolean();
for (int i=0;i<this.parameterList.length;i++){
if (this.parameterList[i][0]!=subCam){
subCam=this.parameterList[i][0];
showParameter=true;
// if (subCam>1) break;
if ((subCam>1) && (subCam!=24)) showParameter=false;
}
if (showParameter) this.parameterEnable[i]=gd.getNextBoolean();
} }
return true; return true;
} }
......
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