[vtkusers] scale vtkPlaneWidget

Agata Krasoń agatakrason at gmail.com
Tue Mar 4 00:59:07 EST 2014


Ok, now It works well with planeWidget->PlaneWidget(mix_x, max_x, min_y,
max_y, min_z, max_z);

Thanks for Your help !


agata


2014-03-04 0:16 GMT+01:00 Anka Kochanowska <anka at bic.mni.mcgill.ca>:

> But, instead of scaling, you could use
> planeWidget->PlaceWidget(xmin, xmax, ymin, ymax, zmin, zmax)
> It will not make prop3d, but should do what you intend. (Using for
> instance min -0.1, max +0.1)
>
> Setting prop 3d is an option but, would be a little artificial.
> Anka
>
>
> On Mon, Mar 3, 2014 at 2:49 PM, Agata Krasoń <agatakrason at gmail.com>wrote:
>
>> Hmmm it is a problem. I can not set it first.
>> I have ony access by vtkProp3D().  It is vktProp3D(void )
>> I can not do it like  : planeWidget->Scale(10);
>> planeWidget->GetProp3D()->SetScale( ... );
>>
>>
>> agata
>>
>>
>>
>>
>>
>> 2014-03-03 16:17 GMT+01:00 Anka Kochanowska <pluszcz at gmail.com>:
>>
>> Because Prop3D is 0, try to set it first.
>>> Anka
>>>
>>>
>>>
>>> On Mon, Mar 3, 2014 at 9:43 AM, Agata Krasoń <agatakrason at gmail.com>wrote:
>>>
>>>> Hi,
>>>>
>>>> I have  question concerning vtkPlaneWidget.
>>>> I need to scale vtkPlaneWidget.
>>>> I can not scalling well these widget.
>>>> *planeWidget->GetProp3D()->SetScale(scale, scale, scale);*
>>>>  It doesn't work well.
>>>> I always received an exception :
>>>> TestImagePlaneWidget.exe: 0xC0000005: Access violation reading location
>>>> 0x00000000.
>>>>
>>>> Could You help me please ?
>>>>
>>>> Tested  program :
>>>>
>>>> int main ( int argc, char *argv[] )
>>>> {
>>>>   vtkSmartPointer<vtkSphereSource> sphereSource =
>>>> vtkSmartPointer<vtkSphereSource>::New();
>>>>   vtkSmartPointer<vtkPolyDataMapper> mapper =
>>>> vtkSmartPointer<vtkPolyDataMapper>::New();
>>>>   mapper->SetInputConnection(sphereSource->GetOutputPort());
>>>>   vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
>>>>   actor->SetMapper(mapper);
>>>>
>>>>   // Visualization
>>>>   vtkSmartPointer<vtkRenderer> renderer =
>>>> vtkSmartPointer<vtkRenderer>::New();
>>>>   vtkSmartPointer<vtkRenderWindow> renderWindow
>>>> =vtkSmartPointer<vtkRenderWindow>::New();
>>>>   renderWindow->AddRenderer(renderer);
>>>>   vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
>>>> vtkSmartPointer<vtkRenderWindowInteractor>::New();
>>>>   renderWindowInteractor->SetRenderWindow(renderWindow);
>>>>
>>>>   vtkSmartPointer<vtkSplineWidget2> splineWidget =
>>>> vtkSmartPointer<vtkSplineWidget2>::New();
>>>>   splineWidget->SetInteractor(renderWindowInteractor);
>>>>
>>>>   vtkSmartPointer<vtkImagePlaneWidget> planeWidget =
>>>> vtkSmartPointer<vtkImagePlaneWidget>::New();
>>>>   planeWidget->SetInteractor(renderWindowInteractor);
>>>>  /* double iso_scale[3] = {1,1,0};
>>>>   double p1[3] = {0,0,0};
>>>>   double p2[3] = {0,100,0};*/
>>>>   double scale = 10;
>>>>   //planeWidget->GetPoint1(p1);
>>>>   //planeWidget->GetPoint2(p2);
>>>> *  planeWidget->GetProp3D()->SetScale(scale, scale, scale);  // ? *
>>>>
>>>>  // planeWidget->GetProp3D()->SetScale(iso_scale);
>>>>
>>>>   renderer->AddActor(actor);
>>>>   renderer->ResetCamera();
>>>>   planeWidget->On();
>>>>   splineWidget->On();
>>>>   renderer->SetBackground(.3, .6, .3);
>>>>   renderWindow->Render();
>>>>   renderWindowInteractor->Start();
>>>>
>>>>   return EXIT_SUCCESS;
>>>> }
>>>>
>>>>
>>>> I would appreciate for any help please :)
>>>>
>>>> Agatte
>>>>
>>>> _______________________________________________
>>>> 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/20140304/09062514/attachment.html>


More information about the vtkusers mailing list