Path: news.mathworks.com!not-for-mail
From: "Arron S" <aps@uwm.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Array of Images Running out of memory
Date: Tue, 6 Jan 2009 19:57:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 48
Message-ID: <gk0d2d$4ra$1@fred.mathworks.com>
References: <gjupaq$jeu$1@fred.mathworks.com>
Reply-To: "Arron S" <aps@uwm.edu>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1231271821 4970 172.30.248.37 (6 Jan 2009 19:57:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 6 Jan 2009 19:57:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1655593
Xref: news.mathworks.com comp.soft-sys.matlab:510094


Thank you all for the help.  I believe the initial problem was that I had fragmented memory from testing because it worked this morning after i restarted the computer with the large data set.  But I also think that processing each image individually will also be a great help for future calculation and I appreciate that tip.  When I get this running I will post again for tips to make it file exchange ready for future users who want to do FRET. 
Thanks again,
Arron



"Arron S" <aps@uwm.edu> wrote in message <gjupaq$jeu$1@fred.mathworks.com>...
> I am very very new to matlab and have written my first M-file. It is functional for a test set of 38 images but my data sets are in the range of 400. (144x512)
> 
> When I try to run it with a full data set I get an obvious memory error.  I realize that I am running 32bit XP and thus don't have a large enough contiguous memory for my data. But I know that others are able to get around this and I would like to know how. This should be easy to answer since I have read a lot of posts where people have arrays of a good deal of images but they did not explain how they were doing it. I looked at a few hundred file exchange files and searched this forum before I decided to post this message.  I did not find an answer that I understood.  Any help or links to topics pointing me in the right direction would be very helpful. 
> 
> My aim is to load about 400 images and run FRET analysis. 
> Below is my code (probably not optimal, and itis currently molded for my data with no input/error checks yet) I used ReadDicom4.m by Nipun Patel to teach myself some of the basics and hence some of the variables are of the same name.
> 
> Thank you in advance,
> Arron
> 
> 
> 
> function a = imagestack(sequenceStartNo,sequenceEndNo, fileExtension)
> tic
> 
> 
> fileCount=0;
> totalFiles = sequenceEndNo - sequenceStartNo;
> a= zeros(144,512,totalFiles);  % preallocation
> 
> j=1;
> 
> for i=sequenceStartNo:sequenceEndNo 
>     
>     sequenceNo=num2str(i);
>     filename = strcat(sequenceNo,fileExtension);
>     varname = imread (filename);
>     varname = mat2gray(varname);
>     
>     fileCount = fileCount + 1;
>     
>     a(:,:,j)= varname;
>     
>     j = j+1;
> end
> 
> toc
> display (fileCount);
> 
>