Commit 4754c088 authored by Andrey Filippov's avatar Andrey Filippov

Working on kernel factorization with LMA - larger symmetrical kernel and small...

Working on kernel factorization with LMA - larger symmetrical kernel and small asymmetrical for direct convolution with bayer
parent 79739c00
......@@ -71,7 +71,7 @@ public class DttRad2 {
double [] xr= new double[x.length];
int j= x.length-1;
for (int i=0; i < x.length;i++) xr[i] = x[j--];
double [] y= _dctiv_recurs(x);
double [] y= _dctiv_recurs(xr);
double scale = 1.0/Math.sqrt(x.length);
for (int i = 0; i < y.length ; i++) {
y[i] *= scale;
......@@ -225,6 +225,30 @@ public class DttRad2 {
return y;
}
public double [] dttt_ii(double [] x){
return dttt_iv(x, 0, 1 << (ilog2(x.length)/2));
}
public double [] dttt_ii(double [] x, int n){
double [] y = new double [n*n];
double [] line = new double[n];
// first (horizontal) pass
for (int i = 0; i<n; i++){
System.arraycopy(x, n*i, line, 0, n);
line = dctii_direct(line);
for (int j=0; j < n;j++) y[j*n+i] =line[j]; // transpose
}
// second (vertical) pass
for (int i = 0; i<n; i++){
System.arraycopy(y, n*i, line, 0, n);
line = dctii_direct(line);
System.arraycopy(line, 0, y, n*i, n);
}
return y;
}
public void set_window(){
set_window(0);
}
......@@ -401,7 +425,7 @@ public class DttRad2 {
SIV[t][j][k] = SIV[t][k][j];
}
for (int k = j; k<n; k++){
SIV[t][j][k] = scale * Math.cos((2*j+1)*(2*k+1)*pi_4n);
SIV[t][j][k] = scale * Math.sin((2*j+1)*(2*k+1)*pi_4n);
}
}
}
......
......@@ -1648,30 +1648,61 @@ public class EyesisCorrectionParameters {
}
}
public static class DCTParameters {
public int dct_size = 32;
public int dct_window = 0; // currently only 2 types of window - 0 and 1
public int dct_size = 32; //
public int asym_size = 6; //
public int dct_window = 1; // currently only 3 types of windows - 0 (none), 1 and 2
public int LMA_steps = 100;
public double compactness = 1.0;
public int dbg_x =0;
public int dbg_y =0;
public int dbg_x1 =0;
public int dbg_y1 =0;
public double dbg_sigma =2.0;
public DCTParameters(int dct_size, int dct_window) {
this.dct_size = dct_size;
public DCTParameters(int dct_size, int asym_size, int dct_window, double compactness) {
this.dct_size = dct_size;
this.asym_size = asym_size;
this.dct_window = dct_window;
this.compactness = compactness;
}
public void setProperties(String prefix,Properties properties){
properties.setProperty(prefix+"dct_size",this.dct_size+"");
properties.setProperty(prefix+"asym_size",this.asym_size+"");
properties.setProperty(prefix+"dct_window", this.dct_window+"");
properties.setProperty(prefix+"compactness", this.compactness+"");
}
public void getProperties(String prefix,Properties properties){
this.dct_size=Integer.parseInt(properties.getProperty(prefix+"dct_size"));
this.asym_size=Integer.parseInt(properties.getProperty(prefix+"asym_size"));
this.dct_window=Integer.parseInt(properties.getProperty(prefix+"dct_window"));
this.compactness=Integer.parseInt(properties.getProperty(prefix+"compactness"));
}
public boolean showDialog() {
GenericDialog gd = new GenericDialog("Set DCT parameters");
gd.addNumericField("DCT size", this.dct_size, 0); //2
gd.addNumericField("MDCT window type (0,1,2)", this.dct_window, 0); //32
gd.addNumericField("DCT size", this.dct_size, 0); //32
gd.addNumericField("Size of asymmetrical (non-DCT) kernel", this.asym_size, 0); //6
gd.addNumericField("MDCT window type (0,1,2)", this.dct_window, 0); //0..2
gd.addNumericField("LMA_steps", this.LMA_steps, 0); //0..2
gd.addNumericField("compactness", this.compactness, 6); //0..2
gd.addNumericField("dbg_x", this.dbg_x, 0); //0..2
gd.addNumericField("dbg_y", this.dbg_y, 0); //0..2
gd.addNumericField("dbg_x1", this.dbg_x1, 0); //0..2
gd.addNumericField("dbg_y1", this.dbg_y1, 0); //0..2
gd.addNumericField("dbg_sigma", this.dbg_sigma, 3); //0..2
// gd.addNumericField("Debug Level:", MASTER_DEBUG_LEVEL, 0);
gd.showDialog();
if (gd.wasCanceled()) return false;
this.dct_size= (int) gd.getNextNumber();
this.dct_window= (int) gd.getNextNumber();
this.dct_size= (int) gd.getNextNumber();
this.asym_size= (int) gd.getNextNumber();
this.dct_window= (int) gd.getNextNumber();
this.LMA_steps = (int) gd.getNextNumber();
this.compactness = gd.getNextNumber();
this.dbg_x= (int) gd.getNextNumber();
this.dbg_y= (int) gd.getNextNumber();
this.dbg_x1= (int) gd.getNextNumber();
this.dbg_y1= (int) gd.getNextNumber();
this.dbg_sigma= gd.getNextNumber();
// MASTER_DEBUG_LEVEL= (int) gd.getNextNumber();
return true;
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -208,7 +208,7 @@ public class ImageDtt {
* From Stephan Preibisch's Multithreading.java class. See:
* http://repo.or.cz/w/trakem2.git?a=blob;f=mpi/fruitfly/general/MultiThreading.java;hb=HEAD
*/
private Thread[] newThreadArray(int maxCPUs) {
static Thread[] newThreadArray(int maxCPUs) {
int n_cpus = Runtime.getRuntime().availableProcessors();
if (n_cpus>maxCPUs)n_cpus=maxCPUs;
return new Thread[n_cpus];
......
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