2015-06-22 490 views
0

我寫了一個多語言3-D圖像去噪ImageJ插件,它對圖像執行一些操作並將去噪圖像作爲一維數組返回。一維數組包含NaN值(邊緣附近)。一維數組轉換回圖像堆棧並顯示。它只是黑色。我保存了圖像堆棧並再次在ImageJ中打開它。我將光標移到圖像上,看到值應該改變。在一些地方(我認爲神經元是)像素值在1000-4000的範圍內。然而,整個圖像只是黑色。這裏是一個數組轉換爲圖像堆疊在最後的代碼片段:顯示帶有NaN值的32位圖像(ImageJ)

# 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() 

任何幫助來是怎麼回事?

回答

3

圖像的顯示範圍可能設置不正確。

嘗試

outputImp.resetDisplayRange() 

outputImp.setDisplayRange(Stats.min, Stats.max) 

更多信息,請參見ImagePlus javadoc

+0

第二行代碼有效。儘管如此,這整件事情還是很奇怪。此算法的不完整版本不包含NaN值,但沒有此顯示範圍問題。你知道這個問題是如何造成的嗎? – Haider