[Insight-users] How to Use ItkImportImageFilter?
Luis Ibanez
luis.ibanez@kitware.com
Fri May 21 04:14:37 EDT 2004
Hi Tsai,
In response to your request, we starte adding
a helper class for converting ITK images into
Python arrays.
This new class can now be found under
Insight/Wrapping/CSwig/Common/
itkPyBuffer
The intended use will be like
from InsightToolkit import *
from Numeric import *
reader = itkImageFileReaderUC2_New()
reader.SetFileName("file.png")
reader.Update()
pb = itkPyBufferUC2_New()
arr = pb.GetArrayFromImage( reader.GetOutput() )
# where arr is an array
# and also
image = pb.GetImageFromArray( arr )
# where image is an ITK ImageUC2
This class still needs some work....
but you are welcome to look at the code
and make suggestions.
Thanks,
Luis
--------------
tsai wrote:
> Hello,Luis£¡
> My code is like that:
> imArray=array([[3,4,....],[3,4,....]]...........)
>
> how can i define imArray in python?
>
>
>
>
> Best Regards,
>
> tsai
> tsai@sjtu.edu.cn
>
> _______________________________________________
> Insight-users mailing list
> Insight-users@itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
More information about the Insight-users
mailing list