Commit ddd73ea6 authored by David Partyka's avatar David Partyka
Browse files

Merge branch '09223-tkphoto-python' into release

parents 563935c6 45ee87e5
......@@ -167,19 +167,32 @@ extern "C" {
// Find the image
#ifdef VTK_PYTHON_BUILD
void *ptr;
char typeCheck[128];
sscanf ( argv[1], "_%lx_%s", (long *)&ptr, typeCheck);
if ( strcmp ( "vtkImageData", typeCheck ) != 0
&& strcmp ( "vtkStructuredPoints", typeCheck ) != 0 )
char typeCheck[256];
#if VTK_SIZEOF_VOID_P == VTK_SIZEOF_LONG
union { void *p; unsigned long l; } u;
sscanf ( argv[1], "_%lx_%s", &u.l, typeCheck);
#elif defined(VTK_TYPE_USE_LONG_LONG)
union { void *p; unsigned long long l; } u;
sscanf ( argv[1], "_%llx_%s", &u.l, typeCheck);
#elif defined(VTK_TYPE_USE___INT64)
union { void *p; unsigned __int64 l; } u;
sscanf ( argv[1], "_%I64x_%s", &u.l, typeCheck);
#endif
// Various historical pointer manglings
if ( strcmp ( "vtkImageData", typeCheck ) != 0 &&
strcmp ( "vtkImageData_p", typeCheck ) != 0 &&
strcmp ( "p_vtkImageData", typeCheck ) != 0 &&
strcmp ( "vtkStructuredPoints", typeCheck ) != 0 &&
strcmp ( "vtkStructuredPoints_p", typeCheck ) != 0 &&
strcmp ( "p_vtkStructuredPoints", typeCheck ) != 0 )
{
// bad type
ptr = NULL;
u.p = NULL;
}
image = (vtkImageData*) ptr;
image = static_cast<vtkImageData*>(u.p);
#else
image = (vtkImageData*) vtkTclGetPointerFromObject ( argv[1],
"vtkImageData", interp, status );
image = static_cast<vtkImageData*>(
vtkTclGetPointerFromObject ( argv[1], "vtkImageData", interp, status ));
#endif
if ( !image )
{
......
......@@ -18,7 +18,8 @@ class vtkTkPhotoImage ( Tkinter.PhotoImage ):
# Caller the superclass
Tkinter.PhotoImage.__init__ ( self, kw )
vtkLoadPythonTkWidgets ( self.tk )
def PutImageSlice ( self, image, z, orientation='transverse', window=256, level=128 ):
t = image.__this__
s = 'vtkImageDataToTkPhoto %s %s %d %s %d %d' % ( t[:-2], self.name, z, orientation, window, level )
t = str ( image.__this__ )
s = 'vtkImageDataToTkPhoto %s %s %d %s %d %d' % ( t, self.name, z, orientation, window, level )
self.tk.eval ( s )
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment