Opening 4D image stack using sliceviewer
17 views (last 30 days)
Show older comments
Hello all,
I'm working on a 4D MRI brain data set. Data set contains 20 slices (3rd dimension) of brain images acquired at 32 time points (4th dimension) (Image dimension will be I(256,256,20,32)). I want to open this data set as 2 stacks with sliders. One stack should contain first timepoint of all slices (I(:,:,:,1)) and other stack should contain all timepoints of slice opened in the previously mentioned stack. Also, the second stack should be updated in the same figure when I change the slice in the first stack. I have written the code mentioned below using listener to execute this.
global I %%% I is the 4D image
Dyn = squeeze(I (:,:,:,1));
f1 = figure('Name','Slice-wise images (Phases)');
s = sliceViewer(Dyn,'Colormap',jet,'parent',f1);
addlistener(s,'SliderValueChanging',@allevents);
function allevents(~,evt)
evname = evt.EventName;
global I
switch(evname)
case{'SliderValueChanging'}
x1 = mat2str(evt.CurrentValue);
x2= str2double(x1);
T4_1 = squeeze(I(:,:,x2,:));
f5 = figure('Name','Temporal images (Phases)');
s4_1 = sliceViewer(T4_1,'Colormap',gray,'parent',f5);
end
end
The second stack is updating with changing the slices, but everytime when I change the slice, a new figure window is opening. I would like to update it in the same figure itself. In short, whenever I change the slice number in the first stack, the second stack should also get updated in f5.
Could somebody help me to solve this?
Thanks in advance
0 Comments
Answers (0)
See Also
Categories
Find more on Medical Physics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!