PairwiseOrthoMatch.java 1.35 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
package com.elphel.imagej.orthomosaic;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;

public class PairwiseOrthoMatch implements Serializable {
	private static final long serialVersionUID = 1L;
	public double [][]           affine = new double[2][3];
	public transient double [][] jtj =    new double [6][6];
Andrey Filippov's avatar
Andrey Filippov committed
12 13 14 15 16 17 18 19 20 21 22 23 24
	public int zoom_lev;
	public double rms = Double.NaN;
	public PairwiseOrthoMatch() {
		
	}
	public PairwiseOrthoMatch(double [][] affine, double [][] jtj, double rms, int zoom_lev) {
		this.affine = affine;
		this.jtj = jtj;
	}
	public double [][] getAffine(){
		return affine;
	}
	
25 26 27 28 29 30 31 32 33 34
	private void writeObject(ObjectOutputStream oos) throws IOException {
		oos.defaultWriteObject();
		for (int i = 0; i < jtj.length; i++) {
			for (int j = i; j < jtj[i].length; j++) {
				oos.writeObject(jtj[i][j]);
			}
		}
	}
	private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
		ois.defaultReadObject();
Andrey Filippov's avatar
Andrey Filippov committed
35
		jtj = new double [6][6]; // readObject does not use constructor!
36 37 38 39 40 41 42 43 44 45 46
		for (int i = 0; i < jtj.length; i++) {
			for (int j = i; j < jtj[i].length; j++) {
				jtj[i][j] = (Double) ois.readObject();
				if (j > i) {
					jtj[j][i] = jtj[i][j];
				}
			}
		}
	}
	//private void readObjectNoData() throws ObjectStreamException; // used to modify default values
}