<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>
<div>Hello everyone,</div>

<div>I'm new in VTK and I interested for interpolation between points in a Grid.</div>

<div><br/>
I have an imageData and I try to do an interpolation between the x-y values. Is there in VTK a function to do this and what are the steps exactly?</div>

<div>%and what are the steps from this imageData to be able to make an interpolation between the x-y values.</div>

<div> </div>

<div>I use the following examplecode in C++:<br/>
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/VectorField</div>

<div> </div>

<div> </div>

<div>Below is my Code:</div>

<div><br/>
#include <vtkVersion.h><br/>
#include <vtkArrowSource.h><br/>
#include <vtkCellArray.h><br/>
#include <vtkGlyph2D.h><br/>
#include <vtkPointData.h><br/>
#include <vtkImageData.h><br/>
#include <vtkImageSliceMapper.h><br/>
#include <vtkImageSlice.h><br/>
#include <vtkInteractorStyleImage.h><br/>
#include <vtkPolyDataMapper.h><br/>
#include <vtkPolyData.h><br/>
#include <vtkPoints.h><br/>
#include <vtkRenderer.h><br/>
#include <vtkRenderWindow.h><br/>
#include <vtkRenderWindowInteractor.h><br/>
#include <vtkSmartPointer.h><br/>
#include <vtkXMLPolyDataWriter.h></div>

<div>int main(int, char *[])<br/>
{<br/>
    // Create an image<br/>
    vtkSmartPointer<vtkImageData> image = vtkSmartPointer<vtkImageData>::New();<br/>
    <br/>
    // Specify the size of the image data<br/>
    image->SetDimensions(50,50,1);<br/>
    <br/>
    #if VTK_MAJOR_VERSION <= 5<br/>
    image->SetNumberOfScalarComponents(2);<br/>
    image->SetScalarTypeToFloat();<br/>
    image->AllocateScalars();<br/>
    #else<br/>
    image->AllocateScalars(VTK_FLOAT,2);<br/>
    #endif<br/>
    int* dims = image->GetDimensions();<br/>
    <br/>
    // Zero the image<br/>
    for (int y = 0; y < dims[1]; y++)<br/>
    {<br/>
        for (int x = 0; x < dims[0]; x++)<br/>
        {<br/>
            float* pixel = static_cast<float*>(image->GetScalarPointer(x,y,0));<br/>
            pixel[0] = 0.0;<br/>
            pixel[1] = 0.0;<br/>
        }<br/>
    }<br/>
    <br/>
    <br/>
    //Skizze Field<br/>
    /*<br/>
    *     (20;30)     _______    (30;30)<br/>
    *             |        |<br/>
    *             |        |<br/>
    *             |        |<br/>
    *     (20;20)    |_______|    (30;20)<br/>
    *<br/>
    * */<br/>
    <br/>
    <br/>
    <br/>
    {<br/>
        float* pixel = static_cast<float*>(image->GetScalarPointer(20,20,0));<br/>
        pixel[0] = -10.0;<br/>
        pixel[1] = 5.0;<br/>
    }<br/>
    <br/>
    {<br/>
        float* pixel = static_cast<float*>(image->GetScalarPointer(30,30,0));<br/>
        pixel[0] = 10.0;<br/>
        pixel[1] = 10.0;<br/>
    }<br/>
    <br/>
    <br/>
    {<br/>
        float* pixel = static_cast<float*>(image->GetScalarPointer(20,30,0));<br/>
        pixel[0] = -10.0;<br/>
        pixel[1] = 5.0;<br/>
    }<br/>
    <br/>
    {<br/>
        float* pixel = static_cast<float*>(image->GetScalarPointer(30,20,0));<br/>
        pixel[0] = 10.0;<br/>
        pixel[1] = 10.0;<br/>
    }<br/>
    <br/>
    <br/>
    <br/>
    // A better way to do this is (should be tested for compilablilty and correctness):<br/>
    // image->GetPointData()->SetActiveVectors(image->GetPointData()->GetScalars()->GetName().c_str());<br/>
    image->GetPointData()->SetActiveVectors("ImageScalars");<br/>
    <br/>
    // Setup the arrows<br/>
    vtkSmartPointer<vtkArrowSource> arrowSource = vtkSmartPointer<vtkArrowSource>::New();<br/>
    arrowSource->Update();<br/>
    <br/>
    vtkSmartPointer<vtkGlyph2D> glyphFilter = vtkSmartPointer<vtkGlyph2D>::New();<br/>
    glyphFilter->SetSourceConnection(arrowSource->GetOutputPort());<br/>
    glyphFilter->OrientOn();<br/>
    glyphFilter->SetVectorModeToUseVector();<br/>
    #if VTK_MAJOR_VERSION <= 5<br/>
    glyphFilter->SetInputConnection(image->GetProducerPort());<br/>
    #else<br/>
    glyphFilter->SetInputData(image);<br/>
    #endif<br/>
    glyphFilter->Update();<br/>
    <br/>
    // Create actors<br/>
    vtkSmartPointer<vtkImageSliceMapper> imageMapper = vtkSmartPointer<vtkImageSliceMapper>::New();<br/>
    #if VTK_MAJOR_VERSION <= 5<br/>
    imageMapper->SetInputConnection(image->GetProducerPort());<br/>
    #else<br/>
    imageMapper->SetInputData(image);<br/>
    #endif<br/>
    <br/>
    vtkSmartPointer<vtkImageSlice> imageSlice = vtkSmartPointer<vtkImageSlice>::New();<br/>
    imageSlice->SetMapper(imageMapper);<br/>
    <br/>
    vtkSmartPointer<vtkPolyDataMapper> vectorMapper = vtkSmartPointer<vtkPolyDataMapper>::New();<br/>
    vectorMapper->SetInputConnection(glyphFilter->GetOutputPort());<br/>
    vtkSmartPointer<vtkActor> vectorActor = vtkSmartPointer<vtkActor>::New();<br/>
    vectorActor->SetMapper(vectorMapper);<br/>
    <br/>
    // Setup renderer<br/>
    vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();<br/>
    renderer->AddViewProp(imageSlice);<br/>
    renderer->AddViewProp(vectorActor);<br/>
    renderer->ResetCamera();<br/>
    <br/>
    // Setup render window<br/>
    vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();<br/>
    renderWindow->AddRenderer(renderer);<br/>
    <br/>
    // Setup render window interactor<br/>
    vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New();<br/>
    vtkSmartPointer<vtkInteractorStyleImage> style = vtkSmartPointer<vtkInteractorStyleImage>::New();<br/>
    //renderWindowInteractor->SetInteractorStyle(style);<br/>
    <br/>
    // Render and start interaction<br/>
    renderWindowInteractor->SetRenderWindow(renderWindow);<br/>
    renderWindowInteractor->Initialize();<br/>
    <br/>
    renderWindowInteractor->Start();<br/>
    <br/>
    return EXIT_SUCCESS;<br/>
}</div>

<div> </div>

<div>Thank you in advance.</div>

<div>I use the VTK 6.3.0-55.5.</div>

<div> </div>
</div></div></body></html>