PreibischLab / BigStitcher

ImgLib2/BDV implementation of Stitching for large datasets
GNU General Public License v2.0
67 stars 14 forks source link

content based fusion option generates NullPointerException in FFTMethods.realToComplex #77

Open mhdominguez opened 4 years ago

mhdominguez commented 4 years ago

Hi Preibisch Lab, BigStitcher has been an incredible tool, and really made my project possible. Since the recent round of heavy Fiji updates, I'm no longer able to do image fusion with content based fusion selected. The error occurs regardless of options selected in the "Image Fusion" dialog, just as long as content based is enabled.

Thank you for all your hard work on such an amazing plugin!!

Console output:

Aug 08, 2020 9:25:54 AM java.util.prefs.FileSystemPreferences$6 run
WARNING: Prefs file removed in background /home/martin/.java/.userPrefs/sc/fiji/cellCounter/CellCounterOptions/prefs.xml
getDescription()

tpId=0 setupId=0
Calibration (transformed): (0.24088361014139506, 0.23931724344167352, 0.23959768516222754) µm

tpId=0 setupId=1
Calibration (transformed): (0.24308893549740485, 0.23882830926775375, 0.23575392724802144) µm

tpId=0 setupId=2
Calibration (transformed): (0.2366316962216771, 0.2395171909382473, 0.23727870982237825) µm
(1.0530405, 1.0599328, 8.347326)
testing scale: 3d-affine: (1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0)
(1.0530405, 1.0599328, 8.347326) valid: true bestScaling: 1.0
testing scale: 3d-affine: (2.0, 0.0, 0.0, 0.0, 0.0, 2.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0)
(2.106081, 2.1198657, 8.347326) valid: false bestScaling: 1.0
testing scale: 3d-affine: (4.0, 0.0, 0.0, 0.0, 0.0, 4.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0)
(4.212162, 4.2397313, 8.347326) valid: false bestScaling: 1.0
testing scale: 3d-affine: (8.0, 0.0, 0.0, 0.0, 0.0, 8.0, 0.0, 0.0, 0.0, 0.0, 2.0, 0.0)
(8.424324, 8.479463, 16.694653) valid: false bestScaling: 1.0
Choosing resolution level: 1.0 x 1.0 x 1.0
View tpId=0 setupId=0 is currently scaled by: (1.0529, 1.0598, 8.3455)
Exception in thread "Thread-13" java.lang.NullPointerException
    at net.imglib2.algorithm.fft2.FFTMethods.realToComplex(FFTMethods.java:689)
    at net.imglib2.algorithm.fft2.FFTMethods.realToComplex(FFTMethods.java:546)
    at net.imglib2.algorithm.fft2.FFT.realToComplex(FFT.java:245)
    at net.imglib2.algorithm.fft2.FFT.realToComplex(FFT.java:123)
    at net.imglib2.algorithm.fft2.FFT.realToComplex(FFT.java:335)
    at net.imglib2.algorithm.fft2.FFT.realToComplex(FFT.java:74)
    at net.imglib2.algorithm.fft2.FFTConvolution.computeImgFFT(FFTConvolution.java:582)
    at net.imglib2.algorithm.fft2.FFTConvolution.convolve(FFTConvolution.java:524)
    at net.imglib2.algorithm.fft2.FFTConvolution.convolve(FFTConvolution.java:502)
    at net.preibisch.mvrecon.process.fusion.transformed.weights.ContentBasedRealRandomAccessible.approximateEntropy(ContentBasedRealRandomAccessible.java:97)
    at net.preibisch.mvrecon.process.fusion.transformed.weights.ContentBasedRealRandomAccessible.<init>(ContentBasedRealRandomAccessible.java:73)
    at net.preibisch.mvrecon.process.fusion.transformed.TransformWeight.transformContentBased(TransformWeight.java:62)
    at net.preibisch.mvrecon.process.fusion.FusionTools.fuseVirtual(FusionTools.java:443)
    at net.preibisch.mvrecon.process.fusion.FusionTools.fuseVirtual(FusionTools.java:287)
    at net.preibisch.mvrecon.fiji.plugin.Image_Fusion.fuse(Image_Fusion.java:190)
    at net.preibisch.mvrecon.fiji.spimdata.explorer.popup.FusionPopup$MyActionListener$1.run(FusionPopup.java:82)
    at java.lang.Thread.run(Thread.java:748)`

ImageJ log:

Using spimdata version: 0.9-revision
Using multiview-reconstruction version: 0.7.3
angles selected: 0, 72, 288
channels selected: 0, 1
illuminations selected: 0
tiles selected: 0
Timepoints selected: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222
Only one tile, starting in MultiView mode.
No corresponding interest points available.
To enable non-rigid please run Interest Point Detection followed by Intererst Point Registration (e.g. ICP) first
Sat Aug 08 13:38:23 PDT 2020: Selected Fusion Parameters: 
Downsampling: 2.0
BoundingBox: Bounding Box 'My Bounding Box1' (-469, 340, -223) >>> (1217, 2414, 1504)
DownsampledBoundingBox: FinalInterval [(-234, 170, -111) -- (609, 1207, 752) = 844x1038x864]
PixelType: 16-bit unsigned integer
Interpolation: Linear Interpolation
CacheType: Precompute Image
Blending: true
Adjust intensities: false
Content-based: true
AnisotropyFactor: NaN
Split by: Each timepoint & channel
Image Export: Display using ImageJ
ImgLoader.isVirtual(): true
ImgLoader.isMultiResolution(): true
Non-Rigid active: false
(Sat Aug 08 13:38:23 PDT 2020): Fusing group 1/1 (group=0-0 >-> 0-2)
Sat Aug 08 13:38:23 PDT 2020: Approximate pixel size of fused image (without downsampling): 0.23898858974897536 µm
(Sat Aug 08 13:38:23 PDT 2020): Requesting Img from ImgLoader (tp=0, setup=0), using level=0, [1.0 x 1.0 x 1.0]

...at which point no further processing or log messages are posted.

Update - the problem is resolved by downgrading imglib2-algorithm-gpl-0.2.4.jar to imglib2-algorithm-gpl-0.2.3.jar. Looking for file diffs in the source archives, it appears that /net/imglib2/algorithm/fft2/FFTConvolution.java has some notable chages between the versions:

lines 39-40 of version 0.2.3 are missing in 0.2.4...

import net.imglib2.algorithm.fft2.FFT;
import net.imglib2.algorithm.fft2.FFTMethods

I can't say that adding back those import lines will fix the problem because I don't have the ability to build these class libraries and test the code, but it is suspicious the problem may be with imglib2 and not with BigStitcher. Other changes in 0.2.4 concern the use of ExecutorService, which is probably unrelated.

mhdominguez commented 3 years ago

This issue is resolved when applying imagejan's patch to imglib2-algorithm-gpl https://github.com/imglib/imglib2-algorithm-gpl/pull/8. Looks like it was a bug with ExecutorService implementation after all.