juglab / N2V_fiji

BSD 2-Clause "Simplified" License
21 stars 3 forks source link

Exception for 3D stack with dimension smaller than patch size #29

Open jdeschamps opened 3 years ago

jdeschamps commented 3 years ago

Originally raised here

Training on a 3D dataset with the smallest dimension being smaller than the patch size causes a negative range variable in N2VDataWrapper. See dimension of the tiles generated by N2V here.

In the example on the forum, the stack is 512x512x13 and the minimum patch size is 16. The tiles end up being 13x13x13, causing the range variable in the N2VDataWrapper to have negative dimensions. In turn, the exception is raised by Random.int() called on a negative number.