saalfeldlab / paintera

GNU General Public License v2.0
100 stars 17 forks source link

Commit canvas sometimes fails for WinnerTakesAll Downsampling #315

Closed constantinpape closed 3 weeks ago

constantinpape commented 5 years ago

I haven't found any minimal examples to reproduce this, but for some of my bigger projects, commiting a canvas with WinnerTakes all downsampling fails with this error message:

Exception in thread "Thread-341" java.lang.ArrayIndexOutOfBoundsException: 278400
        at net.imglib2.img.basictypeaccess.array.AbstractLongArray.getValue(AbstractLongArray.java:61)
        at net.imglib2.type.numeric.integer.UnsignedLongType.get(UnsignedLongType.java:219)
        at net.imglib2.type.numeric.integer.UnsignedLongType.getIntegerLong(UnsignedLongType.java:247)
        at org.janelia.saalfeldlab.labels.downsample.WinnerTakesAll$Companion$downsample$getCounts$1.accept(WinnerTakesAll.kt:48)
        at org.janelia.saalfeldlab.labels.downsample.WinnerTakesAll$Companion$downsample$getCounts$1.accept(WinnerTakesAll.kt:15)
        at org.janelia.saalfeldlab.labels.downsample.WinnerTakesAll$Companion$forAllIntervals$4.run(WinnerTakesAll.kt:86)
        at net.imglib2.algorithm.util.Grids.forEachOffset(Grids.java:199)
        at org.janelia.saalfeldlab.labels.downsample.WinnerTakesAll$Companion.forAllIntervals(WinnerTakesAll.kt:79)
        at org.janelia.saalfeldlab.labels.downsample.WinnerTakesAll$Companion.downsample(WinnerTakesAll.kt:56)
        at org.janelia.saalfeldlab.labels.downsample.WinnerTakesAll.downsample(WinnerTakesAll.kt)
        at org.janelia.saalfeldlab.paintera.data.n5.CommitCanvasN5.downsampleIntegerTypeAndSerialize(CommitCanvasN5.java:437)
        at org.janelia.saalfeldlab.paintera.data.n5.CommitCanvasN5.downsampleAndWriteBlocksIntegerType(CommitCanvasN5.java:748)
        at org.janelia.saalfeldlab.paintera.data.n5.CommitCanvasN5.persistCanvas(CommitCanvasN5.java:283)
        at org.janelia.saalfeldlab.paintera.data.mask.MaskedSource.lambda$persistCanvas$13(MaskedSource.java:606)
        at java.lang.Thread.run(Thread.java:748)

This failure is reliable, i.e. it always happens for the same block id and it always happens when I have painted to that block. I am using version 0.19.3, but I have seen this error in earlier versions too.

constantinpape commented 5 years ago

Just FYI, I have converted the labels in the dataset at hand to a label-multiset and can commit blocks normally with it.

cmhulbert commented 3 weeks ago

This should be resolved in version 1.5.0 by b804625c2a4d3b19ffb34201213eec1aea655739.