Commit ab19db78 authored by Andrey Filippov's avatar Andrey Filippov

cluster texture output

parent 2717c448
...@@ -47,7 +47,7 @@ public class CorrectionColorProc { ...@@ -47,7 +47,7 @@ public class CorrectionColorProc {
void setDebug(int debugLevel){this.debugLevel=debugLevel;} void setDebug(int debugLevel){this.debugLevel=debugLevel;}
public void processColorsWeights(ImageStack stack, public void processColorsWeights(ImageStack stack, // does not like NaN (in GaussianBlur
double scale, // initial maximal pixel value (16)) double scale, // initial maximal pixel value (16))
EyesisCorrectionParameters.ColorProcParameters colorProcParameters, EyesisCorrectionParameters.ColorProcParameters colorProcParameters,
CorrectionColorProc.ColorGainsParameters channelGainParameters, CorrectionColorProc.ColorGainsParameters channelGainParameters,
...@@ -107,7 +107,7 @@ public class CorrectionColorProc { ...@@ -107,7 +107,7 @@ public class CorrectionColorProc {
for (i=0;i<length;i++) { for (i=0;i<length;i++) {
double Y=Ar*fpixels_r[i]+Ag*fpixels_g[i]+Ab*fpixels_b[i]; double Y=Ar*fpixels_r[i]+Ag*fpixels_g[i]+Ab*fpixels_b[i];
Y=linGamma(colorProcParameters.gamma, gamma_a, gamma_linK, colorProcParameters.minLin, Y)/Y; Y= (Y !=0.0) ? (linGamma(colorProcParameters.gamma, gamma_a, gamma_linK, colorProcParameters.minLin, Y)/Y): 0.0;
fpixels_r[i]*=Y*gain_red; fpixels_r[i]*=Y*gain_red;
fpixels_g[i]*=Y*gain_green; fpixels_g[i]*=Y*gain_green;
fpixels_b[i]*=Y*gain_blue; fpixels_b[i]*=Y*gain_blue;
...@@ -151,7 +151,7 @@ public class CorrectionColorProc { ...@@ -151,7 +151,7 @@ public class CorrectionColorProc {
double KPbB= -(2.0*(1-colorProcParameters.kb))/colorProcParameters.saturationBlue; double KPbB= -(2.0*(1-colorProcParameters.kb))/colorProcParameters.saturationBlue;
double KPrG= 2.0*colorProcParameters.kr*(1-colorProcParameters.kr)/Kg/colorProcParameters.saturationRed; double KPrG= 2.0*colorProcParameters.kr*(1-colorProcParameters.kr)/Kg/colorProcParameters.saturationRed;
double KPbG= 2.0*colorProcParameters.kb*(1-colorProcParameters.kb)/Kg/colorProcParameters.saturationBlue; double KPbG= 2.0*colorProcParameters.kb*(1-colorProcParameters.kb)/Kg/colorProcParameters.saturationBlue;
if (debugLevel>1) { if (debugLevel> 1) {
System.out.println ( " processColorsWeights() gain_red="+gain_red+" gain_green="+gain_green+" gain_blue="+gain_blue); System.out.println ( " processColorsWeights() gain_red="+gain_red+" gain_green="+gain_green+" gain_blue="+gain_blue);
System.out.println ( " processColorsWeights() gamma="+colorProcParameters.gamma+ " minLin="+colorProcParameters.minLin+" gamma_a="+gamma_a+" gamma_linK="+gamma_linK); System.out.println ( " processColorsWeights() gamma="+colorProcParameters.gamma+ " minLin="+colorProcParameters.minLin+" gamma_a="+gamma_a+" gamma_linK="+gamma_linK);
System.out.println ( " processColorsWeights() Kr="+colorProcParameters.kr+" Kg="+Kg+" Kb="+colorProcParameters.kb+" Sr="+Sr+" Sb="+Sb); System.out.println ( " processColorsWeights() Kr="+colorProcParameters.kr+" Kg="+Kg+" Kb="+colorProcParameters.kb+" Sr="+Sr+" Sb="+Sb);
...@@ -221,7 +221,7 @@ public class CorrectionColorProc { ...@@ -221,7 +221,7 @@ public class CorrectionColorProc {
gb.blurDouble(dpixels_pb, width, height, colorProcParameters.chromaBrightSigma, colorProcParameters.chromaBrightSigma, 0.01); gb.blurDouble(dpixels_pb, width, height, colorProcParameters.chromaBrightSigma, colorProcParameters.chromaBrightSigma, 0.01);
gb.blurDouble(dpixels_pr_dark, width, height, colorProcParameters.chromaDarkSigma, colorProcParameters.chromaDarkSigma, 0.01); gb.blurDouble(dpixels_pr_dark, width, height, colorProcParameters.chromaDarkSigma, colorProcParameters.chromaDarkSigma, 0.01);
gb.blurDouble(dpixels_pb_dark, width, height, colorProcParameters.chromaDarkSigma, colorProcParameters.chromaDarkSigma, 0.01); gb.blurDouble(dpixels_pb_dark, width, height, colorProcParameters.chromaDarkSigma, colorProcParameters.chromaDarkSigma, 0.01);
if (debugLevel>2) { if (debugLevel> 2) {
SDFA_INSTANCE.showArrays(dmask, width, height,"dmask"); SDFA_INSTANCE.showArrays(dmask, width, height,"dmask");
SDFA_INSTANCE.showArrays(dpixels_pr, width, height,"dpixels_pr"); SDFA_INSTANCE.showArrays(dpixels_pr, width, height,"dpixels_pr");
SDFA_INSTANCE.showArrays(dpixels_pb, width, height,"dpixels_pb"); SDFA_INSTANCE.showArrays(dpixels_pb, width, height,"dpixels_pb");
...@@ -340,7 +340,7 @@ public class CorrectionColorProc { ...@@ -340,7 +340,7 @@ public class CorrectionColorProc {
double KPbB= -(2.0*(1-colorProcParameters.kb))/colorProcParameters.saturationBlue; double KPbB= -(2.0*(1-colorProcParameters.kb))/colorProcParameters.saturationBlue;
double KPrG= 2.0*colorProcParameters.kr*(1-colorProcParameters.kr)/Kg/colorProcParameters.saturationRed; double KPrG= 2.0*colorProcParameters.kr*(1-colorProcParameters.kr)/Kg/colorProcParameters.saturationRed;
double KPbG= 2.0*colorProcParameters.kb*(1-colorProcParameters.kb)/Kg/colorProcParameters.saturationBlue; double KPbG= 2.0*colorProcParameters.kb*(1-colorProcParameters.kb)/Kg/colorProcParameters.saturationBlue;
if (debugLevel>1) { if (debugLevel > 1) {
System.out.println ( " processColorsWeights() gain_red="+gain_red+" gain_green="+gain_green+" gain_blue="+gain_blue); System.out.println ( " processColorsWeights() gain_red="+gain_red+" gain_green="+gain_green+" gain_blue="+gain_blue);
System.out.println ( " processColorsWeights() gamma="+colorProcParameters.gamma+ " minLin="+colorProcParameters.minLin+" gamma_a="+gamma_a+" gamma_linK="+gamma_linK); System.out.println ( " processColorsWeights() gamma="+colorProcParameters.gamma+ " minLin="+colorProcParameters.minLin+" gamma_a="+gamma_a+" gamma_linK="+gamma_linK);
System.out.println ( " processColorsWeights() Kr="+colorProcParameters.kr+" Kg="+Kg+" Kb="+colorProcParameters.kb+" Sr="+Sr+" Sb="+Sb); System.out.println ( " processColorsWeights() Kr="+colorProcParameters.kr+" Kg="+Kg+" Kb="+colorProcParameters.kb+" Sr="+Sr+" Sb="+Sb);
......
...@@ -2022,6 +2022,8 @@ public class EyesisCorrectionParameters { ...@@ -2022,6 +2022,8 @@ public class EyesisCorrectionParameters {
public double bgnd_maybe = 0.1; // maximal strength to ignore as non-background public double bgnd_maybe = 0.1; // maximal strength to ignore as non-background
// public double bgnd_2diff = 0.005; // maximal strength to ignore as non-background // public double bgnd_2diff = 0.005; // maximal strength to ignore as non-background
public int min_clstr_seed = 2; // number of tiles in a cluster to seed (just background?) public int min_clstr_seed = 2; // number of tiles in a cluster to seed (just background?)
public int min_clstr_lone = 4; // number of tiles in a cluster not close to other clusters (more than 2 tiles apart)
public int fill_gaps = 4; // same as in grow - 1: 4 directions by 1 step, 2: 8 directions by 1 step. +2*n - alternating hor/vert
public int min_clstr_block = 3; // number of tiles in a cluster to block (just non-background?) public int min_clstr_block = 3; // number of tiles in a cluster to block (just non-background?)
public int bgnd_grow = 2; // number of tiles to grow (1 - hor/vert, 2 - hor/vert/diagonal) public int bgnd_grow = 2; // number of tiles to grow (1 - hor/vert, 2 - hor/vert/diagonal)
...@@ -2143,6 +2145,8 @@ public class EyesisCorrectionParameters { ...@@ -2143,6 +2145,8 @@ public class EyesisCorrectionParameters {
properties.setProperty(prefix+"bgnd_sure", this.bgnd_sure +""); properties.setProperty(prefix+"bgnd_sure", this.bgnd_sure +"");
properties.setProperty(prefix+"bgnd_maybe", this.bgnd_maybe +""); properties.setProperty(prefix+"bgnd_maybe", this.bgnd_maybe +"");
properties.setProperty(prefix+"min_clstr_seed", this.min_clstr_seed+""); properties.setProperty(prefix+"min_clstr_seed", this.min_clstr_seed+"");
properties.setProperty(prefix+"min_clstr_lone", this.min_clstr_lone+"");
properties.setProperty(prefix+"fill_gaps", this.fill_gaps+"");
properties.setProperty(prefix+"min_clstr_block", this.min_clstr_block+""); properties.setProperty(prefix+"min_clstr_block", this.min_clstr_block+"");
properties.setProperty(prefix+"bgnd_grow", this.bgnd_grow+""); properties.setProperty(prefix+"bgnd_grow", this.bgnd_grow+"");
properties.setProperty(prefix+"ortho_min_hor", this.ortho_min_hor +""); properties.setProperty(prefix+"ortho_min_hor", this.ortho_min_hor +"");
...@@ -2255,6 +2259,8 @@ public class EyesisCorrectionParameters { ...@@ -2255,6 +2259,8 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(prefix+"bgnd_sure")!=null) this.bgnd_sure=Double.parseDouble(properties.getProperty(prefix+"bgnd_sure")); if (properties.getProperty(prefix+"bgnd_sure")!=null) this.bgnd_sure=Double.parseDouble(properties.getProperty(prefix+"bgnd_sure"));
if (properties.getProperty(prefix+"bgnd_maybe")!=null) this.bgnd_maybe=Double.parseDouble(properties.getProperty(prefix+"bgnd_maybe")); if (properties.getProperty(prefix+"bgnd_maybe")!=null) this.bgnd_maybe=Double.parseDouble(properties.getProperty(prefix+"bgnd_maybe"));
if (properties.getProperty(prefix+"min_clstr_seed")!=null) this.min_clstr_seed=Integer.parseInt(properties.getProperty(prefix+"min_clstr_seed")); if (properties.getProperty(prefix+"min_clstr_seed")!=null) this.min_clstr_seed=Integer.parseInt(properties.getProperty(prefix+"min_clstr_seed"));
if (properties.getProperty(prefix+"min_clstr_lone")!=null) this.min_clstr_lone=Integer.parseInt(properties.getProperty(prefix+"min_clstr_lone"));
if (properties.getProperty(prefix+"fill_gaps")!=null) this.fill_gaps=Integer.parseInt(properties.getProperty(prefix+"fill_gaps"));
if (properties.getProperty(prefix+"min_clstr_block")!=null) this.min_clstr_block=Integer.parseInt(properties.getProperty(prefix+"min_clstr_block")); if (properties.getProperty(prefix+"min_clstr_block")!=null) this.min_clstr_block=Integer.parseInt(properties.getProperty(prefix+"min_clstr_block"));
if (properties.getProperty(prefix+"bgnd_grow")!=null) this.bgnd_grow=Integer.parseInt(properties.getProperty(prefix+"bgnd_grow")); if (properties.getProperty(prefix+"bgnd_grow")!=null) this.bgnd_grow=Integer.parseInt(properties.getProperty(prefix+"bgnd_grow"));
if (properties.getProperty(prefix+"ortho_min_hor")!=null) this.ortho_min_hor=Double.parseDouble(properties.getProperty(prefix+"ortho_min_hor")); if (properties.getProperty(prefix+"ortho_min_hor")!=null) this.ortho_min_hor=Double.parseDouble(properties.getProperty(prefix+"ortho_min_hor"));
...@@ -2382,6 +2388,8 @@ public class EyesisCorrectionParameters { ...@@ -2382,6 +2388,8 @@ public class EyesisCorrectionParameters {
gd.addNumericField("Maximal strength to ignore as non-background", this.bgnd_maybe, 3); gd.addNumericField("Maximal strength to ignore as non-background", this.bgnd_maybe, 3);
gd.addNumericField("Number of tiles in a cluster to seed (just background?)", this.min_clstr_seed, 0); gd.addNumericField("Number of tiles in a cluster to seed (just background?)", this.min_clstr_seed, 0);
gd.addNumericField("Number of tiles in a cluster not close to other clusters (more than 2 tiles apart)", this.min_clstr_lone, 0);
gd.addNumericField("Fill gaps betsween clusters, see comments for 'grow'", this.fill_gaps, 0);
gd.addNumericField("Number of tiles in a cluster to block (just non-background?)", this.min_clstr_block, 0); gd.addNumericField("Number of tiles in a cluster to block (just non-background?)", this.min_clstr_block, 0);
gd.addNumericField("Number of tiles to grow tile selection (1 - hor/vert, 2 - hor/vert/diagonal)", this.bgnd_grow, 0); gd.addNumericField("Number of tiles to grow tile selection (1 - hor/vert, 2 - hor/vert/diagonal)", this.bgnd_grow, 0);
...@@ -2503,6 +2511,8 @@ public class EyesisCorrectionParameters { ...@@ -2503,6 +2511,8 @@ public class EyesisCorrectionParameters {
this.bgnd_sure= gd.getNextNumber(); this.bgnd_sure= gd.getNextNumber();
this.bgnd_maybe= gd.getNextNumber(); this.bgnd_maybe= gd.getNextNumber();
this.min_clstr_seed= (int) gd.getNextNumber(); this.min_clstr_seed= (int) gd.getNextNumber();
this.min_clstr_lone= (int) gd.getNextNumber();
this.fill_gaps= (int) gd.getNextNumber();
this.min_clstr_block= (int) gd.getNextNumber(); this.min_clstr_block= (int) gd.getNextNumber();
this.bgnd_grow= (int) gd.getNextNumber(); this.bgnd_grow= (int) gd.getNextNumber();
this.ortho_min_hor= gd.getNextNumber(); this.ortho_min_hor= gd.getNextNumber();
......
...@@ -1398,7 +1398,7 @@ public class EyesisCorrections { ...@@ -1398,7 +1398,7 @@ public class EyesisCorrections {
break; break;
} }
} }
if (debugLevel>2) { if (debugLevel > 2) {
System.out.println ( "Input file color slice numbers:"); System.out.println ( "Input file color slice numbers:");
System.out.println ( " Red - slice "+((rgbNumbers[0]>0)?rgbNumbers[0]:"missing")); System.out.println ( " Red - slice "+((rgbNumbers[0]>0)?rgbNumbers[0]:"missing"));
System.out.println ( " Green - slice "+((rgbNumbers[1]>0)?rgbNumbers[1]:"missing")); System.out.println ( " Green - slice "+((rgbNumbers[1]>0)?rgbNumbers[1]:"missing"));
......
...@@ -70,7 +70,7 @@ public class EyesisTiff { ...@@ -70,7 +70,7 @@ public class EyesisTiff {
int width = imp.getWidth(); int width = imp.getWidth();
int height = imp.getHeight(); int height = imp.getHeight();
int [] pixels = (int []) imp.getProcessor().getPixels(); int [] pixels = (int []) imp.getProcessor().getPixels();
System.out.println("width="+width+", height="+height+" length="+pixels.length); System.out.println("savePNG_ARGB32("+path+"): width="+width+", height="+height+" length="+pixels.length);
DataBufferInt buffer = new DataBufferInt(pixels, pixels.length); DataBufferInt buffer = new DataBufferInt(pixels, pixels.length);
......
...@@ -1044,7 +1044,7 @@ public class ImageDtt { ...@@ -1044,7 +1044,7 @@ public class ImageDtt {
if (i == (transform_size-1)) enh_ortho_scale[i] = 0.0 ; // hardwired 0 in the center if (i == (transform_size-1)) enh_ortho_scale[i] = 0.0 ; // hardwired 0 in the center
enh_ortho_scale[i] *= Math.sin(Math.PI*(i+1.0)/(2*transform_size)); enh_ortho_scale[i] *= Math.sin(Math.PI*(i+1.0)/(2*transform_size));
} }
if (globalDebugLevel > -1){ if (globalDebugLevel > 0){
System.out.println("enhortho_width="+ enhortho_width+" enhortho_scale="+ enhortho_scale); System.out.println("enhortho_width="+ enhortho_width+" enhortho_scale="+ enhortho_scale);
for (int i = 0; i < corr_size; i++){ for (int i = 0; i < corr_size; i++){
System.out.println(" enh_ortho_scale["+i+"]="+ enh_ortho_scale[i]); System.out.println(" enh_ortho_scale["+i+"]="+ enh_ortho_scale[i]);
......
This diff is collapsed.
This diff is collapsed.
...@@ -137,3 +137,24 @@ public class X3dOutput { ...@@ -137,3 +137,24 @@ public class X3dOutput {
return bbox; return bbox;
} }
} }
/*
An IndexedFaceSet geometry node creates geometry out of faces
texCoord and texCoordIndex - specify texture pieces
Shape {
appearance Appearance { . . . }
geometry IndexedFaceSet {
coord Coordinate { . . . }
coordIndex [ . . . ]
texCoord TextureCoordinate { . . . }
texCoordIndex [ . . . ]
}
}
<IndexedFaceSet coordIndex="0 1 2 -1 0 2 3 -1 ..." texCoordIndex="0 1 2 -1 0 2 3 -1 ...">
<Coordinate point="-37.500000 4.000000 -46.450000 .../>
<TextureCoordinate point="-37.500000 4.000000 -46.450000 .../>
</IndexedFaceSet>
*/
*/
\ No newline at end of file
...@@ -180,6 +180,9 @@ import ij.process.*; ...@@ -180,6 +180,9 @@ import ij.process.*;
} }
public ImageStack makeStack(double[][] pixels, int width, int height, String [] titles) { public ImageStack makeStack(double[][] pixels, int width, int height, String [] titles) {
return makeStack( pixels, width, height, titles, false);
}
public ImageStack makeStack(double[][] pixels, int width, int height, String [] titles, boolean noNaN) {
float [] fpixels; float [] fpixels;
ImageStack array_stack=new ImageStack(width,height); ImageStack array_stack=new ImageStack(width,height);
for (int i=0;i<pixels.length;i++) if (pixels[i]!=null) { for (int i=0;i<pixels.length;i++) if (pixels[i]!=null) {
...@@ -188,7 +191,11 @@ import ij.process.*; ...@@ -188,7 +191,11 @@ import ij.process.*;
return null; return null;
} }
fpixels=new float[pixels[i].length]; fpixels=new float[pixels[i].length];
if (noNaN){
for (int j=0;j<fpixels.length;j++) fpixels[j]= Double.isNaN(pixels[i][j])? 0.0F: ((float)pixels[i][j]);
} else {
for (int j=0;j<fpixels.length;j++) fpixels[j]=(float)pixels[i][j]; for (int j=0;j<fpixels.length;j++) fpixels[j]=(float)pixels[i][j];
}
if (titles!=null){ if (titles!=null){
array_stack.addSlice(titles[i], fpixels); array_stack.addSlice(titles[i], fpixels);
} else { } else {
......
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