i have a code that stack the 2d images into 3d array and save in volume.fib and its output is good but when i'm trying to put into function it show some error ?

1 view (last 30 days)
numberOfSlices=186;
image = zeros(215,256,numberOfSlices);
for slice = 1 : numberOfSlices
dir_name='E:\BTN-7\final year project\regionbased_seg\complete project/edgedetection/prewitt';
thisSlice = double(imread(strcat(dir_name,num2str(slice),'.png')))/255;
image(:,:,slice) = thisSlice;
end
dimension = size(image);
image = reshape(image,dimension);
image = image(:,:,1:2:dimension(3));
image = image(:,1:2:dimension(2),:);
image = image(1:2:dimension(1),:,:);
dimension = size(image);
image = reshape(image,1,[]);
save wow.fib -v4
  • this is the code that is good and give correct output but*
function visulazition_Callback(hObject, eventdata, handles)
numberOfSlices=186;
image = zeros(215,256,numberOfSlices);
for slice = 1 : numberOfSlices
dir_name='E:\BTN-7\final year project\regionbased_seg\complete project/edgedetection/prewitt';
thisSlice = double(imread(strcat(dir_name,num2str(slice),'.png')))/255;
image(:,:,slice) = thisSlice;
end
dimension = size(image);
image = reshape(image,dimension);
image = image(:,:,1:2:dimension(3));
image = image(:,1:2:dimension(2),:);
image = image(1:2:dimension(1),:,:);
dimension = size(image);
image = reshape(image,1,[]);
save wow.fib -v4
This code when into function give me error at
dimension = size(image);
image = reshape(image,1,[]);
*warning message (these variables might be unused)
and output is not correctly save??*

Answers (0)

Categories

Find more on Images in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!