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
|
function exemple_main
%EXEMPLE_MAIN Exemple d'une interface graphique codée à la main
% Création de l'objet Figure
fig = figure('units', 'pixels', ...
'position', [520 380 300 200], ...
'name', 'example_main');
% Create an axes object to show which color is selected
Img = axes('Parent',fig,'units','pixels',...
'Position',[50 50 512 512]);
% Création de l'objet Uicontrol Pushbutton
slider1 = uicontrol('Style', 'slider', 'Parent', fig, 'String', 'Image No.', 'Callback', @cb, ...
'Units', 'pixels', 'Position', [231 5 100 20]);
DirOutput = dir('C:\Users\Momo\Documents\CBCT_Stage\Try\CBCT\CBCT\Foljac\Sarcopenie - 1R\CBCT_30');
% reading the DICOM images into the 3D array 'dicom_images'
for i = 3:217
info = dicominfo(DirOutput(i).name);
dicom_images(:,:,i) = dicomread(info);
end
dicom_images = mat2gray(dicom_images); %converting the matrix into grayscale
movegui(Img,'onscreen')% To display application onscreen
movegui(Img,'center') % To display application in the center of screen
% Stockage des identifiants utiles
handles = guihandles(fig);
guidata(fig,handles)
imshow(dicom_images(:,:,1));
set(findobj(gcf,'type','axes'),'hittest','off');
set(handles.slider1, 'Min', 3);
set(handles.slider1, 'Max', 217);
set(handles.slider1, 'SliderStep', 1);
function cb(obj,event)
% Fonction associée au Callback de l'objet Pushbutton
% obj : identifiant de l'objet Pushbutton
% event : événement liés à l'objet Pushbutton
% Récupération des identifiants utiles
fig = get(obj,'parent');
handles = guidata(fig); |
Partager