Viewing same slice of 2 different image stacks with sliceViewer

4 visualizaciones (últimos 30 días)
Lanfranco Chirico
Lanfranco Chirico el 12 de Dic. de 2022
Respondida: Harsh Sanghai el 23 de Mzo. de 2023
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!

Respuestas (1)

Harsh Sanghai
Harsh Sanghai el 23 de Mzo. de 2023
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:

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by