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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
| %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%DEBUT DE LA FONCTION PRINCIPALE%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function gui_guidata_guihandles
% Création de l'objet Figure
figure('units','pixels',...
'position',[300 300 800 600],...
'color',[0.753 0.753 0.753],...
'numbertitle','off',...
'name','Logiciel de decoupe d image médicale',...
'menubar','figure',...
'tag','interface');
% Création de l'objet Uicontrol Pushbutton Load
uicontrol('style','pushbutton',...
'units','normalized',...
'backgroundcolor',[1 1 1],...
'position',[0.05 0.8 0.15 0.05],...
'string','Load image',...
'fontsize',14.0,...
'callback',@load_image,...
'tag','Load_image_tag');
% Création de l'objet Uicontrol Pushbutton Decoupe
uicontrol('style','pushbutton',...
'units','normalized',...
'backgroundcolor',[1 1 1],...
'position',[0.3 0.8 0.15 0.05],...
'string','Decoupage',...
'fontsize',14.0,...
'callback',@decoupage,...
'tag','Decoupage_tag');
% insertion du fond initial
image_backgnd=imread ('fond1.jpg','jpg');
axes('Position',[0 0 1 1]);
image(image_backgnd);
axis image;
axis off;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%FIN DE LA FONCTION PRINCIPALE%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Génération de la structure contenant les identifiants des objects graphiques dont la
% propriété Tag a été utilisée.
data=guihandles(gcf);
% D'après les Tag utilisés pour les objets graphiques crées précédemment, la structure data
% contient les champs suivant :
% data.interface
% data.Load_image_tag
% Enregistrement de data dans les données d'application de l'objet Figure
guidata(gcf,data)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% DEBUT DE LA SOUS-FONCTION CHARGER %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function load_image(obj,event)
[filename, pathname, filterindex] = uigetfile('*.jpg', 'Pick an JPG-file');
image_loaded = strcat(pathname, filename);
im_loaded=imread (image_loaded);
axes('Position',[0.08 0.08 0.67 0.67]);
image(im_loaded);
axis image;
axis off;
function decoupage(obj,event)
[xc,yc] = ginput(2);
imgray = im_loaded(yc(1):yc(2),xc(1):xc(2),:);
axes('Position',[0.08 0.08 0.67 0.67]);
image(imgray);
axis image;
axis off;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%FIN DE LA SOUS-FONCTION CHARGER%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
Partager