"Radon Transform": why the output image is (N,NxNumber of processors) despite the input image is NxN?? in the parallel computing on matlab?? thank you

if true
% clc,clear,close all;
f=phantom(256);
theta=0:179;
tic;
matlabpool(4)
x=distributed(f);
spmd
wx=getLocalPart(x);
g=radon(wx,theta);
g=iradon(g,theta,1,256);
% g=uint8(g);
end
g = gather(g);
conct=[g{:}];
matlabpool close;
toc;
subplot(2,1,1), imshow(conct);title('Fileterd backprojection');
subplot(2,1,2), imshow(f);title('Original image');
end

 Accepted Answer

You have specified in the 4th argument,
g=iradon(g,theta,1,256);
that all of the parallel reconstructed pieces be 256x256. Therefore, when you patch them back together, you get 256x(256*Np). Unfortunately also, IRADON is a simple tool that doesn't know how to reconstruct non-square images, so you have limited options in terms of how you divide up the data.
The following is a parfor-based alternative that uses MAT2TILES ( Download ). PARFOR is supposedly more efficient than SPMD,
C=mat2tiles(f,2,2);
parfor i=1:4
wx=C{i};
g=radon(wx,theta);
g=iradon(g,theta,1,size(C{i},1));
C{i}=g;
end
conct=cell2mat(C);

6 Comments

Check your path. Make sure mat2tiles is on it...
yes, i put it in the wrong path ;) thank you so much Matt, ;) i will try it with a heavy images!!
hi Matt it worked with me for grayscale image reconstruction, but i want to run this code on image with bit depth=24 and color type="true color"!! i don't know how to apply mat2cell on it!! an image is attached thank you
akram - the image is not in any MATLAB format, so I'm not sure what you're doing, exactly. However, if the image data is 3-dimensional, with RGB or other color channels, you can use mat2tiles to do 3-dimensional tiling in various ways, e.g.,
A=rand(4,4,3); mat2tiles(A,2,2,1), mat2tiles(A,2,2,3)
Do "help mat2tiles" for more info on usage.
just one other question Matt ;) it doesn't work with me the mat2tiles function and i used mat2cell, the question is i didn't know how to use mat2cell for my 3d image, for example 256x256x3!! thank you so much
for example 256x256x3
How big do you want the sub-chunks to be? NxNx3? NxNx1?

Sign in to comment.

More Answers (0)

Asked:

on 17 Jan 2015

Edited:

on 20 Jan 2015

Community Treasure Hunt

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

Start Hunting!