Jython array statistic

Hi All,

I want to do statistical manipulation on array (mean, std … ). with Jython !

can someone please help me with the task

Regards

Hi, sorry for the late reply (vacations :yum:)
I assumed you use Jython within Fiji.

You could use some Java libraries, but the simplest is to use a subclass of ImageProcessor object that contains your array. Then you can get the statistical measurements from there like

from ij.process import ByteProcessor

array = range(10)
Proc  = ByteProcessor(len(array), 1, array) # for data between 0 and 255, use other type of processor for float or higher values
stat = Proc.getStats()

print stat 
print stat.mean

You can not directly create an ImageProcessor, which is a “model” class, but you can create a ByteProcessor, FloatProcessor…

1 Like