[vtkusers] crop an image
francesco caruso
guernika_devel at yahoo.it
Mon Sep 27 04:22:04 EDT 2004
Hello
I need to set alpha value for a rectangular
region of a vtkImageActor
this actor has been generated from an array of unsigned char
in the RGBA form, with alpha value initially set to 255.
How can I set, for example, alpha = 0 for the region (xmin,xmax,ymin,ymax)?
Here is the snippet of code which I use to get the imageActor
def UnsignedCharArrayToImageActor( array, xsize, ysize, bpp ): #return
an imageActor from an array
imageImporter = vtk.vtkImageImport()
imageImporter.SetDataScalarTypeToUnsignedChar()
imageImporter.SetNumberOfScalarComponents(bpp+1)
imageImporter.SetDataSpacing( 1, 1, 1 )
imageImporter.SetWholeExtent( 0, xsize-1, 0, ysize-1, 0, 0 )
imageImporter.SetImportVoidPointer( array.GetVoidPointer(0) )
imageImporter.SetDataOrigin( -(xsize-1)/2, -(ysize-1)/2,0)
imageActor = vtk.vtkImageActor()
imageActor.SetInput( imageImporter.GetOutput() )
return imageActor
any help would be appreciated
thanks
francesco
More information about the vtkusers
mailing list