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 {
	public PairwiseOrthoMatch(double [][] affine, double [][] jtj) {
		this.affine = affine;
		this.jtj = jtj;
	}
	private static final long serialVersionUID = 1L;
	public double [][]           affine = new double[2][3];
	public transient double [][] jtj =    new double [6][6];
	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();
		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
}
