From 13bca3576fdfc2e1fbd3e0fdf71afdafc2d8cbc2 Mon Sep 17 00:00:00 2001 From: John Bogovic Date: Thu, 3 Oct 2024 16:37:25 -0400 Subject: [PATCH 1/6] test/style: UrlParseTest better message for n5FileUrlEquivalencyTest * and clean up --- src/test/java/bigwarp/url/UrlParseTest.java | 25 +-------------------- 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/src/test/java/bigwarp/url/UrlParseTest.java b/src/test/java/bigwarp/url/UrlParseTest.java index 1be9d774..480b72fa 100644 --- a/src/test/java/bigwarp/url/UrlParseTest.java +++ b/src/test/java/bigwarp/url/UrlParseTest.java @@ -116,23 +116,6 @@ public void testUrlSources() throws SpimDataException, URISyntaxException, IOExc } } -// @Test -// public void testUrlTransforms() -// { -// final String n5Path = new File( "src/test/resources/bigwarp/url/transformTest.n5" ).getAbsolutePath(); -// -// final String s0Url = n5Path + "?ant&transform=[0]"; -// final String s0DefaultUrl = n5Path + "?ant&transform=[0]"; -// - // TODO when we're ready -// final Object s0 = loadTransformFromUrl( s0Url ); -// final Object s0Default = loadTransformFromUrl( s0DefaultUrl ); -// -// assertNotNull( s0 ); -// assertNotNull( s0Default ); -// assertEquals( s0, s0Default ); -// } - @Test public < T extends NativeType > void n5FileUrlEquivalencyTest() throws IOException, SpimDataException, URISyntaxException { @@ -161,16 +144,10 @@ public < T extends NativeType > void n5FileUrlEquivalencyTest() throws IOExce { final int setupId = id.getAndIncrement(); BigWarpInit.add( data, BigWarpInit.createSources( data, uri, setupId, new Random().nextBoolean() ) ); - assertEquals( uri, data.sourceInfos.get( setupId ).getUri() ); + assertEquals( "failed for: " + uri, uri, data.sourceInfos.get( setupId ).getUri() ); } } -// private Object loadTransformFromUrl( final String url ) -// { -// // TODO Caleb will remove me and replace calls to me with something real -// return null; -// } - private < T extends NativeType > Source< ? > loadSourceFromUri( final String uri ) throws SpimDataException, URISyntaxException, IOException { From d0fcf9364d8e1f7b7501e168af4055c84198f18f Mon Sep 17 00:00:00 2001 From: John Bogovic Date: Thu, 3 Oct 2024 16:50:47 -0400 Subject: [PATCH 2/6] Bump to next development cycle Signed-off-by: John Bogovic --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 11b9f280..3b8ee69b 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ sc.fiji bigwarp_fiji - 9.1.5-SNAPSHOT + 9.2.1-SNAPSHOT BigWarp plugin for Fiji A tool for manual pointwise deformable registration using bigdataviewer. From 7be74b1bdb2fdbb30afc644e5a5e26591d49e918 Mon Sep 17 00:00:00 2001 From: John Bogovic Date: Fri, 4 Oct 2024 16:28:53 -0400 Subject: [PATCH 3/6] chore(pom): bump n5-ij, n5-viewer versions --- pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3b8ee69b..c18b71ca 100644 --- a/pom.xml +++ b/pom.xml @@ -134,8 +134,9 @@ 7.0.2 4.2.1 4.1.1 + 4.2.5 1.6.0 - 4.2.3 + 6.1.2 0.41 0.41 From 70e859f6bcf9f2906b2e9e7536be5180952e0452 Mon Sep 17 00:00:00 2001 From: John Bogovic Date: Fri, 4 Oct 2024 16:29:19 -0400 Subject: [PATCH 4/6] test: temporarily UrlParseTest test to intermittent GH actions failures --- src/test/java/bigwarp/url/UrlParseTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/test/java/bigwarp/url/UrlParseTest.java b/src/test/java/bigwarp/url/UrlParseTest.java index 480b72fa..cdef633e 100644 --- a/src/test/java/bigwarp/url/UrlParseTest.java +++ b/src/test/java/bigwarp/url/UrlParseTest.java @@ -20,6 +20,7 @@ import org.janelia.saalfeldlab.n5.universe.N5Factory; import org.janelia.saalfeldlab.n5.zarr.ZarrKeyValueReader; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import bdv.viewer.Source; @@ -117,11 +118,12 @@ public void testUrlSources() throws SpimDataException, URISyntaxException, IOExc } @Test + @Ignore // TODO temporarily ignore due to intermittent GH actions test failures public < T extends NativeType > void n5FileUrlEquivalencyTest() throws IOException, SpimDataException, URISyntaxException { final String relativePath = "src/test/resources/bigwarp/url/transformTest.n5"; final String absolutePath = Paths.get( relativePath ).toAbsolutePath().toFile().getCanonicalPath(); - final String[] variants = new String[]{ + final String[] variants = { "n5:file://" + absolutePath + "?img#coordinateTransformations[0]", "n5:file://" + absolutePath + "?img", "n5:file:" + absolutePath + "?img#coordinateTransformations[0]", From 3fd46626953e24b4f6150a4f237c0c27724cb591 Mon Sep 17 00:00:00 2001 From: John Bogovic Date: Fri, 4 Oct 2024 16:37:45 -0400 Subject: [PATCH 5/6] Bump to next development cycle Signed-off-by: John Bogovic --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c18b71ca..42d011a6 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ sc.fiji bigwarp_fiji - 9.2.1-SNAPSHOT + 9.2.2-SNAPSHOT BigWarp plugin for Fiji A tool for manual pointwise deformable registration using bigdataviewer. From d987ceeae986a0390114eb6402b28c87e38ab19e Mon Sep 17 00:00:00 2001 From: John Bogovic Date: Mon, 7 Oct 2024 14:58:25 -0400 Subject: [PATCH 6/6] fix: bug in transform caching * test sizes of scale levels of cached transformed images --- src/main/java/bigwarp/BigWarpInit.java | 12 ++++++------ .../java/bigwarp/BigWarpTransformCacheTests.java | 9 ++++++++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/main/java/bigwarp/BigWarpInit.java b/src/main/java/bigwarp/BigWarpInit.java index f03063f9..ed8ad65d 100644 --- a/src/main/java/bigwarp/BigWarpInit.java +++ b/src/main/java/bigwarp/BigWarpInit.java @@ -1038,15 +1038,15 @@ public static & NativeType, V extends Volatile & // update the source transform to take into account any change in bounding box final AffineTransform3D newSourceTform = origScaleTform.copy(); final Translation tlation = new Translation(targetInterval.minAsDoubleArray()); - newSourceTform.concatenate(tlation.inverse()); + newSourceTform.concatenate(tlation); sourceTransforms[i] = newSourceTform; InvertibleRealTransformSequence tformToPixelSpace = new InvertibleRealTransformSequence(); - tformToPixelSpace.add(origScaleTform); + tformToPixelSpace.add(newSourceTform); tformToPixelSpace.add(transform.copy()); - tformToPixelSpace.add(newSourceTform.inverse()); + tformToPixelSpace.add(origScaleTform.inverse()); - final RandomAccessibleInterval raiTform = transform( img, pixelInterval, tformToPixelSpace); + final RandomAccessibleInterval raiTform = transform(img, pixelInterval, tformToPixelSpace); final ReadOnlyCachedCellImgFactory cacheFactory = new ReadOnlyCachedCellImgFactory( new ReadOnlyCachedCellImgOptions() .volatileAccesses(true) @@ -1071,16 +1071,16 @@ public void load(SingleCellArrayImg cell) throws Exception { final CacheHints cacheHints = new CacheHints(LoadingStrategy.BUDGETED, priority, false); vmipmaps[i] = VolatileViews.wrapAsVolatile(cachedTransformedMipmap, sharedQueue, cacheHints); } - final RandomAccessibleIntervalMipmapSource cachedTransformedSource = new RandomAccessibleIntervalMipmapSource( mipmaps, type, sourceTransforms, src.getVoxelDimensions(), - src.getName(), + src.getName() + "cached tform", src.doBoundingBoxCulling()); + final Source vsrc = new VolatileSource(cachedTransformedSource, vtype, sharedQueue); final SourceAndConverter vsac = new SourceAndConverter(vsrc, BigDataViewer.createConverterToARGB(vtype)); return new SourceAndConverter(cachedTransformedSource, BigDataViewer.createConverterToARGB(type), vsac); diff --git a/src/test/java/bigwarp/BigWarpTransformCacheTests.java b/src/test/java/bigwarp/BigWarpTransformCacheTests.java index 7cb88108..669f3b37 100644 --- a/src/test/java/bigwarp/BigWarpTransformCacheTests.java +++ b/src/test/java/bigwarp/BigWarpTransformCacheTests.java @@ -47,6 +47,13 @@ public void cachedIdentityTransform() { Source tgtSrc = bwData.getTargetSource(0).getSpimSource(); assertEquals("moving source is not cached", CachedCellImg.class, mvgSrc.getSource(0, 0).getClass()); + assertArrayEquals("scale level 0 pixel raster wrong size", + tgtSrc.getSource(0, 0).dimensionsAsLongArray(), + mvgSrc.getSource(0, 0).dimensionsAsLongArray()); + assertArrayEquals("scale level 1 pixel raster wrong size", + tgtSrc.getSource(0, 1).dimensionsAsLongArray(), + mvgSrc.getSource(0, 1).dimensionsAsLongArray()); + assertTrue("scale level 0 not equal", equal(tgtSrc.getSource(0, 0), mvgSrc.getSource(0, 0))); assertTrue("scale level 1 not equal", equal(tgtSrc.getSource(0, 1), mvgSrc.getSource(0, 1))); } @@ -111,7 +118,7 @@ public void cachedTranslationTransformOffset() { final AffineTransform3D tgtTform0 = new AffineTransform3D(); tgtSrc.getSourceTransform(0, 0, tgtTform0); - tgtTform0.preConcatenate(translation); + tgtTform0.preConcatenate(translation.inverse()); assertArrayEquals("mvg transform is not the translated tgt transform", tgtTform0.getRowPackedCopy(), mvgTform0.getRowPackedCopy(), 1e-9); }