Viewing same slice of 2 different image stacks with sliceViewer

조회 수: 4 (최근 30일)
Lanfranco Chirico
Lanfranco Chirico 2022년 12월 12일
답변: Harsh Sanghai 2023년 3월 23일
I have a CT reconstruction and the relative segmentation, both image stacks made by 140 slices. I'm using sliceViewer to display them in two different figures:
fig1 = figure("Name","CT image", "NumberTitle", "off");
s1 = sliceViewer(imm);
fig2 = figure("Name","Segmentated image", "NumberTitle", "off");
s2 = sliceViewer(seg);
I would like to see the same slice of both images by sliding only one of them. I'm trying to use the line
s2.SliceNumber = s1.SliceNumber
but it works only once, while i need to repeat this line every time I use the slider of s1.
Any idea? Thank you for the help!

답변 (1개)

Harsh Sanghai
Harsh Sanghai 2023년 3월 23일
Hi,
To achieve this, you can add a listener to the "SliceNumber" property of s1 that updates the "SliceNumber" property of s2 whenever it changes.
% Add listener to s1
addlistener(s1, 'SliceNumber', 'PostSet', @(src,evt) updateSliceNumber(s1, s2));
function updateSliceNumber(s1, s2)
% Update the SliceNumber property of s2 to match s1
s2.SliceNumber = s1.SliceNumber;
end
For more information checkout the below link:

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

태그

제품


릴리스

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by