Commit 6b59db60 authored by Andrey Filippov's avatar Andrey Filippov

Importing EO+LWIR calibration to 3d program

parent 6fa32fa8
......@@ -38,7 +38,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import javax.swing.SwingUtilities;
import com.elphel.imagej.calibration.CalibrationFileManagement.MultipleExtensionsFileFilter;
import com.elphel.imagej.common.DoubleFHT;
import com.elphel.imagej.common.DoubleGaussianBlur;
import com.elphel.imagej.common.ShowDoubleFloatArrays;
......@@ -109,15 +108,27 @@ public class PixelMapping {
}
}
public PixelMapping (String [] calibFiles, int debugLevel){
public PixelMapping (
String [] calibFiles,
int first_channel, // 0 - old way
int num_channels, // 0 - any
boolean update_channel, // false (replace file channel with effective channel (subtract first_channel)
int debugLevel){
this.debugLevel=debugLevel;
if (calibFiles==null) calibFiles=new String[0];
this.sensors=new SensorData[this.maxSensors];
this.sensors=new SensorData[(num_channels > 0)? num_channels: this.maxSensors];
for (int i=0;i<this.sensors.length;i++) this.sensors[i]=null;
int maxChannel=0;
for (int i=0;i<calibFiles.length;i++){
SensorData sensorData=new SensorData (calibFiles[i],this.debugLevel);
int channel=sensorData.getChannel();
int channel=sensorData.getChannel(); // from Properties
if ((channel < first_channel) || ((num_channels > 0) && (channel >= (first_channel + num_channels)))) {
continue; // wrong channels
}
channel -= first_channel;
if (update_channel) {
sensorData.setChannel(channel);
}
this.sensors[channel]=sensorData;
if (channel>maxChannel) maxChannel=channel;
}
......@@ -16221,6 +16232,7 @@ public class PixelMapping {
}
public SensorData (){} // just to get parameter names
public void setChannel(int chn){this.channel = chn;}
public int getChannel(){return this.channel;}
public int getSubChannel(){return this.subchannel;}
public int getSubCamera(){return this.subcamera;}
......
......@@ -94,6 +94,7 @@ public class EyesisCorrectionParameters {
public String sourceDirectory= "";
public String sourcePrefix= "";
public String sourceSuffix= ".tiff"; //".jp4"
public int firstSubCameraConfig= 0; // channel index in config (sensor, clt) files
public int firstSubCamera= 1; // channel index in source file names
public int numSubCameras= 4; // channel index in source file names
public String sensorDirectory= "";
......@@ -300,6 +301,7 @@ public class EyesisCorrectionParameters {
cp.cltKernelDirectory= ""; // this.cltKernelDirectory;
cp.resultsDirectory= this.resultsDirectory+"/aux";
cp.firstSubCamera= this.firstSubCamera + this.numSubCameras;
cp.firstSubCameraConfig= this.firstSubCameraConfig; // + this.numSubCameras; so old setups will have it zero
cp.numSubCameras= this.numSubCameras;
cp.sensorPrefix= ""; // this.sensorPrefix;
cp.sensorSuffix= this.sensorSuffix;
......@@ -314,6 +316,7 @@ public class EyesisCorrectionParameters {
this.aux_camera.cltKernelDirectory= ecp.cltKernelDirectory;
this.aux_camera.resultsDirectory= ecp.resultsDirectory+"/aux";
this.aux_camera.firstSubCamera= ecp.firstSubCamera;
this.aux_camera.firstSubCameraConfig= ecp.firstSubCameraConfig;
this.aux_camera.numSubCameras= ecp.numSubCameras;
this.aux_camera.sensorPrefix= ecp.sensorPrefix;
this.aux_camera.sensorSuffix= ecp.sensorSuffix;
......@@ -364,6 +367,7 @@ public class EyesisCorrectionParameters {
properties.setProperty(prefix+"sourcePrefix",this.sourcePrefix);
properties.setProperty(prefix+"sourceSuffix",this.sourceSuffix);
properties.setProperty(prefix+"firstSubCamera",this.firstSubCamera+"");
properties.setProperty(prefix+"firstSubCameraConfig",this.firstSubCameraConfig+"");
properties.setProperty(prefix+"numSubCameras", this.numSubCameras+"");
properties.setProperty(prefix+"sensorDirectory",this.sensorDirectory);
......@@ -462,6 +466,7 @@ public class EyesisCorrectionParameters {
properties.setProperty(aux_prefix+"cltKernelDirectory", this.aux_camera.cltKernelDirectory);
properties.setProperty(aux_prefix+"resultsDirectory", this.aux_camera.resultsDirectory);
properties.setProperty(aux_prefix+"firstSubCamera", this.aux_camera.firstSubCamera+"");
properties.setProperty(aux_prefix+"firstSubCameraConfig", this.aux_camera.firstSubCameraConfig+"");
properties.setProperty(aux_prefix+"numSubCameras", this.aux_camera.numSubCameras+"");
properties.setProperty(aux_prefix+"sensorPrefix", this.aux_camera.sensorPrefix);
properties.setProperty(aux_prefix+"sensorSuffix", this.aux_camera.sensorSuffix);
......@@ -469,7 +474,6 @@ public class EyesisCorrectionParameters {
properties.setProperty(aux_prefix+"cltSuffix", this.aux_camera.cltSuffix);
properties.setProperty(aux_prefix+"x3dSubdirSuffix", this.aux_camera.x3dSubdirSuffix);
}
}
public void getProperties(String prefix,Properties properties){
......@@ -512,6 +516,7 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(prefix+"sourcePrefix")!= null) this.sourcePrefix=properties.getProperty(prefix+"sourcePrefix");
if (properties.getProperty(prefix+"sourceSuffix")!= null) this.sourceSuffix=properties.getProperty(prefix+"sourceSuffix");
if (properties.getProperty(prefix+"firstSubCamera")!= null) this.firstSubCamera=Integer.parseInt(properties.getProperty(prefix+"firstSubCamera"));
if (properties.getProperty(prefix+"firstSubCameraConfig")!= null) this.firstSubCameraConfig=Integer.parseInt(properties.getProperty(prefix+"firstSubCameraConfig"));
if (properties.getProperty(prefix+"numSubCameras")!= null) this.numSubCameras=Integer.parseInt(properties.getProperty(prefix+"numSubCameras"));
if (properties.getProperty(prefix+"sensorDirectory")!= null) this.sensorDirectory=properties.getProperty(prefix+"sensorDirectory");
if (properties.getProperty(prefix+"sensorPrefix")!= null) this.sensorPrefix=properties.getProperty(prefix+"sensorPrefix");
......@@ -612,6 +617,7 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(aux_prefix+"cltKernelDirectory")!= null) this.aux_camera.cltKernelDirectory=properties.getProperty(aux_prefix+"cltKernelDirectory");
if (properties.getProperty(aux_prefix+"resultsDirectory")!= null) this.aux_camera.resultsDirectory=properties.getProperty(aux_prefix+"resultsDirectory");
if (properties.getProperty(aux_prefix+"firstSubCamera")!= null) this.aux_camera.firstSubCamera=Integer.parseInt(properties.getProperty(aux_prefix+"firstSubCamera"));
if (properties.getProperty(aux_prefix+"firstSubCameraConfig")!= null) this.aux_camera.firstSubCameraConfig=Integer.parseInt(properties.getProperty(aux_prefix+"firstSubCameraConfig"));
if (properties.getProperty(aux_prefix+"numSubCameras")!= null) this.aux_camera.numSubCameras=Integer.parseInt(properties.getProperty(aux_prefix+"numSubCameras"));
if (properties.getProperty(aux_prefix+"sensorPrefix")!= null) this.aux_camera.sensorPrefix=properties.getProperty(aux_prefix+"sensorPrefix");
if (properties.getProperty(aux_prefix+"sensorSuffix")!= null) this.aux_camera.sensorSuffix=properties.getProperty(aux_prefix+"sensorSuffix");
......@@ -714,7 +720,8 @@ public class EyesisCorrectionParameters {
gd.addStringField("Source files prefix", this.sourcePrefix, 60);
gd.addStringField("Source files suffix", this.sourceSuffix, 60);
gd.addNumericField("First subcamera (in the source filenames)", this.firstSubCamera, 0);
gd.addNumericField("Number of subcameras in this camera (in the source filenames)", this.numSubCameras, 0);
gd.addNumericField("First subcamera (in config (clt, sensor) directories)", this.firstSubCameraConfig, 0);
gd.addNumericField("Number of subcameras in this camera", this.numSubCameras, 0);
gd.addStringField("Sensor files prefix", this.sensorPrefix, 40);
gd.addStringField("Sensor files suffix", this.sensorSuffix, 40);
......@@ -822,6 +829,7 @@ public class EyesisCorrectionParameters {
this.sourcePrefix= gd.getNextString();
this.sourceSuffix= gd.getNextString();
this.firstSubCamera= (int) gd.getNextNumber();
this.firstSubCameraConfig=(int) gd.getNextNumber();
this.numSubCameras= (int) gd.getNextNumber();
this.sensorPrefix= gd.getNextString();
this.sensorSuffix= gd.getNextString();
......@@ -894,7 +902,8 @@ public class EyesisCorrectionParameters {
gd.addStringField ("Results directory", this.resultsDirectory, 60); // 11
gd.addCheckbox ("Select results directory", false); // 12
gd.addNumericField("First subcamera (in the source filename)", this.firstSubCamera, 0); // 15
gd.addNumericField("Number of subcameras in this camera (in the source filenames)", this.numSubCameras, 0); // 16
gd.addNumericField("First subcamera (in config (clt, sensor) directories)", this.firstSubCameraConfig, 0);
gd.addNumericField("Number of subcameras in this camera ", this.numSubCameras, 0); // 16
gd.addStringField ("Sensor files prefix", this.sensorPrefix, 40); // 17
gd.addStringField ("Sensor files suffix", this.sensorSuffix, 40); // 18
......@@ -911,7 +920,8 @@ public class EyesisCorrectionParameters {
gd.addStringField ("Aux results directory", this.aux_camera.resultsDirectory, 60); // 11b
gd.addCheckbox ("Select aux results directory", false); // 12b
gd.addNumericField("First aux subcamera (in the source filename)", this.aux_camera.firstSubCamera, 0); // 15b
gd.addNumericField("Number of aux subcameras in this camera (in the source filenames)", this.aux_camera.numSubCameras, 0); // 16b
gd.addNumericField("First aux subcamera (in config (clt, sensor) directories)",this.aux_camera.firstSubCameraConfig, 0);
gd.addNumericField("Number of aux subcameras in this camera ", this.aux_camera.numSubCameras, 0); // 16b
gd.addStringField ("Aux sensor files prefix", this.aux_camera.sensorPrefix, 40); // 17b
gd.addStringField ("Aux sensor files suffix", this.aux_camera.sensorSuffix, 40); // 18b
......@@ -987,6 +997,7 @@ public class EyesisCorrectionParameters {
this.cltKernelDirectory= gd.getNextString(); if (gd.getNextBoolean()) selectCLTKernelDirectory(false, true); // 7
this.resultsDirectory= gd.getNextString(); if (gd.getNextBoolean()) selectResultsDirectory(false, true); // 12
this.firstSubCamera= (int) gd.getNextNumber(); // 15
this.firstSubCameraConfig=(int) gd.getNextNumber();
this.numSubCameras= (int) gd.getNextNumber(); // 16
this.sensorPrefix= gd.getNextString(); // 17
this.sensorSuffix= gd.getNextString(); // 18
......@@ -999,6 +1010,7 @@ public class EyesisCorrectionParameters {
this.aux_camera.cltKernelDirectory= gd.getNextString(); if (gd.getNextBoolean()) aux_camera.selectCLTKernelDirectory(false, true); // 7b
this.aux_camera.resultsDirectory= gd.getNextString(); if (gd.getNextBoolean()) aux_camera.selectResultsDirectory(false, true); // 12b
this.aux_camera.firstSubCamera= (int) gd.getNextNumber(); // 15b
this.aux_camera.firstSubCameraConfig=(int) gd.getNextNumber();
this.aux_camera.numSubCameras= (int) gd.getNextNumber(); // 16b
this.aux_camera.sensorPrefix= gd.getNextString(); // 17b
this.aux_camera.sensorSuffix= gd.getNextString(); // 18b
......@@ -1275,6 +1287,7 @@ public class EyesisCorrectionParameters {
public String [] selectKernelChannelFiles(
int type, // 0 - sharp, 1 - smooth
int firstChannel,
int numChannels, // number of channels
int debugLevel) { // will only open dialog if directory or files are not found
String [] kernelFiles= selectKernelFiles(
......@@ -1284,7 +1297,7 @@ public class EyesisCorrectionParameters {
String [] channelPaths=new String[numChannels];
for (int i=0;i<channelPaths.length;i++)channelPaths[i]=null;
for (int fileNum=0;fileNum<kernelFiles.length;fileNum++){
int chn=getChannelFromKernelTiff(kernelFiles[fileNum], type);
int chn=getChannelFromKernelTiff(kernelFiles[fileNum], type) - firstChannel;
if ((chn>=0) && (chn<numChannels)){
if (channelPaths[chn]==null){ // use first file for channel if there are multiple
channelPaths[chn]=kernelFiles[fileNum];
......@@ -1424,6 +1437,7 @@ public class EyesisCorrectionParameters {
public String [] selectCLTChannelFiles(
int firstChannel,
int numChannels, // number of channels
int debugLevel) { // will only open dialog if directory or files are not found
String [] kernelFiles= selectCLTFiles(
......@@ -1432,7 +1446,7 @@ public class EyesisCorrectionParameters {
String [] channelPaths=new String[numChannels];
for (int i=0;i<channelPaths.length;i++)channelPaths[i]=null;
for (int fileNum=0;fileNum<kernelFiles.length;fileNum++){
int chn=getChannelFromCLTTiff(kernelFiles[fileNum]);
int chn=getChannelFromCLTTiff(kernelFiles[fileNum]) - firstChannel;
if ((chn>=0) && (chn<numChannels)){
if (channelPaths[chn]==null){ // use first file for channel if there are multiple
channelPaths[chn]=kernelFiles[fileNum];
......
......@@ -98,17 +98,38 @@ public class EyesisCorrections {
// TODO: preserve some data when re-running with new source files
// FIXME: Make forgiving alien files
public void initSensorFiles(int debugLevel){
initSensorFiles(debugLevel, false);
}
public void initSensorFiles(int debugLevel, boolean missing_ok){
initSensorFiles(debugLevel,
false,
false,
false);
}
public void initSensorFiles(int debugLevel,
boolean missing_ok,
boolean all_sensors,
boolean no_vignetting
){
this.sharpKernelPaths=null;
this.smoothKernelPaths=null;
String [] sensorPaths=correctionsParameters.selectSensorFiles(this.debugLevel);
this.pixelMapping=new PixelMapping(sensorPaths,debugLevel);
this.pixelMapping=new PixelMapping(
sensorPaths,
correctionsParameters.firstSubCameraConfig, // int first_channel, // 0 - old way
correctionsParameters.numSubCameras, // int num_channels, // 0 - any
true, // boolean update_channel, // false (replace file channel with effective channel (subtract first_channel)
debugLevel);
if (all_sensors) {
this.usedChannels = new boolean [this.pixelMapping.sensors.length];
for (int i = 0; i < this.usedChannels.length; i++) {
this.usedChannels[i] = true;
}
} else {
this.usedChannels= usedChannels(correctionsParameters.getSourcePaths(),missing_ok);
}
// TODO: Combine with additional channel map to be able to select single image (of all 3)
if (correctionsParameters.removeUnusedSensorData){
for (int nChn=0;nChn< this.usedChannels.length; nChn++) if (!this.usedChannels[nChn]) this.pixelMapping.removeChannel(nChn);
for (int nChn=0;nChn< this.usedChannels.length; nChn++) {
if (!this.usedChannels[nChn]) this.pixelMapping.removeChannel(nChn);
}
}
int numUsedChannels=0;
for (int nChn=0;nChn< this.usedChannels.length; nChn++) if (this.usedChannels[nChn]) numUsedChannels++;
......@@ -117,7 +138,9 @@ public class EyesisCorrections {
for (int nChn=0;nChn< this.usedChannels.length; nChn++) if (this.usedChannels[nChn]) sChannels+=" "+nChn;
System.out.println ("Number of used channels: "+numUsedChannels+" ("+sChannels+" )");
}
if (!no_vignetting) {
createChannelVignetting();
}
if ((this.debugLevel>101) && (correctionsParameters.sourcePaths!=null) && (correctionsParameters.sourcePaths.length>0)) {
testFF(correctionsParameters.sourcePaths[0]);
}
......@@ -126,12 +149,32 @@ public class EyesisCorrections {
}
}
public void initSensorFilesAux(int debugLevel){
// Never used !
public void initSensorFilesAux(int debugLevel, // what is different from initSensorFiles()? Never used !
boolean missing_ok,
boolean all_sensors,
boolean no_vignetting
){
// this.sharpKernelPaths=null;
// this.smoothKernelPaths=null;
String [] sensorPaths=correctionsParameters.selectSensorFiles(this.debugLevel);
this.pixelMapping=new PixelMapping(sensorPaths,debugLevel);
this.usedChannels= usedChannels(correctionsParameters.getSourcePaths());
// this.pixelMapping=new PixelMapping(sensorPaths,debugLevel);
this.pixelMapping=new PixelMapping(
sensorPaths,
correctionsParameters.firstSubCameraConfig, // int first_channel, // 0 - old way
correctionsParameters.numSubCameras, // int num_channels, // 0 - any
true, // boolean update_channel, // false (replace file channel with effective channel (subtract first_channel)
debugLevel);
if (all_sensors) {
this.usedChannels = new boolean [this.pixelMapping.sensors.length];
for (int i = 0; i < this.usedChannels.length; i++) {
this.usedChannels[i] = true;
}
} else {
this.usedChannels= usedChannels(correctionsParameters.getSourcePaths(),missing_ok);
}
// TODO: Combine with additional channel map to be able to select single image (of all 3)
if (correctionsParameters.removeUnusedSensorData){
for (int nChn=0;nChn< this.usedChannels.length; nChn++) if (!this.usedChannels[nChn]) this.pixelMapping.removeChannel(nChn);
......@@ -229,7 +272,12 @@ public class EyesisCorrections {
// boolean processPlaneProjection= equirectangularParameters.generateCommonPlane &&
// equirectangularParameters.selectChannelsToProcess("Select channels for plane projection", this.pixelMapping.sensors.length);
this.pixelMapping=new PixelMapping(sensorPaths,debugLevel);
this.pixelMapping=new PixelMapping(
sensorPaths,
0, // int first_channel, // 0 - old way
0, // int num_channels, // 0 - any
false, // boolean update_channel, // false (replace file channel with effective channel (subtract first_channel)
debugLevel);
pixelMapping.generateAndSaveEquirectangularMaps(
correctionsParameters.equirectangularDirectory+
Prefs.getFileSeparator()+
......@@ -356,12 +404,16 @@ public class EyesisCorrections {
}
this.sharpKernelPaths=correctionsParameters.selectKernelChannelFiles(
0, // 0 - sharp, 1 - smooth
correctionsParameters.firstSubCameraConfig,
// correctionsParameters.numSubCameras,
numChannels, // number of channels
this.debugLevel);
if (this.sharpKernelPaths==null) return false;
if (nonlinParameters.useDiffNoiseGains) {
this.smoothKernelPaths=correctionsParameters.selectKernelChannelFiles(
1, // 0 - sharp, 1 - smooth
correctionsParameters.firstSubCameraConfig,
// correctionsParameters.numSubCameras,
numChannels, // number of channels
this.debugLevel);
if (this.smoothKernelPaths==null) return false;
......@@ -1024,7 +1076,9 @@ public class EyesisCorrections {
if (this.sharpKernelPaths==null){ // make sure the paths list is reset after changing parameters
this.sharpKernelPaths=correctionsParameters.selectKernelChannelFiles(
0, // 0 - sharp, 1 - smooth
this.usedChannels.length, // number of channels
correctionsParameters.firstSubCameraConfig,
correctionsParameters.numSubCameras,
// this.usedChannels.length, // number of channels
this.debugLevel);
}
if ((this.sharpKernelPaths==null) || (this.sharpKernelPaths[channel]==null)){
......@@ -1055,6 +1109,8 @@ public class EyesisCorrections {
if (this.smoothKernelPaths==null){ // make sure the paths list is reset after changing parameters
this.smoothKernelPaths=correctionsParameters.selectKernelChannelFiles(
1, // 0 - sharp, 1 - smooth
correctionsParameters.firstSubCameraConfig,
// correctionsParameters.numSubCameras,
this.usedChannels.length, // number of channels
this.debugLevel);
}
......@@ -1156,6 +1212,8 @@ public class EyesisCorrections {
if (this.smoothKernelPaths==null){ // make sure the paths list is reset after changing parameters
this.smoothKernelPaths=correctionsParameters.selectKernelChannelFiles(
1, // 0 - sharp, 1 - smooth
correctionsParameters.firstSubCameraConfig,
// correctionsParameters.numSubCameras,
this.usedChannels.length, // number of channels
this.debugLevel);
}
......
......@@ -281,6 +281,8 @@ public class EyesisDCT {
){
String [] sharpKernelPaths= correctionsParameters.selectKernelChannelFiles(
0, // 0 - sharp, 1 - smooth
correctionsParameters.firstSubCameraConfig,
// correctionsParameters.numSubCameras,
eyesisCorrections.usedChannels.length, // numChannels, // number of channels
eyesisCorrections.debugLevel);
if (sharpKernelPaths==null) return false;
......
......@@ -593,6 +593,7 @@ private Panel panel1,
addButton("Select second CLT image", panelClt1, color_configure);
addButton("CLT correlate", panelClt1, color_process);
addButton("Create CLT kernels", panelClt1, color_process);
addButton("Create AUX CLT kernels", panelClt1, color_process);
addButton("Read CLT kernels", panelClt1, color_process);
addButton("Reset CLT kernels", panelClt1, color_stop);
addButton("CLT process files", panelClt1, color_process);
......@@ -3902,7 +3903,11 @@ private Panel panel1,
return;
}
EYESIS_CORRECTIONS.initSensorFiles(DEBUG_LEVEL);
EYESIS_CORRECTIONS.initSensorFiles(DEBUG_LEVEL,
true, // true - ignore missing files
true, // boolean all_sensors,
true); //boolean no_vignetting
QUAD_CLT.createCLTKernels(
CLT_PARAMETERS,
......@@ -3910,7 +3915,44 @@ private Panel panel1,
THREADS_MAX,
UPDATE_STATUS, // update status info
DEBUG_LEVEL);
//==============================================================================
} else if (label.equals("Create AUX CLT kernels")) {
if (!CLT_PARAMETERS.showJDialog()) return;
if (EYESIS_CORRECTIONS_AUX == null) {
EYESIS_CORRECTIONS_AUX = new EyesisCorrections(SYNC_COMMAND.stopRequested,CORRECTION_PARAMETERS.getAux());
}
if ((QUAD_CLT_AUX == null) ||(QUAD_CLT_AUX.eyesisCorrections == null)){
QUAD_CLT_AUX = new QuadCLT (
QuadCLT.PREFIX_AUX,
PROPERTIES,
EYESIS_CORRECTIONS_AUX,
CORRECTION_PARAMETERS.getAux());
}
String configPath=getSaveCongigPath();
if (configPath.equals("ABORT")) return;
String cltPath=EYESIS_CORRECTIONS.correctionsParameters.selectCLTKernelDirectory( // create if it does not exist
true,
true);
if (cltPath==null) {
String msg="No CLT kernels (results) directory selected, command aborted";
System.out.println("Warning: "+msg);
IJ.showMessage("Warning",msg);
return;
}
EYESIS_CORRECTIONS_AUX.initSensorFiles(DEBUG_LEVEL,
true, // true - ignore missing files
true, // boolean all_sensors,
true); //boolean no_vignetting
QUAD_CLT_AUX.createCLTKernels(
CLT_PARAMETERS,
CONVOLVE_FFT_SIZE/2,
THREADS_MAX,
UPDATE_STATUS, // update status info
DEBUG_LEVEL);
//"Reset DCT kernels"
} else if (label.equals("Reset CLT kernels")) {
if (QUAD_CLT != null){
......@@ -5013,11 +5055,11 @@ private Panel panel1,
if (DEBUG_LEVEL > -2){
System.out.println("++++++++++++++ Running initSensorFiles for the main camera ++++++++++++++");
}
EYESIS_CORRECTIONS.initSensorFiles(DEBUG_LEVEL+2, true); // missing_ok
EYESIS_CORRECTIONS.initSensorFiles(DEBUG_LEVEL+2, true, false, false); // missing_ok
if (DEBUG_LEVEL > -2){
System.out.println("++++++++++++++ Running initSensorFiles for the auxiliary camera ++++++++++++++");
}
EYESIS_CORRECTIONS_AUX.initSensorFiles(DEBUG_LEVEL+2, true); // some files belong to oher cameras\
EYESIS_CORRECTIONS_AUX.initSensorFiles(DEBUG_LEVEL+2, true, false, false); // some files belong to oher cameras\
int numChannels= EYESIS_CORRECTIONS.getNumChannels();
......@@ -5147,11 +5189,11 @@ private Panel panel1,
if (DEBUG_LEVEL > -2){
System.out.println("++++++++++++++ Running initSensorFiles for the main camera ++++++++++++++");
}
EYESIS_CORRECTIONS.initSensorFiles(DEBUG_LEVEL+2, true); // missing_ok
EYESIS_CORRECTIONS.initSensorFiles(DEBUG_LEVEL+2, true, false, false); // missing_ok
if (DEBUG_LEVEL > -2){
System.out.println("++++++++++++++ Running initSensorFiles for the auxiliary camera ++++++++++++++");
}
EYESIS_CORRECTIONS_AUX.initSensorFiles(DEBUG_LEVEL+2, true); // some files belong to oher cameras\
EYESIS_CORRECTIONS_AUX.initSensorFiles(DEBUG_LEVEL+2, true, false, false); // some files belong to other cameras\
int numChannels= EYESIS_CORRECTIONS.getNumChannels();
......
......@@ -867,7 +867,9 @@ public class QuadCLT {
String [] sharpKernelPaths= correctionsParameters.selectKernelChannelFiles(
0, // 0 - sharp, 1 - smooth
eyesisCorrections.usedChannels.length, // numChannels, // number of channels
correctionsParameters.firstSubCameraConfig,
correctionsParameters.numSubCameras,
// eyesisCorrections.usedChannels.length, // numChannels, // number of channels
eyesisCorrections.debugLevel);
if (sharpKernelPaths==null) return false;
for (int i=0;i<sharpKernelPaths.length;i++){
......@@ -884,8 +886,8 @@ public class QuadCLT {
for (int chn=0;chn<eyesisCorrections.usedChannels.length;chn++){
if (eyesisCorrections.usedChannels[chn] && (sharpKernelPaths[chn]!=null) && (clt_kernels[chn]==null)){
ImagePlus imp_kernel_sharp=new ImagePlus(sharpKernelPaths[chn]);
if (imp_kernel_sharp.getStackSize()<3) {
System.out.println("Need a 3-layer stack with kernels");
if ((imp_kernel_sharp.getStackSize()<3) && (imp_kernel_sharp.getStackSize() != 1)) {
System.out.println("Need a 3-layer stack with Bayer or single for mono kernels");
sharpKernelPaths[chn]=null;
continue;
}
......@@ -913,18 +915,20 @@ public class QuadCLT {
int tileWidth = 2 * dtt_size;
int width = tileWidth * kernelNumHor;
int height = flat_kernels[0].length/width;
String [] layerNames = {"red_clt_kernels","blue_clt_kernels","green_clt_kernels"};
if (flat_kernels.length ==1){
layerNames = new String[1];
layerNames[0] = "mono_clt_kernels";
}
ImageStack cltStack = sdfa_instance.makeStack(
flat_kernels,
width,
height,
layerNames);
String cltPath=correctionsParameters.cltKernelDirectory+
Prefs.getFileSeparator()+
correctionsParameters.cltKernelPrefix+
String.format("%02d",chn)+
String.format("%02d",chn + correctionsParameters.firstSubCameraConfig)+
correctionsParameters.cltSuffix;
String msg="Saving CLT convolution kernels to "+cltPath;
IJ.showStatus(msg);
......@@ -935,7 +939,8 @@ public class QuadCLT {
imp_clt.show();
}
FileSaver fs=new FileSaver(imp_clt);
fs.saveAsTiffStack(cltPath); // directory does not exist
// fs.saveAsTiffStack(cltPath); // directory does not exist
fs.saveAsTiff(cltPath); // directory does not exist
}
}
return true;
......@@ -951,6 +956,7 @@ public class QuadCLT {
){
int dtt_size = clt_parameters.transform_size;
String [] cltKernelPaths = correctionsParameters.selectCLTChannelFiles(
correctionsParameters.firstSubCameraConfig,
// 0, // 0 - sharp, 1 - smooth
eyesisCorrections.usedChannels.length, // numChannels, // number of channels
eyesisCorrections.debugLevel);
......@@ -974,8 +980,8 @@ public class QuadCLT {
for (int chn=0;chn<eyesisCorrections.usedChannels.length;chn++){
if (eyesisCorrections.usedChannels[chn] && (cltKernelPaths[chn]!=null)){
ImagePlus imp_kernel_clt=new ImagePlus(cltKernelPaths[chn]);
if (imp_kernel_clt.getStackSize()<3) {
System.out.println("Need a 3-layer stack with symmetrical DCT kernels");
if ((imp_kernel_clt.getStackSize()< 3) && (imp_kernel_clt.getStackSize()!= 1)) {
System.out.println("Need a 3-layer stack or Bayer and 1-layer for mono with CLT kernels");
cltKernelPaths[chn]=null;
continue;
}
......
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