Main Content

images.stack.browser.SliderMovingEventData Class

Namespace: images.stack.browser

Event data passed when slider in Slice Viewer is moving

Description

The images.stack.browser.SliderMovingEventData class is the class passed to listeners when the slider in a sliceViewer object moves. The sliceViewer object triggers an event using the notify handle class method. MATLAB® assigns values to the properties of an images.stack.browser.SliderMovingEventData class and passes that class to the listener callback function (the event handler). Programmatic positioning of the slider does not trigger this event.

The images.stack.browser.SliderMovingEventData class is a handle class.

Creation

The notify function creates an images.stack.browser.SliderMovingEventData object when called to trigger an event.

Properties

expand all

Event source, specified as a handle to the object that triggered the event.

Name of the event, specified as a character vector.

Image frame indicated by slider position, specified as a numeric scalar.

Examples

collapse all

Load a stack of images into the workspace.

load mristack

View the data in the slice viewer, specifying a custom colormap for viewing the slices. The slice viewer opens the stack of images and displays the one in the middle. Use the slider to view a different slice.

cmap = parula(256);
s = sliceViewer(mristack,"Colormap",cmap,"Parent",figure);

Set up listeners for the two sliceViewer object slider events: when the slider is moving and when the slider has been moved. When you move the slider, the slice viewer sends notifications of these events and executes the specified callback function.

addlistener(s,"SliderValueChanging",@allevents);
addlistener(s,"SliderValueChanged",@allevents);

Use this allevents callback function to display the name of each event and the current position of the slider.

function allevents(src,evt)
    evname = evt.EventName;
    switch(evname)
        case{"SliderValueChanging"}
            disp("Slider value changing event: " + mat2str(evt.CurrentValue));
        case{"SliderValueChanged"}
            disp("Slider value changed event: " + mat2str(evt.CurrentValue));
    end
end

Version History

Introduced in R2019b

See Also