[vtkusers] image scale using vtk

Abdelkhalek Bakkari bakkari.abdelkhalek at hotmail.fr
Wed Oct 4 05:07:51 EDT 2017


Dear VTK users,


How can I change the scale of the image based on the following code lines :


double center2[3] = {image_vtk->GetCenter()[0], image_vtk->GetCenter()[1], image_vtk->GetCenter()[2]};
        if (image_vtk->GetExtent()[0] % 2 == 1)
        {
            center2[0] = image_vtk->GetCenter()[0] + 0.5*image_vtk->GetSpacing()[0];
            center2[1] = image_vtk->GetCenter()[1];
            center2[2] = image_vtk->GetCenter()[2];
        }

        // Setting camera to view the rendered slice to the whole viewport.
        float xc = image_vtk->GetOrigin()[0] + 0.5*(image_vtk->GetExtent()[0]+ image_vtk->GetExtent()[1])*image_vtk->GetSpacing()[0];
        float yc = image_vtk->GetOrigin()[1] + 0.5*(image_vtk->GetExtent()[2] + image_vtk->GetExtent()[3])*image_vtk->GetSpacing()[1];
        float yd = (image_vtk->GetExtent()[3] - image_vtk->GetExtent()[2] + 1)*image_vtk->GetSpacing()[1];

        float d = camera->GetDistance();
        camera->SetParallelScale(yd);




Kind regards,

<https://about.me/abdelkhalek.bakkari?promo=email_sig&utm_source=product&utm_medium=email_sig&utm_campaign=edit_panel&utm_content=thumb>



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20171004/0b47ae97/attachment.html>


More information about the vtkusers mailing list