[Python.NET] Array problem

Ashcroft, B.A. Ashcroft at Physics.LeidenUniv.nl
Mon Jun 8 20:00:47 CEST 2009


Hello,
  I have a microscopy program that produces images at a fast rate, I would like to be able to process these images as they are produced with scipy.  I tried pythonnet, but the arrays do not seem to work or are so slow that they would be useless.  Here is my code.

  def ImageProcess(self, cImage): 
        a = cImage.GetArrayDouble()
        Y = zeros(  (cImage.Width,cImage.Height)  )
        #Python does not like .net arrays.  You must change it over to python array to use it
        #This code is so slow that it is impossible to use.
        for i in range(0,cImage.Width):
            for j in range(0,cImage.Height):
                Y[i,j]=a[i,j] 
        #Whatever is placed in the array is not a type that agrees with scipy as this function fails as well
        F =fft(Y)
        #I am not sure what kind of array to accept on the c# side as I am not sure what the return value is
        test = CoreImage.CreateImageFromArray(F)
        return cImage  

Thanks for your help


More information about the PythonDotNet mailing list