Problems applying algorithm to multiple images
2 views (last 30 days)
Show older comments
Hi my aim is to remove noise and segment bacteria from time lapse microscopy images. So far I have created a function to that does this and can be applied to any of the images independently. I would like to create a new function or adapt the present one to loop over the images and apply the algorithm. I have looked at the Matlab help page Batch Processing Images in Parallel and after following the instructions I get the following error Error in ==> batchProcessFiles at 12 Cell contents reference from a non-cell array object. The line mentioned reads I = imread(fileNames{1}); I am confused as fileNames is a cell array object containing all the images to be looped over. Also I am getting a warning stating that variable fcn is indexed but not sliced in a parfor loop. The lines of code are parfor (k = 1:nImages)
I = imread(fileNames{k});
segmentedCellSequence(:,:,k) = fcn(I);
1 Comment
Image Analyst
on 30 Jul 2012
What is fcn? What does "indexed but not sliced" mean? (I don't have the parallel toolbox, in case those are special parallel terms.) Is fcn an array or a function? If it's an array, how can it take a 2D or 3D image as an index?
Answers (2)
gargoyle
on 2 Aug 2012
as i understand this: you have a function which you want to apply to every image in a folder. assuming that is what you want. try the following:
get the file list from your folder with images (root)
root='C:\some path\'; % you can enter your path here
file_list=dir([root '*.tiff'])% here i assume you have a tiff file and you will %get all the tiff files in the folder
%now the for loop:
for count=1:numel(file_list)
img=imread([root file_list(count).name]) %this will open the images you can %also try something called bfopen (search for it) if you dont have raw tiff %files
%use img to run your code on
end
1 Comment
gargoyle
on 2 Aug 2012
OOPS. Walter already covers this with his link and there is some error checking also included there.
See Also
Categories
Find more on Image Processing Toolbox 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!