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 Center および File ExchangeImage Processing Toolbox についてさらに検索

タグ

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by