[vtkusers] Fwd: Re:AW: vtkContourFilternotworkingonvtkStructuredGrid

Sebastian Gatzka sebastian.gatzka at stud.tu-darmstadt.de
Fri Mar 12 07:34:43 EST 2010


It's finite-volume-calculation 
<http://en.wikipedia.org/wiki/Finite_volume_method> scalar data, which 
is - as a matter of fact - stored at the cell centers.
Maybe I have to interpolate to the points if contour filter doesn't work 
on cell data?!

Am 12.03.2010 13:28, schrieb Rakesh Patil:
>
> Well,
>
> What type of data is it..?? Is it a mesh or set of points..?? Why you 
> want to set scalars for cell data..?? If you change this to set 
> scalars to points it may work i guess.. Because, for me it works fine 
> with points and only thing which comes in my mind is that, contour 
> filter works only with point data and not cell data..
>
> Any way to make contour filter work with cell data guys..??
>
> Thanks
>
> Regards
> Rakesh Patil
>
>
>     ---------- Original message ----------
>     From:Sebastian Gatzka< sebastian.gatzka at stud.tu-darmstadt.de >
>     Date: 12 Mar 10 16:35:42
>     Subject: Re: [vtkusers] Fwd: Re:AW:
>     vtkContourFilternotworkingonvtkStructuredGrid
>     To: vtkusers
>
>     I have checked it maybe a hundrert times.
>     I have tried different ranges, different numbers of surfaces,
>     GenerateValues(), SetValue() even different colors (in case it
>     collides with the color).
>
>     And yes maybe my data has some problem - but I have absolutley NO
>     idea what kind of.
>     The scalar data is properly displayed on a cutting plane, but I
>     can't create iso surfaces.
>
>     Am 12.03.2010 11:59, schrieb Rakesh Patil:
>>
>>     Try once again... Check code properly.. It should work.. else
>>     your data may be having some problem..
>>
>>     Thanks
>>
>>     Regards
>>     Rakesh Patil
>>
>>
>>         ---------- Original message ----------
>>         From:Sebastian Gatzka< sebastian.gatzka at stud.tu-darmstadt.de >
>>         Date: 12 Mar 10 15:57:21
>>         Subject: Re: [vtkusers] Fwd: Re:AW: vtkContourFilter
>>         notworkingonvtkStructuredGrid
>>         To: vtkusers
>>
>>         Yes. Of Course I tried that.
>>         Nothing changes.
>>
>>         Am 12.03.2010 11:19, schrieb Rakesh Patil:
>>>         Hi,
>>>
>>>         Have you tried implementing what i told you.???
>>>
>>>         scalarIsoSurface->GenerateValues( 10, sGrid->GetScalarRange() );
>>>
>>>         this will solve your problem... As i told u before, there is
>>>         no other prob i could figure out other than this..
>>>         GenerateValues takes three parameters, i.e.
>>>
>>>         1. Number of contour lines,
>>>         2. min. value(of range)
>>>         3. max value(of range)
>>>
>>>         It also takes two parameters.. in this case 2nd parameter is
>>>         double array consisting two elements..
>>>
>>>         Thanks
>>>
>>>         Regards
>>>         Rakesh Patil
>>>
>>>
>>>             ---------- Original message ----------
>>>             From:Sebastian Gatzka<
>>>             sebastian.gatzka at stud.tu-darmstadt.de >
>>>             Date: 12 Mar 10 15:40:22
>>>             Subject: Re: [vtkusers] Fwd: Re:AW: vtkContourFilter not
>>>             workingonvtkStructuredGrid
>>>             To: vtkusers
>>>
>>>             Hi again.
>>>
>>>             Attached you will find the code that should produce the
>>>             iso surface, but displays nothing.
>>>             I even tried to apply the vtkAssignAttribute
>>>             frinxor at gmail.com suggested ...
>>>             Nothing changes.
>>>
>>>             Hope you will find the mistake.
>>>             Have a nice day.
>>>             Sebastian
>>>
>>>             Am 10.03.2010 15:50, schrieb Rakesh Patil:
>>>>
>>>>             Well, i dont think anything is wrong
>>>>
>>>>             According to this,
>>>>
>>>>             http://www.vtk.org/doc/nightly/html/classvtkContourFilter.html
>>>>
>>>>             vtkContourFilter is a filter that takes as input any
>>>>             dataset and generates on output isosurfaces and/or
>>>>             isolines. So that is not a problem..
>>>>
>>>>             Can u just get you final code what u have coded..??
>>>>
>>>>             Thanks
>>>>
>>>>             Regards
>>>>             Rakesh Patil
>>>>
>>>>
>>>>                 ---------- Original message ----------
>>>>                 From:Sebastian Gatzka<
>>>>                 sebastian.gatzka at stud.tu-darmstadt.de >
>>>>                 Date: 10 Mar 10 17:43:19
>>>>                 Subject: [vtkusers] Fwd: Re:AW: vtkContourFilter
>>>>                 not working onvtkStructuredGrid
>>>>                 To: vtkusers at vtk.org
>>>>
>>>>                 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/20100312/c2a1b380/attachment.htm>


More information about the vtkusers mailing list