主要内容

SliceViewer

Browse image slices

描述

ASliceViewerobject displays individual slices of grayscale and RGB volumes. You can control which slice to display by using a slider.

When it opens, theSliceViewer对象以指定的方向显示中间图像切片。Use the slider to navigate through the volume and view individual slices.

SliceViewerobject supports properties, object functions, and events that you can use to customize its appearance and functioning. TheSliceViewer当某些事件发生时,对象可以发送通知,例如滑块移动。有关更多信息,请参阅Events

Note

默认情况下,单击并拖动鼠标在切片中显示的互动性改变其亮度和对比度,该技术称为窗口/级别。从左到右将鼠标水平拖动会改变对比度。垂直上下拖动鼠标会改变亮度。压低Ctrlkey when clicking and dragging the mouse accelerates changes. Holding down theShift在单击和拖动鼠标的同时,键会减慢变化速度。在单击和拖动之前按这些键。要控制这种行为,请使用DisplayRangeInteractionproperty.

创建

描述

example

SliceViewer(V)显示灰度或RGB卷V在数字中。该图包括一个滑块,您可以使用该滑块来查看卷的各个切片。

SliceViewer(___,Name,Value)setsproperties使用名称值对参数。您可以指定多个名称值对。将每个属性名称包装在单引号中。

例子:SliceViewer(V,'Colormap',cmap)创建一个SliceViewer对象并指定用于显示卷的colormap。

sv = sliceviewer(___)返回一个SliceViewerobject,SV, with properties that can be used to control visualization of the volume. Use input arguments from any of the previous syntaxes.

Input Arguments

展开全部

输入卷,指定为m-经过-n-经过-p-经过-c数字阵列。For grayscale volumes,cis 1. For RGB volumes,cis 3. RGB volumes can only be of classUINT8,UINT16,单身的, and双倍的

数据类型:单身的|双倍的|int8|INT16|INT32|UINT8|UINT16|UINT32

特性

展开全部

Colormap of the image stack, specified as anm-经过-3 numeric array with values in the range[0 1]。这Colormap当财产无效时V是RGB图像堆栈。

图像堆栈的显示范围,指定为表单的两元素向量[low high]。价值低的(and any value less than低的) displays as black. The valuehigh(and any value greater thanhigh) displays as white. Values in between are displayed as intermediate shades of gray, using the default number of gray levels. If you specify an empty matrix([]),SliceVieweruses the default value.DisplayRange当您指定一堆RGB图像时,没有效果。

启用对显示范围的交互式控制,指定为这些值之一。要了解有关互动行为的更多信息,请参阅Events

Value 描述
'on'(default for grayscale intensity volumes) 通过左键单击鼠标并将其拖动在轴上来控制灰度图像堆栈的显示范围。
'离开'(逻辑和RGB卷的默认值) 没有显示范围的交互性。

父母SliceViewerobject, specified as a handle to auipanel或用数字oruifigurecommands. If you do not specify a parent, the parent of theSliceViewer对象是GCF

Scale factors used to rescale the volume, specified as a 1-by-3 positive numeric vector. The values in the array correspond to the scale factor applied in thex,y, andz方向。

浏览图像堆栈的方向,指定为1 x-3逻辑向量或该表中的角色向量之一。

Character Vector Logical Vector 描述
'X' [1 0 0] 浏览Xdirection
'Y' [0 1 0] 浏览Ydirection
'Z'(默认) [0 0 1] 浏览Zdirection

从音量显示的切片的索引,指定为正数字标量。

Object Functions

addlistener 创建绑定到事件源的事件侦听器
getAxesHandle 在切片查看器中获取轴

例子

collapse all

Load MRI data into the workspace.

loadMristack

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);

Load MRI data into the workspace.

loadMristack

查看切片查看器中的数据。

s = sliceViewer(mristack);

获取包含显示的切片的轴的手柄。

hAx = getAxesHandle(s);

指定要创建的GIF文件的名称。

费尔ename ='animatedSlice.gif';

创建一个切片数字。

Slicenums = 1:21;

Loop through the slice numbers and create an image of each displayed slice. Write the images to a GIF file.

forIDX = Slicenums% Update slice numbers.SliceNumber = idx;%使用GetFrame捕获图像I = getframe(hAx); [indI,cm] = rgb2ind(I.cdata,256);%写框架到GIF文件ifidx == 1 imwrite(indi,cm,filename,'gif','Loopcount',inf,'DelayTime',0.05);elseimwrite(indi,cm,filename,'gif',“ writemode','append','DelayTime',0.05);endend

Load a stack of images into the workspace.

loadMristack

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);

为两者设置听众SliceViewerobject 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 thisalleventscallback function to display the name of each event and the current position of the slider.

function根除(SRC,EVT)evname = evt.eventname;switch(evname)案子{“ slidervaluechanging'} disp([“滑块价值更改事件:”mat2str(evt.CurrentValue)]);案子{'SliderValueChanged'} disp([“滑块价值更改事件”:'mat2str(evt.CurrentValue)]);endend

More About

展开全部

Introduced in R2019b