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

<div> </div>

<div>I try to do in an VTK Example to set coordinateAxes. I work with following too VTK Examples:</div>

<div> </div>

<div>First->     http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/DisplayCoordinateAxes<br/>
Second->    http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/VectorField</div>

<div> </div>

<div>In the example "vectorField" I include from the "DisplayCoordinateAxes" following:</div>

<div><br/>
#include <vtkSphereSource.h><br/>
#include <vtkOrientationMarkerWidget.h><br/>
#include <vtkAxesActor.h><br/>
#include <vtkPropAssembly.h></div>

<div><br/>
vtkSmartPointer<vtkAxesActor> axes =<br/>
vtkSmartPointer<vtkAxesActor>::New();</div>

<div>vtkSmartPointer<vtkOrientationMarkerWidget> widget =<br/>
vtkSmartPointer<vtkOrientationMarkerWidget>::New();</div>

<div>widget->SetOutlineColor( 0.9300, 0.5700, 0.1300 );<br/>
widget->SetOrientationMarker( axes );<br/>
widget->SetInteractor( renderWindowInteractor );<br/>
widget->SetViewport( 0.0, 0.0, 0.4, 0.4 );<br/>
widget->SetEnabled( 1 );<br/>
widget->InteractiveOn();</div>

<div> </div>

<div> </div>

<div><br/>
When I build it, it looks as if everything was okay but when I play it, the Window is not open.</div>

<div>What is wrong?</div>

<div><br/>
The completely code is below:</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>    //==========================================================================<br/>
    //================ include from Example DisplayCoordinateAxes ==============<br/>
    //==========================================================================<br/>
#include <vtkSphereSource.h><br/>
#include <vtkOrientationMarkerWidget.h><br/>
#include <vtkAxesActor.h><br/>
#include <vtkPropAssembly.h></div>

<div><br/>
int main(int, char *[])<br/>
{<br/>
    // Create an image<br/>
    vtkSmartPointer<vtkImageData> image =<br/>
    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 x = 0; x < dims[0]; x++)<br/>
    {<br/>
        for(int y = 0; y < dims[1]; y++)<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/>
    {<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/>
    // 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 =<br/>
    vtkSmartPointer<vtkArrowSource>::New();<br/>
    arrowSource->Update();<br/>
    <br/>
    vtkSmartPointer<vtkGlyph2D> glyphFilter =<br/>
    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 =<br/>
    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 =<br/>
    vtkSmartPointer<vtkImageSlice>::New();<br/>
    imageSlice->SetMapper(imageMapper);<br/>
    <br/>
    vtkSmartPointer<vtkPolyDataMapper> vectorMapper =<br/>
    vtkSmartPointer<vtkPolyDataMapper>::New();<br/>
    vectorMapper->SetInputConnection(glyphFilter->GetOutputPort());<br/>
    vtkSmartPointer<vtkActor> vectorActor =<br/>
    vtkSmartPointer<vtkActor>::New();<br/>
    vectorActor->SetMapper(vectorMapper);<br/>
    <br/>
    // Setup renderer<br/>
    vtkSmartPointer<vtkRenderer> renderer =<br/>
    vtkSmartPointer<vtkRenderer>::New();<br/>
    renderer->AddViewProp(imageSlice);<br/>
    renderer->AddViewProp(vectorActor);<br/>
    renderer->ResetCamera();<br/>
    renderer->SetBackground(255, 255, 255); // Background color green<br/>
    <br/>
    <br/>
    // Setup render window<br/>
    vtkSmartPointer<vtkRenderWindow> renderWindow =<br/>
    vtkSmartPointer<vtkRenderWindow>::New();<br/>
    renderWindow->AddRenderer(renderer);<br/>
    <br/>
    // Setup render window interactor<br/>
    //vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();<br/>
    vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =<br/>
    vtkSmartPointer<vtkRenderWindowInteractor>::New();<br/>
    vtkSmartPointer<vtkInteractorStyleImage> style =<br/>
    vtkSmartPointer<vtkInteractorStyleImage>::New();<br/>
    //renderWindowInteractor->SetInteractorStyle(style);<br/>
    <br/>
    <br/>
    //==========================================================================<br/>
    //================ include from Example DisplayCoordinateAxes ==============<br/>
    //==========================================================================<br/>
    vtkSmartPointer<vtkAxesActor> axes =<br/>
    vtkSmartPointer<vtkAxesActor>::New();<br/>
    <br/>
    vtkSmartPointer<vtkOrientationMarkerWidget> widget =<br/>
    vtkSmartPointer<vtkOrientationMarkerWidget>::New();<br/>
    <br/>
    widget->SetOutlineColor( 0.9300, 0.5700, 0.1300 );<br/>
    widget->SetOrientationMarker( axes );<br/>
    widget->SetInteractor( renderWindowInteractor );<br/>
    widget->SetViewport( 0.0, 0.0, 0.4, 0.4 );<br/>
    widget->SetEnabled( 1 );<br/>
    widget->InteractiveOn();<br/>
    //==========================================================================<br/>
    </div>

<div>    <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> </div>

<div><br/>
Thank you very much in advance.</div>
</div>
</div></div></body></html>