### Question:
ThinPlateSplineBuilder extends AbstractWarpTransformBuilder<ThinPlateSplineTransform> { @Override public ThinPlateSplineTransform call() throws Exception { LOG.info("call: entry"); final ThinPlateR2LogRSplineKernelTransform tpsKernelTransform = new ThinPlateR2LogRSplineKernelTransform(2, p, q); tpsKernelTransform.solve(); final double[][] TPSAffine = tpsKernelTransform.getAffine(); for (int j = 0; j < TPSAffine.length; j++) { for (int i = 0; i < TPSAffine[j].length; i++) { if (Double.isNaN(TPSAffine[j][i])) { throw new IllegalStateException("TPSAffine[" + j + "][" + i + "] is NaN. Two montage tiles may have the same center point."); } } } final ThinPlateSplineTransform t = new ThinPlateSplineTransform(tpsKernelTransform); LOG.info("call: exit"); return t; } ThinPlateSplineBuilder(final Collection<TileSpec> montageTiles,
                                  final Collection<TileSpec> alignTiles); @Override ThinPlateSplineTransform call();  }### Answer:
@Test public void testPilotSection() throws Exception { final List<TileSpec> montageTiles = getTiles("20141216_863_montage.2119.json"); final List<TileSpec> alignTiles = getTiles("20141216_863_align.2119.json"); final ThinPlateSplineBuilder builder = new ThinPlateSplineBuilder(montageTiles, alignTiles); final ThinPlateSplineTransform transform = builder.call(); final TransformSpec tpsSpec = new LeafTransformSpec("test_tps", null, transform.getClass().getName(), transform.toDataString()); TileSpec montageTileSpec; TileSpec alignTileSpec; double[] montageCenter; double[] alignCenter; final double acceptableCenterDelta = 0.001; final HashMap<String, TileSpec> alignTileSpecsLUT = new HashMap<>(); for (final TileSpec ts : alignTiles) { alignTileSpecsLUT.put(ts.getTileId(), ts); } LOG.info("montage.size = {}; align.size = {}", montageTiles.size(), alignTiles.size()); int j = 0; for (final TileSpec montageTile : montageTiles) { montageTileSpec = montageTile; montageTileSpec.addTransformSpecs(Collections.singletonList(tpsSpec)); montageCenter = getCenter(montageTileSpec); alignTileSpec = alignTileSpecsLUT.get(montageTileSpec.getTileId()); if (alignTileSpec == null) { continue; } ++j; alignCenter = getCenter(alignTileSpec); Assert.assertEquals(montageCenter[0], alignCenter[0], acceptableCenterDelta); Assert.assertEquals(montageCenter[1], alignCenter[1], acceptableCenterDelta); } LOG.info("intersection.size = {}", j); }