How to create my custom Image Style class?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to create my custom Image Style class?

arwtyxouymz
Hi,

I try to create my style class inherited from `vtkInteractorStyleImage.h`
Actually i created, but it doesn't work.

This is compile error
```
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
make[2]: *** [src/Main] Error 1
make[1]: *** [src/CMakeFiles/Main.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
```

This is my code:

mySytleImage class
```cpp
class StyleImage : public vtkInteractorStyleImage {
public:
    static StyleImage* New();
    vtkTypeMacro(StyleImage, vtkInteractorStyleImage);

    StyleImage();
    virtual ~StyleImage();

    void SetImageViewer(vtkResliceImageViewer* viewer);

private:
    vtkSmartPointer<vtkResliceImageViewer> m_viewer;
};

/**
 * @brief Constructor
 */
StyleImage::StyleImage() = default;

/**
 * @brief Destructor
 */
StyleImage::~StyleImage() = default;

/*
 * @brief Set Image Viewer
 */
void StyleImage::SetImageViewer(vtkResliceImageViewer* viewer)
{
    m_viewer = viewer;
}
```

And I use like this
```cpp
    vtkSmartPointer<vtkResliceImageViewer> imageViewer =
        vtkSmartPointer<vtkResliceImageViewer>::New();
    imageViewer->SetInputData( m_image );
    vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
        vtkSmartPointer<vtkRenderWindowInteractor>::New();
    imageViewer->SetupInteractor(renderWindowInteractor);
    imageViewer->Render();
    imageViewer->GetRenderer()->ResetCamera();
    imageViewer->Render();

    vtkSmartPointer<StyleImage> style =
        vtkSmartPointer<StyleImage>::New();
    style->SetImageViewer(imageViewer);
    renderWindowInteractor->SetInteractorStyle(style);
    renderWindowInteractor->Start();
```


What's wrong?

I think i need `vtkStandardNewMacro`, but i don't understand why this macro
is needed and how to use it.
please help me





--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
_______________________________________________
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

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers