Commit 32292d3b authored by Andrey Filippov's avatar Andrey Filippov

starting new branch, broken state

parent 2d5052a0
......@@ -11,7 +11,7 @@ public class FloatImageData {
public int width;
public int height;
public int zoom_lev;
public double [] vert = new double[2]; // x,y offset (in meters) of the point under the camera
private double [] vert = new double[2]; // x,y offset (in meters) of the point under the camera
public float[] data;
public FloatImageData (
int width,
......@@ -26,6 +26,16 @@ public class FloatImageData {
this.data = data;
}
public int getWidth() {
return width;
}
public int getHeight() {
return height;
}
public double[] getVertMeters() {
return vert;
}
public double [] getDData() {
final double [] ddata = new double [data.length];
final Thread[] threads = ImageDtt.newThreadArray();
......
......@@ -116,8 +116,11 @@ public class OrthoMap implements Comparable <OrthoMap>, Serializable{
public double [][] affine = new double[][] {{1,0,0},{0,1,0}}; // relative to vert_meters[], positive Y is down (as in images)
public transient double [][] ers_affine = new double[][] {{1,0},{0,1}}; // orientation only for remaining ERS, positive Y is down (as in images)
public double orig_pix_meters;
public double [] vert_meters; // offset of the image vertical in meters (scale-invariant), right (X) and down (Y)
@Deprecated
private double [] vert_meters; // offset of the image vertical in meters (scale-invariant), right (X) and down (Y)
@Deprecated
public int orig_width;
@Deprecated
public int orig_height;
public transient FloatImageData orig_image;
public transient FloatImageData alt_image;
......@@ -237,10 +240,16 @@ public class OrthoMap implements Comparable <OrthoMap>, Serializable{
}
public int getWidth() {
return orig_width;
return getImageData().getWidth(); // orig_width;
}
public int getHeight() {
return orig_height;
return getImageData().getHeight(); //orig_height;
}
public int getAltWidth() {
return getAltData().getWidth(); // orig_width;
}
public int getAltHeight() {
return getAltData().getHeight(); //orig_height;
}
public void setMatch(
......@@ -692,7 +701,7 @@ public class OrthoMap implements Comparable <OrthoMap>, Serializable{
}
private boolean readAltData() { // assuming the same scale as main image
private boolean readAltData() { // assuming the same scale as main image - WRONG
ImagePlus imp = new ImagePlus(getAltPath(path));
int width = imp.getWidth();
int height = imp.getHeight();
......@@ -744,24 +753,34 @@ public class OrthoMap implements Comparable <OrthoMap>, Serializable{
* Get vertical point offset from the top-left corner of the original orthoimage in meters (right and down)
* @return vertical point X,Y offset in meters from the top-left image corner
*/
public double [] getVertMeters() {
public double [] getVertMetersOld() {
return vert_meters;
}
public double [] getVertMeters() {
return getImageData().getVertMeters(); // ;
}
public double [] getVertMetersAlt() {
return getAltData().getVertMeters(); // ;
}
/**
* Get vertical point offset from the top-left corner of the original orthoimage in pixels
* of the original resolution
* @return vertical point X,Y offset in pixels from the top-left image corner in original resolution
*/
public int [] getVertPixels() {
double [] vm = getVertMeters();
return new int [] {
(int) Math.round(vert_meters[0]/orig_pix_meters),
(int) Math.round(vert_meters[0]/orig_pix_meters)};
(int) Math.round(vm[0]/orig_pix_meters),
(int) Math.round(vm[1]/orig_pix_meters)};
}
public ImagePlus getOriginalImage(boolean show_markers) {
FloatImageData orig_image = getImageData();
double [] vm = getVertMeters();
if (orig_image != null) {
String full_name = path.substring(path.lastIndexOf(Prefs.getFileSeparator()) + 1);
ImagePlus imp = ShowDoubleFloatArrays.makeArrays(
......@@ -771,7 +790,7 @@ public class OrthoMap implements Comparable <OrthoMap>, Serializable{
full_name);
if (show_markers) {
PointRoi roi = new PointRoi();
roi.addPoint(orig_image.vert[0],orig_image.vert[1]);
roi.addPoint(vm[0],vm[1]);
roi.setOptions("label");
imp.setRoi(roi);
}
......@@ -1001,16 +1020,11 @@ public class OrthoMap implements Comparable <OrthoMap>, Serializable{
System.out.println("downScaleForGPU(): indx = "+indx+" ("+spix.length+"), tileX= "+
tileX+", tileY="+tileY+", px="+px+", py="+py+", ls="+ls);
}
// if (sw > 0) {
// opix[tileY * width + tileX] = (float) (swd/sw);
// }
}
}
if (sw > 0) {
opix[tileY * width + tileX] = (float) (swd/sw);
}
}
}
};
......
......@@ -1346,7 +1346,7 @@ public class OrthoMapsCollection implements Serializable{
double [][] tlo_source_pixel = new double[tlo_src_metric.length][2];
for (int n=0; n <tlo_source_pixel.length; n++) {
for (int i = 0; i < 2; i++) {
tlo_source_pixel[n][i] = (tlo_src_metric[n][i] + ortho_maps[gpu_pair[n]].vert_meters[i])/pix_size;
tlo_source_pixel[n][i] = (tlo_src_metric[n][i] + ortho_maps[gpu_pair[n]].getVertMeters()[i])/pix_size;
}
}
......@@ -1862,7 +1862,7 @@ public class OrthoMapsCollection implements Serializable{
double [] tlo_src_metric_other = new double[2]; // check affines[][][] here -
for (int i = 0; i < 2; i++) {
tlo_src_metric_other[i] = affines_gpu[1][i][2] * pix_size - ortho_maps[gpu_pair[1]].vert_meters[i];
tlo_src_metric_other[i] = affines_gpu[1][i][2] * pix_size - ortho_maps[gpu_pair[1]].getVertMeters()[i];
for (int j = 0; j < 2; j++) {
affines[1][i][j] = affines_gpu[1][i][j];
}
......
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