handles.SliderFrame = uicontrol('Style','slider','Position',[60 20 400 50],'Min',1,'Max',NumFrames,'Value',1,'SliderStep',[1/NumFrames 2/NumFrames],'Callback',@XSliderCallback);
handles.SliderFrame2 = uicontrol('Style','slider','Position',[60 20 400 50],'Min',1,'Max',sno_s,'Value',slice2,'SliderStep',[1/(sno_s-1) 10/(sno_s-1)],'Callback',@XSliderCallback);
handles.Text1 = uicontrol('Style','Text','Position',[180 420 60 30],'String','Current frame');
handles.Edit1 = uicontrol('Style','Edit','Position',[250 420 100 30],'String','1');
function XSliderCallback(~,~)
handles = guidata(gcf);
MyMatrix = getappdata(hFig, 'MyMatrix');
idx = round((get(handles.SliderFrame, 'Value')));
idx2 = round((get(handles.SliderFrame2, 'Value')));
set(handles.Edit1,'String',num2str(idx));
set(handles.Edit1,'String',num2str(idx2));
filelist = handles.filelist;
frameindex = max(1, min(idx, NumFrames));
handles.frameindex = frameindex+1;
ff = filelist{frameindex};
I=dicomread(ff);
subplot(2,2,1)
image(handles.axes1, I(idx));
imshow(squeeze(I(:,:,idx,:)));
[~, basename, ~] = fileparts(ff);
title( basename);
subplot(2,2,2)
image(handles.axes2, im3(idx2));
imshow(squeeze(im3(:,:,idx2,:)),'XData',[1 592], 'YData',[1 481])
subplot(2,2,3)
image(handles.axes3, im4(idx));
guidata(hFig,handles);
drawnow()
end