public static boolean affineTransformsEqual( final AffineTransform3D tA, final AffineTransform3D tB ) { if ( tA == tB ) return true; else { final double[] a = tA.getRowPackedCopy(); final double[] b = tB.getRowPackedCopy(); for ( int i = 0; i < a.length; ++i ) if ( a[ i ] != b[ i ] ) return false; return true; } }
/** * get a very simple hash of two ViewRegistrations * @param vrA first ViewRegistration * @param vrB second ViewRegistration * @return a hash */ public static double calculateHash(final ViewRegistration vrA, final ViewRegistration vrB) { vrA.updateModel(); vrB.updateModel(); final double[] rowPackedCopyVrA = vrA.getModel().getRowPackedCopy(); final double[] rowPackedCopyVrB = vrB.getModel().getRowPackedCopy(); double hash = 0; for (int i=0; i<rowPackedCopyVrA.length; i++) hash += (rowPackedCopyVrA[i] + 13 * rowPackedCopyVrB[i]); return hash; } }
public TransformedRasteredRealRandomAccess( final RealRandomAccessible< T > realRandomAccessible, final T zero, final AffineTransform3D transform, final int[] offset ) { super( realRandomAccessible.numDimensions() ); this.zero = zero; this.realRandomAccessible = realRandomAccessible; this.transform = transform; this.offset = new int[ offset.length ]; for ( int d = 0; d < n; ++d ) this.offset[ d ] = offset[ d ]; this.realRandomAccess = realRandomAccessible.realRandomAccess(); final double[] imatrix = transform.inverse().getRowPackedCopy(); this.i00 = imatrix[ 0 ]; this.i01 = imatrix[ 1 ]; this.i02 = imatrix[ 2 ]; this.i03 = imatrix[ 3 ]; this.i10 = imatrix[ 4 ]; this.i11 = imatrix[ 5 ]; this.i12 = imatrix[ 6 ]; this.i13 = imatrix[ 7 ]; this.i20 = imatrix[ 8 ]; this.i21 = imatrix[ 9 ]; this.i22 = imatrix[ 10 ]; this.i23 = imatrix[ 11 ]; this.tmp = new float[ n ]; }
final double[] m = t.getRowPackedCopy(); final String d = "Rigid transform defined by BigDataViewer";