[vtkusers] Fwd: Re:AW: vtkContourFilter not working on vtkStructuredGrid

Sebastian Gatzka sebastian.gatzka at stud.tu-darmstadt.de
Wed Mar 10 07:13:19 EST 2010


No, this doesn't work out.
I put Update()'s at every (possible) object but nothing happens.

Even chaning SetValue() and GenerateValues() doesn't change that.
So maybe there is something wrong with the data?!

I have a structured grid (called sGrid) and the scalar values are 
defined at the cell centers:

sGrid->GetCellData()->SetScalars(T);

But I just pass the sGrid to the vtkContourFilter

vtkContourFilter *scalarIsoSurface vtkContourFilter::New();
scalarIsoSurface->SetInput(sGrid);

May this be the problem?


-------- Original-Nachricht --------
Betreff: 	Re:AW: [vtkusers] vtkContourFilter not working on 
vtkStructuredGrid
Datum: 	Sat, 06 Mar 2010 09:34:59 +0530
Von: 	Rakesh Patil <rakeshthp at in.com>
Antwort an: 	Rakesh Patil <rakeshthp at in.com>
An: 	Sebastian Gatzka <sebastian.gatzka at stud.tu-darmstadt.de>



Hi Sebastian,

I see there is a small mistake over there in your code..

As far as my knowledge is concerned,

scalarIsoSurface->GenerateValues(0,0.1);

This statement should produce error. Coz, according to the documentation 
given here

http://www.vtk.org/doc/release/5.4/html/a00323.html

GenerateValues takes two parameters if and only if second parameter is a 
double array comprising of two elements min and max range.

Even if this code executes without any error, then also no output will 
be produced, because the first argument you are passing is 0. First 
parameter tells the number of contours to be generated, Second parameter 
tells within what range these contours should be plotted.

What i guess is, either you change it that statement t o

scalarIsoSurface->SetValue(0, 0.1);

or

scalarIsoSurface->GenerateValues( n, sGrid->GetScalarRange() );

where n is number of lines you want, say 1, 5, 10, 12... whatever...

And then say update..

Am i correct David Sir..??

Thanks

Regards

Rakesh Patil


    ---------- Original message ----------
    From:"Sebastian Gatzka"< sebastian.gatzka at stud.tu-darmstadt.de >
    Date: 05 Mar 10 22:50:50
    Subject: AW: [vtkusers] vtkContourFilter not working on
    vtkStructuredGrid
    To: "'Rakesh Patil'"

    Hm. The ->Update() did not work out.

    What can be wrong? How can the data be not fed correctly?

    *Von:* Rakesh Patil [mailto:rakeshthp at in.com]
    *Gesendet:* Freitag, 5. M¤rz 2010 16:25
    *An:* David Doria
    *Cc:* Sebastian Gatzka; vtkusers at vtk.org
    *Betreff:* Re: [vtkusers] vtkContourFilter not working on
    vtkStructuredGrid


    Ya, I had also done the same mistake... I had ommitted that update
    statement.. By putting that update statement is should definitley
    work.. (only if data is fed correctly)


    ---------- Original message ----------
    From:David Doria< daviddoria+vtk at gmail.com >
    Date: 05 Mar 10 19:26:03
    Subject: Re: [vtkusers] vtkContourFilter not working on
    vtkStructuredGrid
    To: Sebastian Gatzka

    On Fri, Mar 5, 2010 at 8:41 AM, Sebastian Gatzka
    <sebastian.gatzka at stud.tu-darmstadt.de
    <mailto:sebastian.gatzka at stud.tu-darmstadt.de>> wrote:

    Hello.

    I really can't tell why my code is not gernerating the iso-surface.
    I have a structured grid (sGrid) filled with scalars.

    I call the contour filter

    vtkContourFilter *scalarIsoSurface vtkContourFilter::New();
    scalarIsoSurface->SetInput(sGrid);
    scalarIsoSurface->GenerateValues(0,0.1);

    Compute the normal

    vtkPolyDataNormals *sGridPolyDataNormal vtkPolyDataNormals::New();
    sGridPolyDataNormal->SetInput(scalarIsoSurface->GetOutput());

    Put them into a poly data mapper

    vtkPolyDataMapper *scalarIsoSurfaceMapper vtkPolyDataMapper::New();
    scalarIsoSurfaceMapper->SetInput(sGridPolyDataNormal->GetOutput());

    and into an actor

    vtkActor *scalarIsoSurfaceActor = vtkActor::New();
    scalarIsoSurfaceActor->SetMapper(scalarIsoSurfaceMapper);

    which is passed on to the scene

    ren1->AddActor(scalarIsoSurfaceActor);

    and NOTHING happens.

    Any ideas what I have missed, or whats wrong?

    Sebastian

    You probably have a call to Render() after the code you sent us,
    which I believe updates the whole pipeline. Whenever I have
    something that is totally empty, I go back and put an Update() call
    on every object that is updatable.

    scalarIsoSurface->GenerateValues(0,0.1);

    scalarIsoSurface->Update();

    before I dig too deep.

    If that doesn't change anything, try to create a demo involving some
    simple data (using a vtk*Source if you can, so we can reproduce it
    without needing your dataset). Then send us the smallest compilable
    code that demonstrates the problem.


    Thanks,

    David

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100310/1a92e1f6/attachment.htm>


More information about the vtkusers mailing list