Commit 3fd21c81 authored by Andrey Filippov's avatar Andrey Filippov

fixing bugs for variable images per set (e.g. eo only)

parent 9c63f90b
...@@ -615,6 +615,12 @@ public static MatchSimulatedPattern.DistortionParameters DISTORTION =new MatchSi ...@@ -615,6 +615,12 @@ public static MatchSimulatedPattern.DistortionParameters DISTORTION =new MatchSi
public static double [][][][] PSF_KERNEL_MAP=null; // remove? public static double [][][][] PSF_KERNEL_MAP=null; // remove?
public static String [] COMPONENT_COLOR_NAMES={"green1","red","blue","green2", "greens (diagonal)", "greens (checker)"}; public static String [] COMPONENT_COLOR_NAMES={"green1","red","blue","green2", "greens (diagonal)", "greens (checker)"};
public static String [] STACK_COLOR_NAMES={"red","green","blue"}; public static String [] STACK_COLOR_NAMES={"red","green","blue"};
// last used values for dialogs to suggest next time
public int LASTUSED_RECALIB_SET = -1;
public int LASTUSED_RECALIB_CHN = -1;
public int LASTUSED_MAN_HINT = -1;
/** /**
* DIST_ARRAY: * DIST_ARRAY:
* [v][u][0][0] - pixel x of the grid node u,v * [v][u][0][0] - pixel x of the grid node u,v
...@@ -9379,12 +9385,12 @@ if (MORE_BUTTONS) { ...@@ -9379,12 +9385,12 @@ if (MORE_BUTTONS) {
} }
LENS_DISTORTIONS.debugLevel=DEBUG_LEVEL; LENS_DISTORTIONS.debugLevel=DEBUG_LEVEL;
GenericDialog gd=new GenericDialog("Select grid image to add manual hint"); GenericDialog gd=new GenericDialog("Select grid image to add manual hint");
gd.addNumericField("Grid Image index", 0,0); gd.addNumericField("Grid Image index", LASTUSED_MAN_HINT,0);
gd.showDialog(); gd.showDialog();
if (gd.wasCanceled()) return; if (gd.wasCanceled()) return;
int numGridImage= (int) gd.getNextNumber(); int numGridImage= (int) gd.getNextNumber();
LASTUSED_MAN_HINT = numGridImage;
LENS_DISTORTIONS.manualGridHint(numGridImage); LENS_DISTORTIONS.manualGridHint(numGridImage);
return; return;
} }
...@@ -9552,13 +9558,32 @@ if (MORE_BUTTONS) { ...@@ -9552,13 +9558,32 @@ if (MORE_BUTTONS) {
public boolean recalibrateSet() { public boolean recalibrateSet() {
int imageSetNumber = LASTUSED_RECALIB_SET;
int sel_chn = LASTUSED_RECALIB_CHN;
boolean reEstimate= true;
boolean use_eo = true;
boolean use_lwir = true;
// double grid_mismatch = 0.1;
GenericDialog gd=new GenericDialog ("Select image set to re-calibrate"); GenericDialog gd=new GenericDialog ("Select image set to re-calibrate");
gd.addNumericField("Image set number", 0, 0); gd.addNumericField("Image set number", imageSetNumber, 0);
gd.addCheckbox ("Set image set parameters from closest, (re-)estimate orientation", true); gd.addCheckbox ("Set image set parameters from closest, (re-)estimate orientation", reEstimate);
gd.addCheckbox ("Use RGB grids for matching", use_eo);
gd.addCheckbox ("Use LWIR grids for matching", use_lwir);
gd.addNumericField("Use single channel (<0 - use all unfiltered)", sel_chn, 0);
// TODO: distribute results to unselected images
// gd.addNumericField("Remove outlier channels if relative grid mismatch is above ", grid_mismatch, 2,6,"");
gd.showDialog(); gd.showDialog();
if (gd.wasCanceled()) return false; if (gd.wasCanceled()) return false;
int imageSetNumber=(int) gd.getNextNumber(); imageSetNumber=(int) gd.getNextNumber();
boolean reEstimate=gd.getNextBoolean(); reEstimate=gd.getNextBoolean();
use_eo = gd.getNextBoolean();
use_lwir = gd.getNextBoolean();
sel_chn =(int) gd.getNextNumber();
LASTUSED_RECALIB_SET = imageSetNumber;
LASTUSED_RECALIB_CHN = sel_chn;
// grid_mismatch = gd.getNextNumber();
if (imageSetNumber<0) return false; if (imageSetNumber<0) return false;
if (reEstimate){ if (reEstimate){
// boolean OK= // boolean OK=
...@@ -9617,12 +9642,25 @@ if (MORE_BUTTONS) { ...@@ -9617,12 +9642,25 @@ if (MORE_BUTTONS) {
useSetsData= gd.getNextBoolean(); useSetsData= gd.getNextBoolean();
processAllImages= gd.getNextBoolean(); processAllImages= gd.getNextBoolean();
// Find channel with most weight // Find channel with most weight ???
LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.gIS[imageSetNumber].goniometerTilt=tiltCenter; LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.gIS[imageSetNumber].goniometerTilt=tiltCenter;
LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.gIS[imageSetNumber].goniometerAxial=axialCenter; LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.gIS[imageSetNumber].goniometerAxial=axialCenter;
LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.gIS[imageSetNumber].interAxisAngle=interCenter; LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.gIS[imageSetNumber].interAxisAngle=interCenter;
// Run once with center position or Goniometer angles to determine average derivatives // Run once with center position or Goniometer angles to determine average derivatives
int [][] imageSets=LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.listImages(!processAllImages); int tmask = (use_eo ? 1 : 0) + (use_lwir ? 2 : 0);
int [] type_map = LWIR_PARAMETERS.getTypeMap(); // 0 - eo, 1 -0 lwir
boolean [] chn_sel = new boolean [type_map.length];
if (sel_chn >= 0) {
chn_sel[sel_chn] = true;
} else {
for (int chn = 0; chn < chn_sel.length; chn++) {
chn_sel[chn] = (tmask & ( 1 << type_map[chn])) != 0;
}
}
int [][] imageSets=LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.listImages(
!processAllImages,
chn_sel
);
int [] imageSet=imageSets[imageSetNumber]; int [] imageSet=imageSets[imageSetNumber];
if (imageSet==null){ if (imageSet==null){
IJ.showMessage("Image set #"+imageSetNumber+" is empty"); IJ.showMessage("Image set #"+imageSetNumber+" is empty");
...@@ -9727,7 +9765,9 @@ if (MORE_BUTTONS) { ...@@ -9727,7 +9765,9 @@ if (MORE_BUTTONS) {
" Initial tilt=" + tilt0+ " Initial tilt=" + tilt0+
" Initial axial=" + axial0+ " Initial axial=" + axial0+
" Initial inter=" + interCenter); " Initial inter=" + interCenter);
imageSets=LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.listImages(!processAllImages); imageSets=LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.listImages(
!processAllImages,
chn_sel);
imageSet=imageSets[imageSetNumber]; imageSet=imageSets[imageSetNumber];
if (imageSet==null){ if (imageSet==null){
IJ.showMessage("Image set #"+imageSetNumber+" is empty"); IJ.showMessage("Image set #"+imageSetNumber+" is empty");
...@@ -9806,7 +9846,9 @@ if (MORE_BUTTONS) { ...@@ -9806,7 +9846,9 @@ if (MORE_BUTTONS) {
" Initial axial="+best_axial+ " Initial axial="+best_axial+
" Initial inter="+best_inter " Initial inter="+best_inter
); );
imageSets=LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.listImages(!processAllImages); imageSets=LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.listImages(
!processAllImages,
chn_sel);
imageSet=imageSets[imageSetNumber]; imageSet=imageSets[imageSetNumber];
if (imageSet==null){ if (imageSet==null){
IJ.showMessage("Image set #"+imageSetNumber+" is empty"); IJ.showMessage("Image set #"+imageSetNumber+" is empty");
...@@ -10172,21 +10214,34 @@ if (MORE_BUTTONS) { ...@@ -10172,21 +10214,34 @@ if (MORE_BUTTONS) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL; DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
LENS_DISTORTIONS=new Distortions(LENS_DISTORTION_PARAMETERS,PATTERN_PARAMETERS,REFINE_PARAMETERS,this.SYNC_COMMAND.stopRequested); LENS_DISTORTIONS=new Distortions(LENS_DISTORTION_PARAMETERS,PATTERN_PARAMETERS,REFINE_PARAMETERS,this.SYNC_COMMAND.stopRequested);
// Maybe wrong ! Use folders that have at least all EO channels? // Maybe wrong ! Use folders that have at least all EO channels?
int min_files = lwirReaderParameters.getNumChannels();// 8; // use folders that have all 8 files // int min_files = lwirReaderParameters.getNumChannels();// 8; // use folders that have all 8 files
int [] type_map = lwirReaderParameters.getTypeMap(); // 0 - eo, 1 -0 lwir
int lwir_chn0 = lwirReaderParameters.getLwirChn0(); int lwir_chn0 = lwirReaderParameters.getLwirChn0();
int eo_chn0 = lwirReaderParameters.getEoChn0(); int eo_chn0 = lwirReaderParameters.getEoChn0();
int numStations = 3; int numStations = 3;
boolean allornone_all = false;
boolean allornone_eo = true;
boolean allornone_lwir = true;
GenericDialog gd = new GenericDialog("Setup Goniometer/Camera Stations"); GenericDialog gd = new GenericDialog("Setup Goniometer/Camera Stations");
gd.addMessage("Setting up calibration that includes multiple camera tripod or goniometer positions."); gd.addMessage ("Setting up calibration that includes multiple camera tripod or goniometer positions.");
gd.addMessage("File selection dialog will open for each station separateley."); gd.addMessage ("File selection dialog will open for each station separateley.");
gd.addNumericField("Number of goniometer/camera stations", numStations,0); gd.addNumericField("Number of goniometer/camera stations", numStations,0);
gd.addMessage("lwir_chn0 = "+lwir_chn0); gd.addMessage ("lwir_chn0 = "+lwir_chn0);
gd.addMessage("eo_chn0 = "+eo_chn0); gd.addMessage ("eo_chn0 = "+eo_chn0);
gd.addMessage("min_files = "+min_files); // gd.addMessage ("min_files = "+min_files);
gd.addCheckbox ("Process only sets with all channels present", allornone_all);
gd.addCheckbox ("Process eo channels in a set only if all eo channels are present", allornone_eo);
gd.addCheckbox ("Process lwir channels in a set only if all lwir channels are present", allornone_lwir);
gd.showDialog(); gd.showDialog();
if (gd.wasCanceled()) return false; if (gd.wasCanceled()) return false;
numStations= (int) gd.getNextNumber(); numStations= (int) gd.getNextNumber();
allornone_all = gd.getNextBoolean();
allornone_eo = gd.getNextBoolean();
allornone_lwir = gd.getNextBoolean();
// String [] grid_extensions={".tif",".tiff"}; // String [] grid_extensions={".tif",".tiff"};
// String [] src_extensions={".tif",".tiff"}; // String [] src_extensions={".tif",".tiff"};
String [] grid_extensions={".tiff"}; String [] grid_extensions={".tiff"};
...@@ -10200,12 +10255,14 @@ if (MORE_BUTTONS) { ...@@ -10200,12 +10255,14 @@ if (MORE_BUTTONS) {
// new CalibrationFileManagement.DirectoryContentsFilter (gridFilter, min_files, 0, null); // new CalibrationFileManagement.DirectoryContentsFilter (gridFilter, min_files, 0, null);
String [][] gridFileDirs= new String [numStations][]; String [][] gridFileDirs= new String [numStations][];
// int [][] gridUseTypes = new int [numStations][]; // +1 - use eo channels,+2 - use lwir channels (in pointed set)
boolean [][][] gridUseChn = new boolean [numStations][][]; // channels to use in each scene
String [] sourceStationDirs = new String [numStations]; // directories of the source files per station String [] sourceStationDirs = new String [numStations]; // directories of the source files per station
for (int numStation=0;numStation<numStations;numStation++){ for (int numStation=0;numStation<numStations;numStation++){
DirectoryChoser dc = new DirectoryChoser( DirectoryChoser dc = new DirectoryChoser(
gridFilter, gridFilter,
min_files, // not actually used type_map.length, // min_files, // not actually used
0, 0,
null); null);
dc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); dc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
...@@ -10219,11 +10276,56 @@ if (MORE_BUTTONS) { ...@@ -10219,11 +10276,56 @@ if (MORE_BUTTONS) {
dc.setCurrentDirectory(cur_dir); dc.setCurrentDirectory(cur_dir);
int returnVal = dc.showOpenDialog(IJ.getInstance()); int returnVal = dc.showOpenDialog(IJ.getInstance());
if (returnVal!=JFileChooser.APPROVE_OPTION) return false; if (returnVal!=JFileChooser.APPROVE_OPTION) return false;
File [] files = dc.getSelectedFiles(); File [] files = dc.getSelectedFiles(); // set directory nome
if (files.length<1) return false; if (files.length<1) return false;
// Can not make it work correctly with multiple selection, giving up for now // Can not make it work correctly with multiple selection, giving up for now
ArrayList<File> filelist = new ArrayList<File>(); class ScenePathChnFilter{
for (int nFile=0;nFile<files.length;nFile++) { File file;
boolean [] channels;
ScenePathChnFilter(File file, boolean [] channels){
this.file=file;
this.channels = channels; // clone?
}
}
// ArrayList<File> setlist = new ArrayList<File>();
// ArrayList<Integer> settypes = new ArrayList<Integer>();
ArrayList<ScenePathChnFilter> setlist = new ArrayList<ScenePathChnFilter>();
for (int nSet=0;nSet<files.length;nSet++) { // nfile - scene number
String [] sfiles = files[nSet].list(gridFilter);
boolean [] avail_chn = new boolean[type_map.length];
for (String sfile: sfiles) {
avail_chn[DistortionCalibrationData.pathToChannel(sfile)] = true;
}
boolean [] all_type = {true, true};
boolean [] some_type = {false, false};
for (int i = 0; i < avail_chn.length; i++) {
if (avail_chn[i]) {
some_type[type_map[i]] = true;
} else {
all_type[type_map[i]] = false;
}
}
if (allornone_all && !(all_type[0] && all_type[1])) {
some_type[0] = false;
some_type[1] = false;
}
if (allornone_eo) some_type[0] = all_type[0];
if (allornone_lwir) some_type[1] = all_type[1];
if (some_type[0] || some_type[1]) {
for (int i = 0; i < avail_chn.length; i++) {
avail_chn[i] &= some_type[type_map[i]];
}
setlist.add(new ScenePathChnFilter(files[nSet], avail_chn));
// setlist.add(files[nSet]);
// settypes.add((some_type[0]?1:0)+(some_type[1]?2:0));
}
/*
// for (int nFile=0;nFile<files.length;nFile++) {
int num_match = files[nFile].list(gridFilter).length; int num_match = files[nFile].list(gridFilter).length;
if (num_match >= min_files) { if (num_match >= min_files) {
filelist.add(files[nFile]); filelist.add(files[nFile]);
...@@ -10235,11 +10337,20 @@ if (MORE_BUTTONS) { ...@@ -10235,11 +10337,20 @@ if (MORE_BUTTONS) {
// } // }
// System.out.println(""); // System.out.println("");
} }
*/
} }
/*
int chn = pathToChannel(path);
gridFileDirs[numStation]=new String[filelist.size()]; */
for (int nFile=0;nFile<gridFileDirs[numStation].length;nFile++) { gridFileDirs[numStation]=new String[setlist.size()];
gridFileDirs[numStation][nFile]= filelist.get(nFile).getPath(); gridUseChn[numStation]=new boolean [gridFileDirs[numStation].length][];
for (int nSet=0;nSet<gridFileDirs[numStation].length;nSet++) {
ScenePathChnFilter scene = setlist.get(nSet);
gridFileDirs[numStation][nSet]= scene.file.getPath();
gridUseChn[numStation][nSet] = scene.channels;
// gridFileDirs[numStation][nSet]= setlist.get(nSet).getPath();
// gridUseTypes[numStation][nSet]=settypes.get(nSet);
} }
if ((gridFileDirs[numStation]==null) || (gridFileDirs[numStation].length==0)) { if ((gridFileDirs[numStation]==null) || (gridFileDirs[numStation].length==0)) {
if (!IJ.showMessageWithCancel("No files selected","Retry? (Cancel will abort the command)")) return false; if (!IJ.showMessageWithCancel("No files selected","Retry? (Cancel will abort the command)")) return false;
...@@ -10279,6 +10390,8 @@ if (MORE_BUTTONS) { ...@@ -10279,6 +10390,8 @@ if (MORE_BUTTONS) {
DISTORTION_CALIBRATION_DATA=new DistortionCalibrationData( // new way for LWIR - initialize from dirs DISTORTION_CALIBRATION_DATA=new DistortionCalibrationData( // new way for LWIR - initialize from dirs
gridFileDirs, gridFileDirs,
gridUseChn, //
// gridUseTypes, //int [][] gridUseTypes, // per station, per set - a bitbmask of channels to use (+1 - eo, +2 - lwir)
sourceStationDirs, sourceStationDirs,
gridFilter, gridFilter,
sourceFilter, sourceFilter,
...@@ -10476,12 +10589,16 @@ if (MORE_BUTTONS) { ...@@ -10476,12 +10589,16 @@ if (MORE_BUTTONS) {
IJ.d2s(0.000000001*(System.nanoTime()-startFileTime),3)+"s )\n"); IJ.d2s(0.000000001*(System.nanoTime()-startFileTime),3)+"s )\n");
// //
if (this.SYNC_COMMAND.stopRequested.get()>0) { if (this.SYNC_COMMAND.stopRequested.get() > 0) {
System.out.println("User requested stop"); System.out.println("User requested stop");
break; break;
} }
saved_file++; saved_file++;
} }
if (this.SYNC_COMMAND.stopRequested.get() > 0) {
System.out.println("User requested stop2");
break;
}
} }
if (DEBUG_LEVEL>0) System.out.println(((this.SYNC_COMMAND.stopRequested.get()>0)?"Partial (interrupted by user) set of grids":"All")+ " grids calculation done at "+ IJ.d2s(0.000000001*(System.nanoTime()-startTime),3)); if (DEBUG_LEVEL>0) System.out.println(((this.SYNC_COMMAND.stopRequested.get()>0)?"Partial (interrupted by user) set of grids":"All")+ " grids calculation done at "+ IJ.d2s(0.000000001*(System.nanoTime()-startTime),3));
return; return;
...@@ -92,6 +92,18 @@ import ij.text.TextWindow; ...@@ -92,6 +92,18 @@ import ij.text.TextWindow;
public boolean updateStatus=true; public boolean updateStatus=true;
public int debugLevel=2; public int debugLevel=2;
private ShowDoubleFloatArrays SDFA_INSTANCE=null; // just for debugging private ShowDoubleFloatArrays SDFA_INSTANCE=null; // just for debugging
public static int pathToChannel(String path) {
int last_dash = path.lastIndexOf('-');
int last = path.lastIndexOf('_');
if (last_dash >last) last = last_dash;
int last_dot = path.lastIndexOf('.');
if (last_dot < 0) {
last_dot = path.length();
}
return Integer.parseInt(path.substring(last+1, last_dot));
}
public int getNumStations(){ public int getNumStations(){
return (eyesisCameraParameters==null)?0:eyesisCameraParameters.getNumStations(); return (eyesisCameraParameters==null)?0:eyesisCameraParameters.getNumStations();
} }
...@@ -838,20 +850,24 @@ import ij.text.TextWindow; ...@@ -838,20 +850,24 @@ import ij.text.TextWindow;
} }
public DistortionCalibrationData ( public DistortionCalibrationData (
String [][] stationFilenames, String [][] stationFilenames,
String [] source_dirs, // directories of the source files per station boolean [][][] gridUseChn, // per station, per set - a bmask of permitted channels
MultipleExtensionsFileFilter gridFilter, // int [][] gridUseTypes, // per station, per set - a bitbmask of channels to use (+1 - eo, +2 - lwir)
MultipleExtensionsFileFilter sourceFilter, String [] source_dirs, // directories of the source files per station
PatternParameters patternParameters, MultipleExtensionsFileFilter gridFilter,
EyesisCameraParameters eyesisCameraParameters, MultipleExtensionsFileFilter sourceFilter,
LaserPointer laserPointers, // as a backup if data is not available in the file PatternParameters patternParameters,
Goniometer.GoniometerParameters goniometerParameters, EyesisCameraParameters eyesisCameraParameters,
boolean read_grids, LaserPointer laserPointers, // as a backup if data is not available in the file
int debugLevel Goniometer.GoniometerParameters goniometerParameters,
boolean read_grids,
int debugLevel
) { ) {
this.debugLevel=debugLevel; this.debugLevel=debugLevel;
setupDirDistortionCalibrationData( setupDirDistortionCalibrationData(
stationFilenames, stationFilenames,
gridUseChn, // per station, per set - a bmask of permitted channels
// gridUseTypes, // per station, per set - a bitbmask of channels to use (+1 - eo, +2 - lwir)
source_dirs, // directories of the source files per station source_dirs, // directories of the source files per station
gridFilter, gridFilter,
sourceFilter, sourceFilter,
...@@ -933,6 +949,7 @@ import ij.text.TextWindow; ...@@ -933,6 +949,7 @@ import ij.text.TextWindow;
// from data organized as image sets // from data organized as image sets
public static int getChannelFromPath(String path) { public static int getChannelFromPath(String path) {
// int indexSuffix=path.length()-suffix.length(); // int indexSuffix=path.length()-suffix.length();
if (path == null) return -1;
int indexSuffix = path.lastIndexOf("."); int indexSuffix = path.lastIndexOf(".");
int indexLastDash=indexSuffix-1; int indexLastDash=indexSuffix-1;
while ((indexLastDash>0) && while ((indexLastDash>0) &&
...@@ -950,15 +967,17 @@ import ij.text.TextWindow; ...@@ -950,15 +967,17 @@ import ij.text.TextWindow;
} }
public void setupDirDistortionCalibrationData ( public void setupDirDistortionCalibrationData (
String [][] stationFilenames, // per-station List of image set directories String [][] stationFilenames, // per-station List of image set directories
String [] source_dirs, // directories of the source files per station boolean [][][] gridUseChn, // per station, per set - a bmask of permitted channels
MultipleExtensionsFileFilter gridFilter, // int [][] gridUseTypes, // per station, per set - a bitbmask of channels to use (+1 - eo, +2 - lwir)
MultipleExtensionsFileFilter sourceFilter, String [] source_dirs, // directories of the source files per station
PatternParameters patternParameters, MultipleExtensionsFileFilter gridFilter,
EyesisCameraParameters eyesisCameraParameters, MultipleExtensionsFileFilter sourceFilter,
LaserPointer laserPointers, // as a backup if data is not available in the file PatternParameters patternParameters,
EyesisCameraParameters eyesisCameraParameters,
LaserPointer laserPointers, // as a backup if data is not available in the file
Goniometer.GoniometerParameters goniometerParameters, Goniometer.GoniometerParameters goniometerParameters,
boolean read_grids boolean read_grids
) { ) {
class DirTs{ class DirTs{
int station; int station;
...@@ -971,6 +990,7 @@ import ij.text.TextWindow; ...@@ -971,6 +990,7 @@ import ij.text.TextWindow;
String [] getSourcePaths() {return spaths;} // may not be null String [] getSourcePaths() {return spaths;} // may not be null
DirTs(int station, DirTs(int station,
String dir, // grid image set directory that contains channel files (may be different timestamps) String dir, // grid image set directory that contains channel files (may be different timestamps)
boolean [] permitted_channels, // bitmask of permitted channels (lwir/eo), or null - use nay
String sdir, // source super directory that contains image set directories with files String sdir, // source super directory that contains image set directories with files
int num_chn, int num_chn,
MultipleExtensionsFileFilter gridFilter, MultipleExtensionsFileFilter gridFilter,
...@@ -993,6 +1013,7 @@ import ij.text.TextWindow; ...@@ -993,6 +1013,7 @@ import ij.text.TextWindow;
String [] files = (new File(dir)).list(gridFilter); // are these full files? String [] files = (new File(dir)).list(gridFilter); // are these full files?
paths = new String[num_chn]; paths = new String[num_chn];
for (String path:files) { for (String path:files) {
/*
int last_dash = path.lastIndexOf('-'); int last_dash = path.lastIndexOf('-');
int last = path.lastIndexOf('_'); int last = path.lastIndexOf('_');
if (last_dash >last) last = last_dash; if (last_dash >last) last = last_dash;
...@@ -1001,7 +1022,11 @@ import ij.text.TextWindow; ...@@ -1001,7 +1022,11 @@ import ij.text.TextWindow;
last_dot = path.length(); last_dot = path.length();
} }
int chn = Integer.parseInt(path.substring(last+1, last_dot)); int chn = Integer.parseInt(path.substring(last+1, last_dot));
paths[chn] = (new File(dir,path)).getPath(); */
int chn = pathToChannel(path);
if ((permitted_channels == null) || (permitted_channels[chn])) {
paths[chn] = (new File(dir,path)).getPath();
}
//grid-elphelimg_1559195695_507621_4.tiff //grid-elphelimg_1559195695_507621_4.tiff
} }
spaths = new String[num_chn]; spaths = new String[num_chn];
...@@ -1014,6 +1039,7 @@ import ij.text.TextWindow; ...@@ -1014,6 +1039,7 @@ import ij.text.TextWindow;
System.out.println("sfiles == null"); System.out.println("sfiles == null");
} }
for (String spath:sfiles) { for (String spath:sfiles) {
/*
int last_dash = spath.lastIndexOf('-'); int last_dash = spath.lastIndexOf('-');
int last = spath.lastIndexOf('_'); int last = spath.lastIndexOf('_');
if (last_dash >last) last = last_dash; if (last_dash >last) last = last_dash;
...@@ -1022,6 +1048,8 @@ import ij.text.TextWindow; ...@@ -1022,6 +1048,8 @@ import ij.text.TextWindow;
last_dot = spath.length(); last_dot = spath.length();
} }
int chn = Integer.parseInt(spath.substring(last+1, last_dot)); int chn = Integer.parseInt(spath.substring(last+1, last_dot));
*/
int chn = pathToChannel(spath);
spaths[chn] = (new File(set_dir,spath)).getPath(); spaths[chn] = (new File(set_dir,spath)).getPath();
} }
} }
...@@ -1040,6 +1068,7 @@ import ij.text.TextWindow; ...@@ -1040,6 +1068,7 @@ import ij.text.TextWindow;
dirTsList.add(new DirTs( dirTsList.add(new DirTs(
numStation, numStation,
stationFilenames[numStation][is], // String dir, stationFilenames[numStation][is], // String dir,
gridUseChn[numStation][is], //
source_dirs[numStation], source_dirs[numStation],
numSubCameras, // int num_chn, numSubCameras, // int num_chn,
gridFilter, gridFilter,
...@@ -1297,7 +1326,8 @@ import ij.text.TextWindow; ...@@ -1297,7 +1326,8 @@ import ij.text.TextWindow;
// boolean invert_color = ((base_channel ^ nc) & 4) != 0; // boolean invert_color = ((base_channel ^ nc) & 4) != 0;
boolean invert_color = invertColor(base_channel) ^ invertColor(nc); // eyesisCameraParameters.isLWIR(main_channel); boolean invert_color = invertColor(base_channel) ^ invertColor(nc); // eyesisCameraParameters.isLWIR(main_channel);
if ((this.gIS[nis].imageSet[nc].matchedPointers <= 0) && (nc != base_channel)) { // Later add non-laser conditions if ( (this.gIS[nis].imageSet[nc] != null) &&
(this.gIS[nis].imageSet[nc].matchedPointers <= 0) && (nc != base_channel)) { // Later add non-laser conditions
int imgNum = this.gIS[nis].imageSet[nc].imgNumber; // with_pointers - base_channel + nc; int imgNum = this.gIS[nis].imageSet[nc].imgNumber; // with_pointers - base_channel + nc;
if (this.updateStatus) IJ.showStatus("Re-reading grid file "+(imgNum+1)+" (of "+(numFiles)+"): "+this.gIP[imgNum].path); if (this.updateStatus) IJ.showStatus("Re-reading grid file "+(imgNum+1)+" (of "+(numFiles)+"): "+this.gIP[imgNum].path);
if (this.debugLevel>-1) System.out.print(imgNum+"*("+this.gIP[imgNum].getStationNumber()+ if (this.debugLevel>-1) System.out.print(imgNum+"*("+this.gIP[imgNum].getStationNumber()+
...@@ -2442,16 +2472,36 @@ import ij.text.TextWindow; ...@@ -2442,16 +2472,36 @@ import ij.text.TextWindow;
* create list of image indices per image set * create list of image indices per image set
* @return array of image indices for each image set * @return array of image indices for each image set
*/ */
public int [][] listImages(boolean enabledOnly){ public int [][] listImages(
boolean enabledOnly,
//int type_mask // 0 - all, otherwise +1 - eo, +2 - lwir
boolean [] chn_sel // selected channels or null
){
int [][] imageSets = new int [this.gIS.length][]; int [][] imageSets = new int [this.gIS.length][];
for (int i=0;i<this.gIS.length;i++){ for (int i=0;i<this.gIS.length;i++){
int setSize=0; int setSize=0;
for (int n=0;n<this.gIS[i].imageSet.length;n++) if ((this.gIS[i].imageSet[n]!=null) && (this.gIS[i].imageSet[n].imgNumber>=0) && (!enabledOnly || this.gIS[i].imageSet[n].enabled)) setSize++; for (int n=0;n<this.gIS[i].imageSet.length;n++) {
if ( (this.gIS[i].imageSet[n]!=null) &&
(this.gIS[i].imageSet[n].imgNumber>=0) &&
(!enabledOnly || this.gIS[i].imageSet[n].enabled)) {
if ((chn_sel == null) || (chn_sel[this.gIS[i].imageSet[n].getChannel()])){
setSize++;
}
}
}
imageSets[i]=new int [setSize]; imageSets[i]=new int [setSize];
} }
for (int i=0;i<this.gIS.length;i++){ for (int i=0;i<this.gIS.length;i++){
int index=0; int index=0;
for (int n=0;n<this.gIS[i].imageSet.length;n++) if ((this.gIS[i].imageSet[n]!=null) && (this.gIS[i].imageSet[n].imgNumber>=0) && (!enabledOnly || this.gIS[i].imageSet[n].enabled)) imageSets[i][index++]=this.gIS[i].imageSet[n].imgNumber; for (int n=0;n<this.gIS[i].imageSet.length;n++) {
if ( (this.gIS[i].imageSet[n]!=null) &&
(this.gIS[i].imageSet[n].imgNumber>=0) &&
(!enabledOnly || this.gIS[i].imageSet[n].enabled)) {
if ((chn_sel == null) || (chn_sel[this.gIS[i].imageSet[n].getChannel()])){
imageSets[i][index++]=this.gIS[i].imageSet[n].imgNumber;
}
}
}
} }
return imageSets; return imageSets;
} }
...@@ -4466,7 +4516,7 @@ import ij.text.TextWindow; ...@@ -4466,7 +4516,7 @@ import ij.text.TextWindow;
} }
return small_sensors; return small_sensors;
} }
public boolean isSmallSensor(int numImg) { public boolean isSmallSensor(int numImg) { // number of image, not a channel!!!
boolean [] ss = getSmallSensors(); boolean [] ss = getSmallSensors();
if ((this.gIP != null) && (numImg >= 0) && (numImg < this.gIP.length)){ if ((this.gIP != null) && (numImg >= 0) && (numImg < this.gIP.length)){
return ss[this.gIP[numImg].getChannel()]; return ss[this.gIP[numImg].getChannel()];
......
...@@ -854,7 +854,9 @@ public class Distortions { ...@@ -854,7 +854,9 @@ public class Distortions {
double [] errors=calcErrors(calcYminusFx(this.currentfX)); double [] errors=calcErrors(calcYminusFx(this.currentfX));
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
null); // do not filter eo, lwir
boolean hasLWIR = this.fittingStrategy.distortionCalibrationData.hasSmallSensors(); boolean hasLWIR = this.fittingStrategy.distortionCalibrationData.hasSmallSensors();
int [] numSetPoints=new int [imageSets.length*(hasLWIR?2:1)]; int [] numSetPoints=new int [imageSets.length*(hasLWIR?2:1)];
...@@ -870,12 +872,13 @@ public class Distortions { ...@@ -870,12 +872,13 @@ public class Distortions {
int [] numInSet= {0,0}; int [] numInSet= {0,0};
hasNaNInSet[2*setNum]=false; hasNaNInSet[2*setNum]=false;
hasNaNInSet[2*setNum+1]=false; hasNaNInSet[2*setNum+1]=false;
for (int imgInSet=0;imgInSet<imageSets[setNum].length;imgInSet++) { for (int imgInSet=0;imgInSet<imageSets[setNum].length;imgInSet++) { // upper limit depends (now 4/20)
int imgNum=imageSets[setNum][imgInSet]; int imgNum=imageSets[setNum][imgInSet]; // image number
int isLwir = this.fittingStrategy.distortionCalibrationData.isSmallSensor(imgNum)?1:0; int chn = fittingStrategy.distortionCalibrationData.gIP[imgNum].getChannel();
int isLwir = fittingStrategy.distortionCalibrationData.isSmallSensor(imgNum)?1:0;
int num=numPairs[imgNum]; int num=numPairs[imgNum];
rmsPerImg[setNum][imgInSet] = errors[imgNum]; rmsPerImg[setNum][chn] = errors[imgNum];
numImgPoints[setNum][imgInSet] = num; numImgPoints[setNum][chn] = num;
if (Double.isNaN(errors[imgNum])){ if (Double.isNaN(errors[imgNum])){
hasNaNInSet[2 * setNum + isLwir]=true; hasNaNInSet[2 * setNum + isLwir]=true;
} else { } else {
...@@ -896,9 +899,10 @@ public class Distortions { ...@@ -896,9 +899,10 @@ public class Distortions {
hasNaNInSet[setNum]=false; hasNaNInSet[setNum]=false;
for (int imgInSet=0;imgInSet<imageSets[setNum].length;imgInSet++) { for (int imgInSet=0;imgInSet<imageSets[setNum].length;imgInSet++) {
int imgNum=imageSets[setNum][imgInSet]; int imgNum=imageSets[setNum][imgInSet];
int chn = fittingStrategy.distortionCalibrationData.gIP[imgNum].getChannel();
int num=numPairs[imgNum]; int num=numPairs[imgNum];
rmsPerImg[setNum][imgInSet] = errors[imgNum]; rmsPerImg[setNum][chn] = errors[imgNum];
numImgPoints[setNum][imgInSet] = num; numImgPoints[setNum][chn] = num;
if (Double.isNaN(errors[imgNum])){ if (Double.isNaN(errors[imgNum])){
hasNaNInSet[setNum]=true; hasNaNInSet[setNum]=true;
} else { } else {
...@@ -1040,9 +1044,10 @@ public class Distortions { ...@@ -1040,9 +1044,10 @@ public class Distortions {
debugLevel); debugLevel);
String [] titles={"X-corr(pix)","Y-corr(pix)","weight","Red","Green","Blue"}; String [] titles={"X-corr(pix)","Y-corr(pix)","weight","Red","Green","Blue"};
for (int numChn=0;numChn<sensorXYRGBCorr.length;numChn++) if (sensorXYRGBCorr[numChn]!=null){ for (int numChn=0;numChn<sensorXYRGBCorr.length;numChn++) if (sensorXYRGBCorr[numChn]!=null){
boolean small_sensor = fittingStrategy.distortionCalibrationData.isSmallSensor(numChn); // boolean small_sensor = fittingStrategy.distortionCalibrationData.isSmallSensor(numChn);
boolean small_sensor = fittingStrategy.distortionCalibrationData.getSmallSensors()[numChn];
RefineParameters rp = small_sensor ? refineParameters.refineParametersSmall : refineParameters; RefineParameters rp = small_sensor ? refineParameters.refineParametersSmall : refineParameters;
int decimate=getDecimateMasks(numChn); int decimate=getDecimateMasks(numChn); // Reduce for LWIR? Make form sensor width?
int sWidth= (getSensorWidth(numChn)-1)/decimate+1; int sWidth= (getSensorWidth(numChn)-1)/decimate+1;
if (rp.showUnfilteredCorrection && enableShow) { // && this.refineParameters.showUnfilteredCorrection) { if (rp.showUnfilteredCorrection && enableShow) { // && this.refineParameters.showUnfilteredCorrection) {
showWithRadialTangential( showWithRadialTangential(
...@@ -1750,7 +1755,9 @@ public class Distortions { ...@@ -1750,7 +1755,9 @@ public class Distortions {
){ ){
if (this.pixelCorrection==null) return; // no modifications are needed if (this.pixelCorrection==null) return; // no modifications are needed
for (int i=0;i<sensorXYCorr.length;i++) if ((sensorXYCorr[i]!=null) && (this.pixelCorrection[i]!=null)) { for (int i=0;i<sensorXYCorr.length;i++) if ((sensorXYCorr[i]!=null) && (this.pixelCorrection[i]!=null)) {
boolean small_sensor = fittingStrategy.distortionCalibrationData.isSmallSensor(i); // boolean small_sensor = fittingStrategy.distortionCalibrationData.isSmallSensor(i);
boolean small_sensor = fittingStrategy.distortionCalibrationData.getSmallSensors()[i];
RefineParameters rp = small_sensor ? refineParameters.refineParametersSmall : refineParameters; RefineParameters rp = small_sensor ? refineParameters.refineParametersSmall : refineParameters;
// if (rp.sensorExtrapolateDiff ^ invert) { // add current correction AFTER extrapolationg/bluring // if (rp.sensorExtrapolateDiff ^ invert) { // add current correction AFTER extrapolationg/bluring
double scale = rp.correctionScale; double scale = rp.correctionScale;
...@@ -1990,7 +1997,8 @@ public class Distortions { ...@@ -1990,7 +1997,8 @@ public class Distortions {
for (int imgNum=imageNumberAtomic.getAndIncrement(); (imgNum<selectedImages.length) && !interruptedAtomic.get();imgNum=imageNumberAtomic.getAndIncrement()){ for (int imgNum=imageNumberAtomic.getAndIncrement(); (imgNum<selectedImages.length) && !interruptedAtomic.get();imgNum=imageNumberAtomic.getAndIncrement()){
if (selectedImages[imgNum]){ if (selectedImages[imgNum]){
int chnNum=fittingStrategy.distortionCalibrationData.gIP[imgNum].channel; // number of sub-camera int chnNum=fittingStrategy.distortionCalibrationData.gIP[imgNum].channel; // number of sub-camera
boolean small_sensor = fittingStrategy.distortionCalibrationData.isSmallSensor(chnNum); //boolean small_sensor = fittingStrategy.distortionCalibrationData.isSmallSensor(chnNum);
boolean small_sensor = fittingStrategy.distortionCalibrationData.getSmallSensors()[chnNum];
RefineParameters rp = small_sensor ? refineParameters.refineParametersSmall : refineParameters; RefineParameters rp = small_sensor ? refineParameters.refineParametersSmall : refineParameters;
boolean showIndividual = si && rp.showPerImage; boolean showIndividual = si && rp.showPerImage;
int showIndividualNumber = rp.showIndividualNumber; int showIndividualNumber = rp.showIndividualNumber;
...@@ -2077,7 +2085,8 @@ public class Distortions { ...@@ -2077,7 +2085,8 @@ public class Distortions {
// if (shrinkBlurComboSigma>0.0) gb=new DoubleGaussianBlur(); // if (shrinkBlurComboSigma>0.0) gb=new DoubleGaussianBlur();
gb=new DoubleGaussianBlur(); gb=new DoubleGaussianBlur();
for (int sensorNum=sensorNumberAtomic.getAndIncrement(); (sensorNum<gridPCorr.length) && !interruptedAtomic.get();sensorNum=sensorNumberAtomic.getAndIncrement()){ for (int sensorNum=sensorNumberAtomic.getAndIncrement(); (sensorNum<gridPCorr.length) && !interruptedAtomic.get();sensorNum=sensorNumberAtomic.getAndIncrement()){
boolean small_sensor = fittingStrategy.distortionCalibrationData.isSmallSensor(sensorNum); // boolean small_sensor = fittingStrategy.distortionCalibrationData.isSmallSensor(sensorNum);
boolean small_sensor = fittingStrategy.distortionCalibrationData.getSmallSensors()[sensorNum];
RefineParameters rp = small_sensor ? refineParameters.refineParametersSmall : refineParameters; RefineParameters rp = small_sensor ? refineParameters.refineParametersSmall : refineParameters;
if (rp.extrapolate) { if (rp.extrapolate) {
int sensorWidth= fittingStrategy.distortionCalibrationData.eyesisCameraParameters.getSensorWidth(sensorNum); int sensorWidth= fittingStrategy.distortionCalibrationData.eyesisCameraParameters.getSensorWidth(sensorNum);
...@@ -4945,7 +4954,10 @@ List calibration ...@@ -4945,7 +4954,10 @@ List calibration
boolean [] selectedImages=fittingStrategy.selectedImages(this.seriesNumber); boolean [] selectedImages=fittingStrategy.selectedImages(this.seriesNumber);
// 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
null); // do not filter eo, lwir
int [] numSetPoints=new int [imageSets.length]; int [] numSetPoints=new int [imageSets.length];
double [] rmsPerSet=new double[imageSets.length]; double [] rmsPerSet=new double[imageSets.length];
boolean [] hasNaNInSet=new boolean[imageSets.length]; boolean [] hasNaNInSet=new boolean[imageSets.length];
...@@ -6188,6 +6200,10 @@ List calibration ...@@ -6188,6 +6200,10 @@ List calibration
JtByJmod[i][i]+=lambda*JtByJmod[i][i]; //Marquardt mod JtByJmod[i][i]+=lambda*JtByJmod[i][i]; //Marquardt mod
} }
// M*Ma=Mb // M*Ma=Mb
System.out.println("JtByJmod.length="+JtByJmod.length+" numPars="+numPars);
if (numPars==0) {
return null;
}
Matrix M=new Matrix(JtByJmod); Matrix M=new Matrix(JtByJmod);
// public Matrix (double vals[], int m) { // public Matrix (double vals[], int m) {
...@@ -6896,7 +6912,8 @@ List calibration ...@@ -6896,7 +6912,8 @@ List calibration
this.pathNames=tmpPaths; this.pathNames=tmpPaths;
} }
for (int i=0;i<sensorXYCorr.length;i++) if (sensorXYCorr[i]!=null){ for (int i=0;i<sensorXYCorr.length;i++) if (sensorXYCorr[i]!=null){
boolean small_sensor = fittingStrategy.distortionCalibrationData.isSmallSensor(i); // boolean small_sensor = fittingStrategy.distortionCalibrationData.isSmallSensor(i);
boolean small_sensor = fittingStrategy.distortionCalibrationData.getSmallSensors()[i];
RefineParameters rp = small_sensor ? refineParameters.refineParametersSmall : refineParameters; RefineParameters rp = small_sensor ? refineParameters.refineParametersSmall : refineParameters;
boolean update = rp.applyCorrection; boolean update = rp.applyCorrection;
boolean updateFlatField = rp.applyFlatField; boolean updateFlatField = rp.applyFlatField;
...@@ -7524,9 +7541,9 @@ List calibration ...@@ -7524,9 +7541,9 @@ List calibration
// For each sensor separately accumulate grid intensity using current sensor flat field calibration // For each sensor separately accumulate grid intensity using current sensor flat field calibration
for (int numImg=0;numImg<fittingStrategy.distortionCalibrationData.gIP.length;numImg++) if (selectedImages[numImg]) { for (int numImg=0;numImg<fittingStrategy.distortionCalibrationData.gIP.length;numImg++) if (selectedImages[numImg]) {
int channel=fittingStrategy.distortionCalibrationData.gIP[numImg].channel; int channel=fittingStrategy.distortionCalibrationData.gIP[numImg].channel;
boolean small_sensor = fittingStrategy.distortionCalibrationData.isSmallSensor(channel); // boolean small_sensor = fittingStrategy.distortionCalibrationData.isSmallSensor(channel);
boolean small_sensor = fittingStrategy.distortionCalibrationData.getSmallSensors()[channel];
RefineParameters rp = small_sensor ? refineParameters.refineParametersSmall : refineParameters; RefineParameters rp = small_sensor ? refineParameters.refineParametersSmall : refineParameters;
double minContrast = rp.flatFieldMinimalContrast; double minContrast = rp.flatFieldMinimalContrast;
// double threshold = rp.flatFieldMinimalContrast; // double threshold = rp.flatFieldMinimalContrast;
boolean interpolate = rp.flatFieldUseInterpolate; boolean interpolate = rp.flatFieldUseInterpolate;
...@@ -7658,7 +7675,8 @@ List calibration ...@@ -7658,7 +7675,8 @@ List calibration
} }
for (int station=0;station<sensorGrids.length;station++){ for (int station=0;station<sensorGrids.length;station++){
for (int channel=0;channel<sensorGrids[station].length; channel++) if (sensorGrids[station][channel]!=null){ for (int channel=0;channel<sensorGrids[station].length; channel++) if (sensorGrids[station][channel]!=null){
boolean small_sensor = fittingStrategy.distortionCalibrationData.isSmallSensor(channel); // boolean small_sensor = fittingStrategy.distortionCalibrationData.isSmallSensor(channel);
boolean small_sensor = fittingStrategy.distortionCalibrationData.getSmallSensors()[channel];
RefineParameters rp = small_sensor ? refineParameters.refineParametersSmall : refineParameters; RefineParameters rp = small_sensor ? refineParameters.refineParametersSmall : refineParameters;
double threshold = rp.flatFieldMinimalContrast; double threshold = rp.flatFieldMinimalContrast;
if (this.pixelCorrection[channel]==null) { if (this.pixelCorrection[channel]==null) {
...@@ -8229,7 +8247,8 @@ List calibration ...@@ -8229,7 +8247,8 @@ List calibration
double [][]masks=new double [this.pixelCorrection.length][]; double [][]masks=new double [this.pixelCorrection.length][];
int maskIndex=2; int maskIndex=2;
for (int numSensor=0;numSensor<masks.length;numSensor++){ for (int numSensor=0;numSensor<masks.length;numSensor++){
boolean small_sensor = fittingStrategy.distortionCalibrationData.isSmallSensor(numSensor); // boolean small_sensor = fittingStrategy.distortionCalibrationData.isSmallSensor(numSensor);
boolean small_sensor = fittingStrategy.distortionCalibrationData.getSmallSensors()[numSensor];
RefineParameters rp = small_sensor ? refineParameters.refineParametersSmall : refineParameters; RefineParameters rp = small_sensor ? refineParameters.refineParametersSmall : refineParameters;
if (this.pixelCorrection[numSensor]==null) masks[numSensor] = null; if (this.pixelCorrection[numSensor]==null) masks[numSensor] = null;
...@@ -8258,7 +8277,8 @@ List calibration ...@@ -8258,7 +8277,8 @@ List calibration
double [][]masks=new double [this.pixelCorrection.length][]; double [][]masks=new double [this.pixelCorrection.length][];
int maskIndex=2; int maskIndex=2;
for (int numSensor=0;numSensor<masks.length;numSensor++){ for (int numSensor=0;numSensor<masks.length;numSensor++){
boolean small_sensor = fittingStrategy.distortionCalibrationData.isSmallSensor(numSensor); // boolean small_sensor = fittingStrategy.distortionCalibrationData.isSmallSensor(numSensor);
boolean small_sensor = fittingStrategy.distortionCalibrationData.getSmallSensors()[numSensor];
RefineParameters rp = small_sensor ? refineParameters.refineParametersSmall : refineParameters; RefineParameters rp = small_sensor ? refineParameters.refineParametersSmall : refineParameters;
double shrink = rp.flatFieldShrink; double shrink = rp.flatFieldShrink;
......
...@@ -1583,7 +1583,10 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit ...@@ -1583,7 +1583,10 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
System.out.println("BUG: selectIndividualImages(): selection.length!=enabled.length!"); System.out.println("BUG: selectIndividualImages(): selection.length!=enabled.length!");
return false; return false;
} }
int [][] imageSets=this.distortionCalibrationData.listImages(!allImages); // true - only enabled images int [][] imageSets=this.distortionCalibrationData.listImages(
!allImages, // true - only enabled images
null); // do not filter by eo/lwir?
boolean [] enabledSets=new boolean [imageSets.length]; boolean [] enabledSets=new boolean [imageSets.length];
boolean [] selectedSets=new boolean [imageSets.length]; // at least one image selected in the series boolean [] selectedSets=new boolean [imageSets.length]; // at least one image selected in the series
for (int i=0;i<imageSets.length;i++){ for (int i=0;i<imageSets.length;i++){
...@@ -2483,7 +2486,7 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit ...@@ -2483,7 +2486,7 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
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) { if (selectHiLowRes != null) {
int small_01 = this.distortionCalibrationData.isSmallSensor(i)?1:0; int small_01 = this.distortionCalibrationData.isSmallSensor(i)?1:0; //OK, i here is image number, not channel number
// System.out.println(i+":"+small_01); // System.out.println(i+":"+small_01);
this.selectedImages[numSeries][i] &= selectHiLowRes[small_01]; this.selectedImages[numSeries][i] &= selectHiLowRes[small_01];
} }
......
...@@ -142,9 +142,17 @@ public class LwirReaderParameters { ...@@ -142,9 +142,17 @@ public class LwirReaderParameters {
} }
public int getNumChannels() { public int getNumChannels() {
return 20; return isLwir16()?20:8;
} }
public int [] getTypeMap() { // eo - 0, lwir - 1
int [] types = new int [getNumChannels()];
for (int i = 0; i < types.length; i++) {
types[i] = (i >= getEoChn0())? 0 : 1;
}
return types;
}
public static boolean is_LWIR(int width) { public static boolean is_LWIR(int width) {
return width <= MAX_LWIR_WIDTH; return width <= MAX_LWIR_WIDTH;
} }
......
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