[vtkusers] How do I interpolate scalars along the geometric surface?
Takayoshi Kurachi
kurakurara at gmail.com
Mon Feb 16 10:11:23 EST 2009
Hell Marcel,
Thank you for your reply. That's exactly what I want to do.
The question is how do I calculate the weighted averaging using
the geodesic distances for the interpolation?
Is there any class for this purpose? I've been trying to use
vtkInterpolateDataSetAttributes and vtkTupleInterpolator, but
neither do not work well so far... :(
Or do I need to write the filter by myself??
Thank you.
Taka
Marcel Weiss wrote:
> using the geodesic distances (along the brain surface mesh) to points with given scalar (source points) vectors should enable to do some kind of weighted averaging for mesh points without scalars using the n closest source points ...
>
> Marcel Weiss
> PhD student
> Department of Neurophysics
> Max Planck Institute for Human Cognitive and Brain Sciences
>
> ----- Original Message -----
> From: "Takayoshi Kurachi" <kurakurara at gmail.com>
> To: vtkusers at vtk.org
> Sent: Monday, February 16, 2009 2:54:19 PM GMT +01:00 Amsterdam / Berlin / Bern / Rome / Stockholm / Vienna
> Subject: [vtkusers] How do I interpolate scalars along the geometric surface?
>
> Hello All,
>
> I'm trying to interpolate scalar values along the geometric
> surface and having a very difficult time.
>
> I have a geometric data of a brain in 3DS file and want to set
> scalar value (of electroencephalogram) in its 21 locations of
> the surface points, and interpolate for the rest of the points
> along the surface to show the scalar values in color.
>
> With the code below, I could get the vtkPointData and set
> scalar values on some of the points as the dataset attribute,
> but it seems that the value is shown in color only within the
> cell that contains the point with the attribute value I set.
> I want to interpolate the scalar along the entire surface by
> the 21 given values.
>
> How can I interpolate scalar values along the surface?
>
> Many thanks in advance.
>
> Taka
>
>
> // Read geometric data from 3DS file
> vtk3DSImporter* importer = vtk3DSImporter::New();
> importer->ComputeNormalsOff();
> importer->SetFileName("data/brain.3ds");
> importer->Read();
>
> // create lookup table (white <-> red)
> vtkLookupTable *lut = vtkLookupTable::New();
> lut->SetTableRange (0, 1);
> lut->SetHueRange (1, 1);
> lut->SetSaturationRange (0, 1);
> lut->SetValueRange (1, 1);
> lut->Build();
>
> // create render window and interactor
> vtkRenderWindow* renWin = vtkRenderWindow::New();
> vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();
>
> // get data from the importer as vtkDataSet
> vtkActorCollection* actors = importer->GetRenderer()->GetActors();
> actors->InitTraversal();
> vtkActor* actor = actors->GetLastActor();
> vtkMapper* mapper = actor->GetMapper();
> vtkDataSet* data = mapper->GetInput();
> vtkPointData* ptData = data->GetPointData();
>
> data->Update();
>
> // get point ids of 4 points for testing (actually i will set 21 points)
> double bounds[6];
> data->GetBounds(bounds);
> vtkIdType id1 = data->FindPoint(0, 0, bounds[5]);
> vtkIdType id2 = data->FindPoint(0, 0, bounds[6]);
> vtkIdType id3 = data->FindPoint(bounds[0], 0, 0);
> vtkIdType id4 = data->FindPoint(bounds[1], 0, 0);
>
> // create array of scalars in vtkFloatArray
> vtkFloatArray *scalars = vtkFloatArray::New();
> scalars->InsertTuple1(id1, 1.0); // set the value 1.0 for testing
> scalars->InsertTuple1(id2, 1.0);
> scalars->InsertTuple1(id3, 1.0);
> scalars->InsertTuple1(id4, 1.0);
> scalars->SetLookupTable(lut);
>
> // set the scalars to the vtkPointData as the dataset attribute
> ptData->Initialize();
> ptData->SetScalars(scalars);
>
> // ... setting up mapper, actor, camera, etc.
>
>
> _______________________________________________
> 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
>
More information about the vtkusers
mailing list