[vtkusers] What's wrong with interpolation?

mathieu coursolle mcoursolle at gmail.com
Wed Aug 24 11:35:19 EDT 2005


Hi everbody,

I am using vtkImageData and vtkImageActor in a
vtkRenderWindow to display an image.
It works fine except that when I enable interpolation,
I get strange results. 

Is there a way to get rid of the artifacts in the image.
They seem to be produced by the edges.

Here is my code and I attached an example.

vtkImageData* image_data = vtkImageData::New;
image_data->SetScalarTypeToFloat();
image_data->SetNumberOfScalarComponents(1);
image_data->SetSpacing(spacing_x, spacing_y, 1);
image_data->SetOrigin(offset_x, offset_y, 0);
image_data->SetDimensions(size_x, size_y, 1);
image_data->AllocateScalars();

//Fill the image with the data.
BYTE* destination_data =
reinterpret_cast<BYTE*>(image_data->GetScalarPointer());
memcpy(destination_data, source_data.mPointer, size_x * size_y * sizeof(float));

 //Create the image map to colors.
vtkImageMapToRGBA* image_map = vtkImageMapToRGBA::New();
image_map->SetInput(image_data);
image_map->SetLookupTable(m_LookUpTable);
image_map->Update();

vtkImageActor* actor = vtkImageActor::New();
actor->SetInput(image_map->GetOutput());

actor->SetInterpolate(TRUE);

//Add the actor to the scene.
renderer->AddProp(actor.GetPointer());

Thanx a lot!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: InterpolationOn.JPG
Type: image/jpeg
Size: 27286 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050824/daac27f0/attachment.jpeg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: InterpolationOff.JPG
Type: image/jpeg
Size: 30231 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050824/daac27f0/attachment-0001.jpeg>


More information about the vtkusers mailing list