[vtkusers] Displaying large images in a MFC/VTK application

John Platt jcplatt at lineone.net
Thu Jan 22 14:26:59 EST 2004


Hi Quoc Cuong,

The origin of the display coordinates for vtkRenderWindow is the bottom
left corner, whereas Windows uses the top left for its client
coordinates. Consequently, the Y values are different by the window
height - 1 ( vtkRenderWindowInteractor::SetEventInformationFlipY()
handles this shift internally). Is this the shift you are seeing?

You are ahead of me with the scrolling but it is something I would like
to do soon.

John

-----Original Message-----
From: PHAM Quoc-Cuong 203899 [mailto:PHAM at ortolan.cea.fr] 
Sent: 21 January 2004 08:28
To: 'John Platt'
Subject: RE : [vtkusers] Displaying large images in a MFC/VTK
application

Thank you John for replying quickly.

With the method B, the messages are sent to the vtk interactor via
vtkHandleMessage2 but
the y-coordinates returned by vtkInteractorStyle::OnMouseMove() are
wrong
(there is a shift) and the scrolling does not work.
Do you have any idea about it?

Best regards,

Quoc Cuong


-----Message d'origine-----
De : John Platt [mailto:jcplatt at lineone.net] 
Envoyé : mardi 20 janvier 2004 11:38
À : vtkusers at vtk.org
Objet : RE: [vtkusers] Displaying large images in a MFC/VTK application


Quoc Cuong,

As far as the render window is concerned, the differences in behaviour
are
along the following lines.

A) - SetParentId(HWND) - vtk registers its own window class, creates a
new
render window and replaces the WndProc() of the new window by
vtkHandleMessage()/vtkHandleMessage2() which handles useful
mouse/keyboard
events. 

B) - SetWindowId(HWND) - vtk uses the supplied window for rendering. It
attempts to replace the WndProc() but cannot because MFC has a hold on
it
(USER message WM_USER+12 is sent to the current event handler). If you
override WindowProc() in your CView derived class you should see the
messages. You can send these on to vtk using :

  if ( this->iren->GetInitialized()) 
  { 
      HWND hWnd = GetSafeHwnd();
      return vtkHandleMessage2( hWnd, uMsg, wParam, lParam, this->iren
); 
  }

It's not the complete picture but it may help.

-----Original Message-----
From: vtkusers-admin at vtk.org [mailto:vtkusers-admin at vtk.org] On Behalf
Of
PHAM Quoc-Cuong 203899
Sent: 19 January 2004 13:58
To: 'vtkusers at vtk.org'
Subject: [vtkusers] Displaying large images in a MFC/VTK application

Dear vtk users,

I use a vtkImageViewer in a MFC/VTK application to display large images
(3000 x 2000) with some features such as scrolling and mouse
interaction.
The interaction is managed with vtkInteractorStyleUser and the messages
are
passed to vtk by WindowProc.

In my derived class CScrollView, I tried 2 ways to associate the render
window and the MFC view window:
A) with SetParentId(HWND) -> everything works fine with images of
reasonable
size (< 1280 x 1024), but becomes incredibly slow in the case of large
images / or the application crashes depending on the graphics card,
B) with SetWindowId(HWND) -> the display of large images is ok, but I
loose
the expected interactions (scrolling and wrong coordinates returned by
vtkInteractorStyle::OnMouseMove()).

Can anyone help me ?
Thanks,
==
Quoc Cuong PHAM
CEA/DRT/LIST/DTSI/SLA/LCEI
CEA Saclay F-91191 GIF sur Yvette Cedex France
tel : +33 (0)1 69 08 82 98
fax : +33 (0)1 69 08 83 95 
mail : quoc-cuong.pham at cea.fr 
_______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at:
<http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers


_______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at:
<http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers





More information about the vtkusers mailing list