Re bonjour à tous,

J'ai encore besoin de vous
Voilà donc après les conseils de Duf, j'ai réussi à créer un interface mais maintenant je voudrais charger une image à partir d'un dossier d'image et pouvoir naviguer entre les images à l'aide de boutons suivant ou précédent.
Quelqu'un à déjà fait ce genre de programme mais sous Guide et à vrai dire je ne comprends pas grand chose.
J'ai essayer de reprendre le code pour l'intégrer au mien mais j'ai vraiment du mal.
Pourriez vous m'aider, m'indiquer mes erreurs, ce qu'il faut faire, ... car là je bloque depuis ce matin sur le problème

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
 
function test
 
 
% Création de l'objet Figure
handles(1)=figure('units','pixels',...
    'position',[250 250 750 500],...
    'color',[0.5 0.5 0.5],...
    'numbertitle','off',...
    'name','Segmentation du myocarde',...
    'menubar','none',...
    'tag','interface');
 
 
% Création de l'objet Axes 
handles(2)=axes('units','normalized',...
    'position',[0.05 0.2 0.72 0.75],...
    'tag','image');
 
 
% Création de l'objet Uicontrol Pushbutton charger_image
handles(3)=uicontrol('style','pushbutton',...
    'units','normalized',...
    'position',[0.85 0.9 0.075 0.075],...
    'string','Charger',...    
    'callback',@charger,...
    'tag','charger');
 
 
% Création de l'objet Uicontrol Pushbutton quitter
handles(4)=uicontrol('style','pushbutton',...
    'units','normalized',...
    'position',[0.05 0.05 0.075 0.075],...
    'string','Exit',...    
    'callback',@exit,...
    'tag','exit');
 
 
% Création de l'objet Uicontrol Pushbutton suivant
handles(5)=uicontrol('style','pushbutton',...
    'units','normalized',...
    'position',[0.9 0.78 0.075 0.075],...
    'string','Suivant',...    
    'callback',@suivant,...
    'tag','exit');
 
% Création de l'objet Uicontrol Pushbutton précedent
handles(6)=uicontrol('style','pushbutton',...
    'units','normalized',...
    'position',[0.8 0.78 0.075 0.075],...
    'string','Precedent',...    
    'callback',@precedent,...
    'tag','precedent');
 
 
% Création de l'objet Uicontrol Pushbutton filtre
handles(7)=uicontrol('style','pushbutton',...
    'units','normalized',...
    'position',[0.85 0.66 0.075 0.075],...
    'string','Filtre',...    
    'callback',@filtre,...
    'tag','filtre');
 
 
% Création de l'objet Uicontrol Pushbutton Sauvegarder
handles(8)=uicontrol('style','pushbutton',...
    'units','normalized',...
    'position',[0.85 0.54 0.075 0.075],...
    'string','Sauver',...    
    'callback',@sauver,...
    'tag','sauver');
 
 
% Création de l'objet Uicontrol Pushbutton Etape_suivante
handles(9)=uicontrol('style','pushbutton',...
    'units','normalized',...
    'position',[0.85 0.42 0.075 0.075],...
    'string','Etape',...    
    'callback',@etape,...
    'tag','etape');
 
 
 
 
setappdata((handles(2)),'img', gcf);
 
 
function UpdateAxes
    img = getappdata(gcf, 'Image');
    PathName = getappdata(img, 'PathName');
    FileName = getappdata(img, 'FileName');
    i = getappdata(img, 'i');
    IM = imread(FileName{i});
    imshow(IM);
    title(FileName{i});
end
 
 
function charger(FileName, PathName)
    img = getappdata(gcf, 'Image');
    [FileName,PathName] = uigetfile({'*.*'},'Selectionner Images','MultiSelect','on');
    if  iscell(FileName)
        k = max(size(FileName));
    else
        k = 1;
        FileName={FileName};
    end
    setappdata(img, 'PathName', PathName);
    setappdata(img, 'FileName', FileName);
    setappdata(img, 'k', k);
    UpdateAxes;
end
 
 
 
function suivant(FileName, PathName)
    img = getappdata(gcf, 'Image');
    i = getappdata(img, 'i');
    k = getappdata(img, 'k');
    if i < k 
        i = i + 1;
        setappdata(img, 'i', i);
        UpdateAxes;
    else
        message = 'Derniere Image';
        disp(message);
    end
end
 
 
function precedent(FileName, PathName)
    img = getappdata(gcf, 'Image');
    i = getappdata(img, 'i');
    if i > 1 
        i = i - 1;
        setappdata(img, 'i', i);
        UpdateAxes;
    else
        message = 'Premiere Image.';
        disp(message);
    end
end
 
 
function exit(FileName, PathName)
    close all;
end
 
%function charger(chemin, fichier)
%[fichier,chemin] = uigetfile({'*.*'},'Choisir l image')
%img=imread(fullfile(chemin,fichier));
%axes(handles(2));
%image(img);
 
 
end