[vtkusers] Smoothing

Malcolm Drummond malcolm at geovision.co.za
Thu Feb 26 03:45:44 EST 2004


Hi Ted

Here's a tcl script (based on
/Graphics/Testing/Tcl/CellDataToPointData.tcl). Your problem might have been
due to the source overwriting it's output when it executes (ie wiping out
your scalar data) .

HTH
Malcolm

# ------------------------

package require vtk
package require vtkinteraction

# Create the RenderWindow, Renderer and RenderWindowInteractor
vtkRenderer ren1
vtkRenderWindow renWin
 renWin AddRenderer ren1
vtkRenderWindowInteractor iren
 iren SetRenderWindow renWin

vtkFloatArray faceColors
 faceColors InsertNextValue 0
 faceColors InsertNextValue 1
 faceColors InsertNextValue 1
 faceColors InsertNextValue 2

vtkPlaneSource ps
 ps SetXResolution 2
 ps SetYResolution 2
ps Update
 [[ps GetOutput] GetCellData] SetScalars faceColors

vtkCellDataToPointData Cell2Point
 Cell2Point SetInput [ps GetOutput]
 Cell2Point PassCellDataOn

vtkPolyDataMapper mapper
 mapper SetInput [Cell2Point GetPolyDataOutput]
 mapper SetScalarRange 0 2

vtkActor actor
 actor SetMapper mapper

# Add the actors to the renderer, set the background and size
ren1 AddActor actor
ren1 SetBackground 0.1 0.2 0.4
renWin SetSize 256 256

# render the image
iren AddObserver UserEvent {wm deiconify .vtkInteract}
iren Initialize
wm withdraw .

----- Original Message -----
From: "Ted Vu" <lost_bits1110 at hotmail.com>
To: <malcolm at geovision.co.za>; <vtkusers at vtk.org>
Sent: Thursday, February 26, 2004 5:21 AM
Subject: Re: [vtkusers] Smoothing


> Okay actually, when I use vtkThresholdPoints together with
> vtkCellDataToPonitData then now I see a bunch of spaced out points
> Does it not interpolate the points scalar info in order to not get this
> dotty/particle look?
> Is there a way to do this?
> thank-you again!
>
>
>
> >From: "Ted Vu" <lost_bits1110 at hotmail.com>
> >To: malcolm at geovision.co.za, vtkusers at vtk.org
> >Subject: Re: [vtkusers] Smoothing
> >Date: Thu, 26 Feb 2004 02:53:45 +0000
> >
> >Hi Malcolm
> >Thanks kindly for your help
> >Have you by any chance used this class before?
> >
> >What I did was I set the input of vtkCellDataToPointData class to the
> >PolyData which contained the cells that I was color mapping originally.
> >Then I get the new output using the vtkCellDataToPolyData class object
as
> >follows:
> >
> >CellToPointData->SetInput(SetOfQuadCells);
> >NewPolyDataCellsUsingPointData = CellToPointData->GetPolyDataOutput();
> >
> >But this seems to not associate any scalar data at all because i just get
a
> >white parallellogram. I also  removed the line where it says
> >Mapper->SetScalarModeToUseCellData (but with or without this, it still
> >gives the same output)
> >
> >I also tried with and without 'PassCellDataOn();'
> >
> >is there anything else i'm overlooking?
> >thanks so much
> >
> >
> >>From: "Malcolm Drummond" <malcolm at geovision.co.za>
> >>To: "Ted Vu" <lost_bits1110 at hotmail.com>
> >>Subject: Re: [vtkusers] Smoothing
> >>Date: Wed, 25 Feb 2004 18:57:23 +0200
> >>
> >>Hi Ted
> >>
> >>I assume you're using cell-data. You can get a blended effect by using
> >>point-data instead. vtkCellDataToPointData will do the conversion for
you.
> >>
> >>HTH
> >>Malcolm
> >>
> >>----- Original Message -----
> >>From: "Ted Vu" <lost_bits1110 at hotmail.com>
> >>To: <vtkusers at vtk.org>
> >>Sent: Wednesday, February 25, 2004 5:48 PM
> >>Subject: [vtkusers] Smoothing
> >>
> >>
> >> > Good morning
> >> >
> >> > I have a vtkPolyData (one big parallelogram) which consists of many
> >> > parallelograms (I got this from vtkPlaneSource) and I have color
coded
> >>each
> >> > of the cells to some color corresponding to a scalar
> >> >
> >> > But this looks very 'pixelated'
> >> > I cannot increase teh number of cells/resolution (i.e the number of
> >>smaller
> >> > parallelograms in my big parallelogram) becaus this significantly
> >>reduces
> >> > speed etc..
> >> >
> >> > So I tried using vtkSmoothPolyDataFilter by doing teh following:
> >> >
> >> >        Smoother = vtkSmoothPolyDataFilter::New();
> >> > Smoother->SetNumberOfIterations(100);
> >> > Smoother->FeatureEdgeSmoothingOn();
> >> > Smoother->SetInput(myPolyData->GetOutput());
> >> >
> >> > but this makes absolutely no difference
> >> >
> >> > I also treid teh same with Smoother =
> >>vtkWindowedSincPolyDataFilter::New();
> >> >
> >> > So how can I sort of 'blur' all these parallelograms so it doesnt
look
> >>so
> >> > pixelated?
> >> >
> >> > _________________________________________________________________
> >> > Get fast, reliable access with MSN 9 Dial-up. Click here for Special
> >>Offer!
> >> > http://click.atdmt.com/AVE/go/onm00200361ave/direct/01/
> >> >
> >> > _______________________________________________
> >> > This is the private VTK discussion list.
> >> > Please keep messages on-topic. Check the FAQ at:
> >><http://public.kitware.com/cgi-bin/vtkfaq>
> >> > Follow this link to subscribe/unsubscribe:
> >> > http://www.vtk.org/mailman/listinfo/vtkusers
> >> >
> >>
> >
> >_________________________________________________________________
> >Watch high-quality video with fast playback at MSN Video. Free!
> >http://click.atdmt.com/AVE/go/onm00200365ave/direct/01/
> >
> >_______________________________________________
> >This is the private VTK discussion list. Please keep messages on-topic.
> >Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> >Follow this link to subscribe/unsubscribe:
> >http://www.vtk.org/mailman/listinfo/vtkusers
>
> _________________________________________________________________
> Say "good-bye" to spam, viruses and pop-ups with MSN Premium -- free trial
> offer! http://click.atdmt.com/AVE/go/onm00200359ave/direct/01/
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
<http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list