[vtkusers] Resizing an Image in VTK

John Eke johne at annidis.com
Mon Jun 9 13:34:15 EDT 2008


Thanks a lot. This seems to work, BUT not with vtkImageActor. When I 
switch to image viewer, the image resizes nicely. Is there something in 
the imageActor I am not setting up correctly?

Thanks

Utkarsh Ayachit wrote:
> Try using vtkImageResample::SetAxisMagnificationFactor() to set the 
> magnification factor along each dimension.
>
> Utkarsh
>
> John Eke wrote:
>> Thanks for responding. I am using it but nothing seems to be working. 
>> Heres what I have:
>>
>>        vtkPNGReader *reader = vtkPNGReader::New();
>>        reader->SetFileName(path.toStdString().c_str());
>>              vtkImageCast *cast = vtkImageCast::New();
>>        cast->SetInputConnection(reader->GetOutputPort());
>>        cast->SetOutputScalarTypeToUnsignedChar();
>>        cast->ClampOverflowOn();
>>              vtkImageResample *resample = vtkImageResample::New();
>>        resample->SetInputConnection(cast->GetOutputPort());
>>        m_pImageActor->SetInput(resample->GetOutput());
>>
>> And what I get is my regular image clipped to the size of the view 
>> window. Image is not resized at all. Any ideas? Given the size of my 
>> render window, how can I read the image, and pin its size to the size 
>> of the render window so that the image is always "maximized" in 
>> there, and not have blank space surrounding it?
>>
>> Thanks again
>>
>> John
>>
>> Utkarsh Ayachit wrote:
>>> Have you looked at vtkImageResample filter?
>>>
>>> Utkarsh
>>>
>>> John Eke wrote:
>>>> Hi
>>>>
>>>> I know this is really simple, but for some reason I cant find out 
>>>> how to do it. I am reading a png image, I simply need to resize the 
>>>> image to the size of the vtk window. Could someone please show me 
>>>> how to do this?
>>>>
>>>> Thanks
>>>>
>>>> John
>>>> _______________________________________________
>>>> This is the private VTK discussion list.
>>>> Please keep messages on-topic. Check the FAQ at: 
>>>> http://www.vtk.org/Wiki/VTK_FAQ
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>>
>>
>>




More information about the vtkusers mailing list