VTK without the V(isualization)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

VTK without the V(isualization)

Brian Davis-2
I understand that VTK is all about visualization (the V), however I am working on an app that uses VTK in the background and never shows a renderwindow.  Ok well not quite true as it can/should also be capable of rendering the same pipleine/steps as the app can also be run with visualization and manual interaction rendering.  So the app should be capable with the V and without the V ideally with little to no changes. 

Problem I seem to be running into is that some of the code to create say clip planes using a vtkBoxWidget is not possible without a render window or inter actor as is my understanding.  When trying to find non visual "replacements" such as using vtkBoxRepresentation or vtkBox or (put whatever option here) the api does not seem to have a similar or same api interface such as GetPlanes() for what I think may be non visual replacements

So If i use vtkBoxWidget in the V mode.

boxWidget = vtkSmartPointer<vtkBoxWidget>::New();

It works great.  Then I look for a GetPlanes() replacemnt in non V mode here
and find:

GetPlanes() : vtkBoxRepresentation , vtkBoxWidget , vtkClipConvexPolyData , vtkFrustumSource

so I try

box = vtkSmartPointer<vtkBoxRepresentation>::New();

and I then get a bizarre warning as at the error window:
Generic Warning: in C\yada\yada\VTK\Rendering\Core\vtkPropety.cxx, line 45
Error: no override found for vtkProperty

The odd part is that at one point I could use vtkBoxRepresentation as a replacement in the past as it worked.This seems as though I am trying to create an abstract class or something.

as stack trace yeilds:

>    mydll.dll!vtkSmartPointer<vtkBoxRepresentation>::New() Line 117    C++

where 117 in vtkSmartPointer.h is:

  // Description:
  // Create an instance of a VTK object.
  static vtkSmartPointer<T> New()
    {
117:    return vtkSmartPointer<T>(T::New(), NoReference());
    }

and

     vtkInteractionWidgets-7.0.dll!000007fed708f9ba()    Unknown

before finally going kittywampus at:

     vtkInteractionWidgets-7.0.dll!000007fed708f9ba()    Unknown


Is there any advice for using VTK in both modes "visualized" and "not Visualized" and just using it as a non visual processing pipeline.


If I try using vtkBox inplace of vtkBoxWidget then I have to start diverging from the original code pipeline and use AddBounds and what ever the replacement would be for GetPlanes(clipFunc). 

Any thoughts on the problem?









_______________________________________________
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

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTK without the V(isualization)

Brian Davis-2

Investigating
a little further reveals

virtual vtkPlaneCollection* vtkClipConvexPolyData::GetPlanes ( )

is not the same as

void vtkBoxRepresentation::GetPlanes ( vtkPlanesplanes)

and

void vtkBoxWidget::GetPlanes ( vtkPlanesplanes)

and hey... why would it be for consistency sake?

or for that matter:

virtual vtkPlanes* vtkFrustumSource::GetPlanes ( )

Not that I need a Frustrum.

So I look into vtkClipConvexPolyData and vtkPlaneCollecion to see if I can get vtkPlanes* and of course I can't.  I get the feeling that vtk is a bit fractured.

Can someone explain to me why what is seemingly similar things in vtk have such different interfaces that don't seem to play nice with (itself) it's own api?








 


_______________________________________________
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

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTK without the V(isualization)

Sankhesh Jhaveri-2

Hi Brian,

VTK would work fine with an offscreen render window which inherently does not get any user interaction.

What is your use case for using widgets? Using the offscreen approach you would have to maintain app-side widgets and then directly feed the relevant values to the VTK objects.

For example, If you’d like to use the box widget to crop a volume, you can have an app-side widget that computes the bounds for the crop and directly use those bounds for cropping the volume in VTK.

Hope that helps.

Thanks,
Sankhesh


On Tue, Jan 31, 2017 at 11:44 PM Brian Davis <[hidden email]> wrote:

Investigating
a little further reveals

virtual vtkPlaneCollection* vtkClipConvexPolyData::GetPlanes ( )

is not the same as

void vtkBoxRepresentation::GetPlanes ( vtkPlanesplanes)

and

void vtkBoxWidget::GetPlanes ( vtkPlanesplanes)

and hey... why would it be for consistency sake?

or for that matter:

virtual vtkPlanes* vtkFrustumSource::GetPlanes ( )

Not that I need a Frustrum.

So I look into vtkClipConvexPolyData and vtkPlaneCollecion to see if I can get vtkPlanes* and of course I can't.  I get the feeling that vtk is a bit fractured.

Can someone explain to me why what is seemingly similar things in vtk have such different interfaces that don't seem to play nice with (itself) it's own api?








 

_______________________________________________
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

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
--
Sankhesh Jhaveri
Sr. Research & Development Engineer | Kitware | (518) 881-4417

_______________________________________________
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

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTK without the V(isualization)

Brian Davis-2

Yes I can use vtk without visualization objects.  The workaround I found to this was not even to use the boxWidget or any other vtk object, but rather go low level and:

clipFunc->SetBounds( bounds )

where

bounds is

double bounds[6];

which is just calc in code

            double z_cen = (bounds[5] - bounds[4]) / 2.0;
            double z_spc = (bounds[5] - bounds[4]) / 512.0;
            bounds[4] = z_cen;
            bounds[5] = z_cen + z_spc;

Then check of boxWidget exists (then rendering is active else non render pipeline is active)


    void clip(void){

        if (boxWidget.Get()){

            if (boxWidget->GetEnabled() != 1) return;

            boxWidget->GetPlanes(clipFunc);
            clipper->Update();
            surface->DeepCopy(clipper->GetOutput());
            clippedSurface->DeepCopy(clipper->GetClippedOutput());
            cutter->Update();
            cutLines->DeepCopy(cutter->GetOutput());
            boxWidget->Off();
            //boxWidget->EnabledOff();
        }
        else{
           
            //box->GetPlanes(clipFunc);
            clipFunc->SetBounds(bounds);


            clipper->Update();
            surface->DeepCopy(clipper->GetOutput());
            clippedSurface->DeepCopy(clipper->GetClippedOutput());
            cutter->Update();
            cutLines->DeepCopy(cutter->GetOutput());
        }


    }

Thanks to those that responded.



_______________________________________________
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

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Loading...