[vtkusers] Image size

Hüseyin Savaş metlord at hotmail.com
Wed Jul 14 08:38:27 EDT 2010


Eric, thank you very much. This works like a charm.
Following code part spesifically fits the image to the bounds of screen.

//Set up the background camera to fill the renderer with the image
  double origin[3];
  double spacing[3];
  int extent[6];
  imageData->GetOrigin( origin );
  imageData->GetSpacing( spacing );
  imageData->GetExtent( extent );
 
  vtkCamera* camera = backgroundRenderer->GetActiveCamera();
  camera->ParallelProjectionOn();
 
  double xc = origin[0] + 0.5*(extent[0] + extent[1])*spacing[0];
  double yc = origin[1] + 0.5*(extent[2] + extent[3])*spacing[1];
  //double xd = (extent[1] - extent[0] + 1)*spacing[0];
  double yd = (extent[3] - extent[2] + 1)*spacing[1];
  double d = camera->GetDistance();
  camera->SetParallelScale(0.5*yd);
  camera->SetFocalPoint(xc,yc,0.0);
  camera->SetPosition(xc,yc,d); With my best regards,
Huseyin


From: Eric E. Monson 
Sent: Thursday, July 08, 2010 4:26 PM
To: Hüseyin Savaş 
Cc: vtkusers at vtk.org 
Subject: Re: [vtkusers] Image size


Hey Huseyin, 


If calling renderer->ResetCamera(imageActor->GetBounds()) doesn't get you close enough, you can also look at the example on the Wiki where an image is used as the background for a window:


http://www.cmake.org/Wiki/VTK/Examples/Images/BackgroundImage


I think this example came out of this mailing list thread:


http://markmail.org/message/taknydvbtdhv6bsx


I seem to recall anther recent thread talking about an image filling a window, but I can't find it right now.


Good luck,
-Eric


------------------------------------------------------
Eric E Monson
Duke Visualization Technology Group




On Jul 8, 2010, at 3:22 AM, Hüseyin Savaş wrote:


  Actually that looks irrelevant.
  Let me describe my need again: I want my image (probably imageActor) to fill the whole screen.
  As far as I got, I can set the scale of my imageactor with some necessary calculations and then mandatorily set the position of imageactor for aligning the image to center.
  But again as I said, this isn't native at all. There should definitely be a more proper way.
  Thanks in advance.
  Huseyin.

   
  From: Jothy 
  Sent: Wednesday, July 07, 2010 6:09 PM
  To: Hüseyin Savaş 
  Cc: vtkusers at vtk.org 
  Subject: Re: [vtkusers] Image size


  Did you tried ResetCameraClippingRange()?

  Jothy


  2010/7/7 Hüseyin Savaş <metlord at hotmail.com>

    Hello,
    My question looks fairly simple. 
    I have an ImageActor, created via ImageViewer2.getImageActor() , added to a Renderer that has been added to a RenderWindow. 
    The actual image displayed covers nearly the same size, whatever image's resolution is and wastes a lot of screen space with black area. 
    I tried scaling, zooming and some extra stuff to get what I want (having an image that fits to the screen), but all of these solutions didn't look so native. 
    Is there any proper solution to have an image that fits the whole screen?
    Thanks already for any advice.
    Sincerely.


    __________ Information from ESET NOD32 Antivirus, version of virus signature database 5259 (20100707) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com


    _______________________________________________
    Powered by www.kitware.com

    Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

    Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

    Follow this link to subscribe/unsubscribe:
    http://www.vtk.org/mailman/listinfo/vtkusers




  __________ Information from ESET NOD32 Antivirus, version of virus signature database 5260 (20100707) __________

  The message was checked by ESET NOD32 Antivirus.

  http://www.eset.com

  _______________________________________________
  Powered by www.kitware.com

  Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

  Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

  Follow this link to subscribe/unsubscribe:
  http://www.vtk.org/mailman/listinfo/vtkusers


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100714/a172468d/attachment.htm>


More information about the vtkusers mailing list