[vtkusers] VtkImageViewer2 disabling window level

John Drescher drescherjm at gmail.com
Tue Oct 19 12:50:14 EDT 2010


On Tue, Oct 19, 2010 at 12:00 PM, Leonardo M. Ramé <l.rame at griensu.com> wrote:
> On 2010-10-19 12:19:03 -0300, Leonardo M. Ramé wrote:
>> Hi, I'm creating an image viewer based on VTKImageViewer2, and I want to
>> create a Toolbox where the user picks an option, like "circle" or "box",
>> then drag that to the image to show it.
>>
>> My problem is, whenever the user drags anything to the viewer, it does
>> Window/Level. How can I disable WindowLevel?
>>
>
> Thanks for your answers, I created this vtkInteractorStyle subclassing
> from vtkInteractorStyleImage.
>
> Before going further, I only want to show a message when the user press
> the left mouse button, but continue with the default interaction style
> (i.e.: window leveling).
>
> class DCMInteractorStyle : public vtkInteractorStyleImage
> {
>  public:
>    static DCMInteractorStyle* New();
>    vtkTypeMacro(DCMInteractorStyle, vtkInteractorStyleImage);
>
>    virtual void OnLeftButtonDown()
>    {
>      std::cout << "Pressed left mouse button." << std::endl;
>      // Forward events
>      vtkInteractorStyleImage::OnLeftButtonDown();
>    }
> };
>
> vtkStandardNewMacro(DCMInteractorStyle);
>
> Aparently, the line vtkInteractorStyleImage::OnLeftButtonDown(); is not
> called. What am I doing wrong?.

Are you using vtkSmartPointer with your DCMInteractorStyle? Possibly
the vtkInteractorStyle object is going out of scope?

John



More information about the vtkusers mailing list