[vtkusers] Re: How to draw an image with fixed size??

Goodwin Lawlor goodwin.lawlor at ucd.ie
Tue Jul 27 11:55:25 EDT 2004


Hi Sergio

    double window = fabs(range[1] - range[0]);
    double level = window / 2.0;

should be

    double window = fabs(range[1] - range[0]);
    double level = range[1] + window / 2.0;

but that not the problem...

You could use vtkImageResample to make your image fit or else use
vtkImageActor and play around with the camera zoom.

hth

Goodwin



"Sergio Andres" <sergio at unizar.es> wrote in message
news:4106694E.8050005 at unizar.es...
Thanks for your answer.

My code is the following:

    double * range = image->GetScalarRange();
    double window = fabs(range[1] - range[0]);
    double level = window / 2.0;

    this->imageViewer->SetPosition(5,5);
    this->imageViewer->GetRenderWindow()->SetSize(64, 64);

    this->imageViewer->SetInput(image);
    this->imageViewer->SetColorWindow(window);
    this->imageViewer->SetColorLevel(level);

    this->imageViewer->Render();

But only a 64x64 square of the original image is drawn.
And this is not what I wanted to do.
What I want is to 'rescale' the rendered image inside the 64x64 render
window.

Maybe it does not work because of vtkImageViewer... ??
Should I use vtkRenderer and vtkRenderWindow instead vtkImageViewer ??

Sergio.

ALIZIER Julien AUSY escribió:

>Hi Segio,
>
>Did you try renWin->SetSize(64, 64) ?
>
>It works for me in ParaView.
>
>-- Julien
>
>
>
>-----Message d'origine-----
>De : Sergio Andres [mailto:sergio at unizar.es]
>Envoyé : mardi 27 juillet 2004 16:22
>À : Toth Istvan; vtkusers
>Objet : Re: [vtkusers] How to draw an image with fixed size??
>
>
>Thanks but, you sent me 4 vtk files with polydata dataobjects and 1 .exe.
>
>My problem is that I cannot draw a 2D image (vtkImageData object) in a
>vtkRenderWindow
>with a given window size (i.e.: 64x64 pixels)
>
>Sergio.
>
>
>Toth Istvan escribió:
>
>vtkImageData object is for bmp,jpg an so an...
>Take a look to this example..I attached it..to you
>
>----- Original Message ----- 
>From: Sergio Andres
>To: Toth Istvan ; vtkusers
>Sent: Tuesday, July 27, 2004 6:52 AM
>Subject: Re: [vtkusers] How to draw an image with fixed size??
>
>
>a vtkImageData object
>
>Toth Istvan escribió:
>
>What kind of vtk is it??Polydata PointStruct Grid...??
>
>----- Original Message ----- 
>From: "Sergio Andres" <sergio at unizar.es>
>To: <vtkusers at vtk.org>
>Sent: Tuesday, July 27, 2004 4:52 AM
>Subject: [vtkusers] How to draw an image with fixed size??
>
>
>
>Hi all,
>
>I would like to draw a vkt Image in a vtkRenderWindow with a give size
>(for instance, 64x64).
>I have been working with vtkImageViewer, which renders a given image.
>But I do not know
>how to draw the given image (whole image) when the size of
>vtkImageViewer (vtkRenderWindow)
>is lower than the image size.
>
>My purpose is to draw any image in a 64 x 64 window.
>
>Does anyone know how to do it?
>
>Thanks !!
>Sergio
>
>_______________________________________________
>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
>
>
>
>


_______________________________________________
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