1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| sliderMin = 1;
sliderMax = 280; % this is variable
sliderStep = [1, 1/(sliderMax - sliderMin)]; % major and minor steps of 1
set(handles.slider1, 'Min', 0);
set(handles.slider1, 'Max', 280);
set(handles.slider1, 'SliderStep', sliderStep);
set(handles.slider1, 'Value', 1); % set to beginning of sequence
%% Beginning of slider callback function
% --- Executes on slider movement.
function slider1_Callback(hObject, eventdata, handles)
% hObject handle to slider1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
currentSlice = get(hObject, 'Value');
if(currentSlice <= 9 )
path2=strcat(handles.gvar.path,'Image 00',num2str(currentSlice))
elseif (currentSlice >9 ) && (currentSlice <= 99 )
path2=strcat(handles.gvar.path,'Image 0',num2str(currentSlice))
elseif (currentSlice >9 ) && (currentSlice > 99 )
path2=strcat(handles.gvar.path,'Image ',num2str(currentSlice));
end
I= dicomread(path2);
info=dicominfo(path2);
a=info.PatientName.FamilyName;
b=info.PatientID;
c=info.PatientBirthDate;
d=info.StudyID;
e=info.StudyDate;
f=info.SliceLocation;
g=info.InstanceNumber;
set(handles.edit1,'string',num2str(a));
set(handles.edit2,'string',num2str(b));
set(handles.edit3,'string',num2str(c));
set(handles.edit4,'string',num2str(d));
set(handles.edit5,'string',num2str(e));
set(handles.edit6,'string',num2str(f));
set(handles.edit7,'string',num2str(g));
handles.axes1 = I;
imshow(I,'DisplayRange',[]);
% imagesc(imageArray(:,:,currentSlice), [1000 1150]);
% colormap(gray); axis image; impixelinfo;
% disp(['Slider moved to ' num2str(currentSlice)]); |
Partager