help image processing code
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
Hi all
I want to display multiple images using GUI. I have 135 image. i want load 135 images in axes, then when i slide, it will show the image from 1 to 135. This is my code that i know to read 135 image:
P = zeros(256, 256, 135);
for K = 1 : 135
petname = sprintf('PET_I1001_PT%03d.dcm', K);
P(:,:,K) = dicomread(petname);
end
how to me write the command for 'load image button' and 'slider' in m file ??
hope anyone can help me

채택된 답변
Image Analyst
2018년 1월 21일
Set up your scroll bar to have 135 as the max and 1 as the min. Then in the scrollbar callback function:
scrollBarValue = round(handles.scrollbar1.Value);
petName = sprintf('PET_I1001_PT%03d.dcm', scrollBarValue);
fullFileName = fullfile(folder, petName);
thisImage = dicomread(fullFileName);
imshow(thisImage);
No loop is needed.
댓글 수: 4
mohd akmal masud
2018년 1월 21일
then what is the command for load image??
This line is the line that loads the image from disk into a variable:
thisImage = dicomread(fullFileName);
This is the line that loads the image from a variable onto a rectangle on your screen:
imshow(thisImage);
this is my code, but still not work
function varargout = gui123(varargin)
% GUI123 MATLAB code for gui123.fig
% GUI123, by itself, creates a new GUI123 or raises the existing
% singleton*.
%
% H = GUI123 returns the handle to a new GUI123 or the handle to
% the existing singleton*.
%
% GUI123('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in GUI123.M with the given input arguments.
%
% GUI123('Property','Value',...) creates a new GUI123 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before gui123_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to gui123_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help gui123
% Last Modified by GUIDE v2.5 28-Feb-2018 00:33:09
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @gui123_OpeningFcn, ...
'gui_OutputFcn', @gui123_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before gui123 is made visible.
function gui123_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to gui123 (see VARARGIN)
% Choose default command line output for gui123
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes gui123 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = gui123_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- 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)
scrollBarValue = round(handles.scrollbar1.Value);
petName = sprintf('PET_I1001_PT%03d.dcm', scrollBarValue);
fullFileName = fullfile('D:\Images PET and CT\CT', petName);
thisImage = dicomread(fullFileName);
imshow(thisImage);
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
% --- Executes during object creation, after setting all properties.
function slider1_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
if true
% code
end
is it true like this? but the GUI appear as picture attach
function varargout = gui123(varargin)
% GUI123 MATLAB code for gui123.fig
% GUI123, by itself, creates a new GUI123 or raises the existing
% singleton*.
%
% H = GUI123 returns the handle to a new GUI123 or the handle to
% the existing singleton*.
%
% GUI123('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in GUI123.M with the given input arguments.
%
% GUI123('Property','Value',...) creates a new GUI123 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before gui123_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to gui123_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help gui123
% Last Modified by GUIDE v2.5 28-Feb-2018 00:52:21
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @gui123_OpeningFcn, ...
'gui_OutputFcn', @gui123_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before gui123 is made visible.
function gui123_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to gui123 (see VARARGIN)
% Choose default command line output for gui123
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes gui123 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = gui123_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- 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)
scrollBarValue = round(handles.scrollbar1.Value);
petName = sprintf('PET_I1001_PT%03d.dcm', scrollBarValue);
fullFileName = fullfile('D:\Images PET and CT\CT', petName);
thisImage = dicomread(fullFileName);
imshow(thisImage);
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
% --- Executes during object creation, after setting all properties.
function slider1_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
