I wrote a multilanguage 3-D image denoising ImageJ plugin that does some operations on an image and returns the denoised image as a 1-D array. The 1-D array contains NaN values (around the edges). The 1-D array is converted back into an image stack and displayed. It is simply black. I saved the image stack and opened it in ImageJ again. I moved my cursor over the image and saw the values change as they should. In some places (where I presume the neurone is) the pixels values were in the range of 1000-4000 . Yet, the whole image was simply pitch black. Here is a snippet of the code that converts the array into an image-stack at the end:
# Image-denoising routines written in C (this is where the nan values are introduced) fimg = JNApackage.NativeCodeJNA.NativeCall(InputImgArray, medfiltArray, int(searchradius), int(patchradius), beta , int(x), int(y), int(z)) # Optimal Inverse Anscombe Transform (Some more operations in Jython) fimg = InverseAnscombe.InvAnscombe(fimg) InputImg.flush() outputstack = ImageStack(x, y, z ) for i in xrange(0, z): # Get the slice at index i and assign array elements corresponding to it. outputstack.setPixels(fimg[int(i*x*y):int((i+1)*x*y)], i+1) print 'Preparing denoised image for display ' outputImp = ImagePlus("Output Image", outputstack) #print "OutputImage Stats:" Stats = StackStatistics(outputImp) print "mean:", Stats.mean, "minimum:", Stats.min, "maximum:", Stats.max outputImp.show()
Any help as to what is going on?