<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/138303</link>
    <title>MATLAB Central Newsreader - Out of memory- Try to read dicom file</title>
    <description>Feed for thread: Out of memory- Try to read dicom file</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Wed, 20 Dec 2006 12:53:53 -0500</pubDate>
      <title>Out of memory- Try to read dicom file</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/138303#348490</link>
      <author>merdim</author>
      <description>Hi all,&lt;br&gt;
I have a dicom file which is 258MB. When I try to read this file&lt;br&gt;
using &quot;dicomread&quot; comand, matlab gives error &quot;Out of memory &quot;. I&lt;br&gt;
increased virtual memory of windows but this did not work. Does&lt;br&gt;
anyone have any idea how can I read the dicom file?&lt;br&gt;
thank you</description>
    </item>
    <item>
      <pubDate>Fri, 22 Dec 2006 15:48:52 -0500</pubDate>
      <title>Re: Out of memory- Try to read dicom file</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/138303#348793</link>
      <author>Ofek Shilon</author>
      <description>try and debug-step dicomread as you run it. where *exactly* does it&lt;br&gt;
break? (step-in as needed)&lt;br&gt;
&lt;br&gt;
&amp;nbsp;merdim wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Hi all,&lt;br&gt;
&amp;gt; I have a dicom file which is 258MB. When I try to read this file&lt;br&gt;
&amp;gt; using &quot;dicomread&quot; comand, matlab gives error &quot;Out of memory &quot;. I&lt;br&gt;
&amp;gt; increased virtual memory of windows but this did not work. Does&lt;br&gt;
&amp;gt; anyone have any idea how can I read the dicom file?&lt;br&gt;
&amp;gt; thank you</description>
    </item>
    <item>
      <pubDate>Sat, 23 Dec 2006 08:47:48 -0500</pubDate>
      <title>Re: Out of memory- Try to read dicom file</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/138303#348836</link>
      <author>merdim</author>
      <description>Here is the error massage:&lt;br&gt;
&lt;br&gt;
??? Out of memory. Type HELP MEMORY for your options.&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; dicomread&amp;gt;processRawPixels at 657&lt;br&gt;
&amp;nbsp;&amp;nbsp;X = reshape(metadata.InstanceData(1:numPixels), metadata.Columns,&lt;br&gt;
...&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; dicomread&amp;gt;newDicomread at 222&lt;br&gt;
&amp;nbsp;&amp;nbsp;X = processRawPixels(metadata);&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; dicomread at 82&lt;br&gt;
&amp;nbsp;&amp;nbsp;[X, map, alpha, overlays] = newDicomread(msgname, varargin{:});&lt;br&gt;
&amp;nbsp;I use matlab version of 7.0.4.365 (R14) Service Pack 2&lt;br&gt;
&amp;nbsp;&lt;br&gt;
Ofek Shilon wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; try and debug-step dicomread as you run it. where *exactly* does it&lt;br&gt;
&amp;gt; break? (step-in as needed)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; merdim wrote:&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; Hi all,&lt;br&gt;
&amp;gt;&amp;gt; I have a dicom file which is 258MB. When I try to read this&lt;br&gt;
file&lt;br&gt;
&amp;gt;&amp;gt; using &quot;dicomread&quot; comand, matlab gives error &quot;Out of memory &quot;.&lt;br&gt;
I&lt;br&gt;
&amp;gt;&amp;gt; increased virtual memory of windows but this did not work. Does&lt;br&gt;
&amp;gt;&amp;gt; anyone have any idea how can I read the dicom file?&lt;br&gt;
&amp;gt;&amp;gt; thank you</description>
    </item>
    <item>
      <pubDate>Tue, 02 Jan 2007 13:01:52 -0500</pubDate>
      <title>Re: Out of memory- Try to read dicom file</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/138303#349596</link>
      <author>Ofek Shilon</author>
      <description>what happens if you replace lines 657-658 with :&lt;br&gt;
&lt;br&gt;
X = metadata.InstanceData; % temp duplicity&lt;br&gt;
rmfield(metadata,'InstanceData'); % remove duplicity&lt;br&gt;
X=reshape(X, metadata.Columns, metadata.Rows, 1, ...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;metadata.NumberOfFrames);&lt;br&gt;
&lt;br&gt;
does it break in the first line? (true memory problem)&lt;br&gt;
or afterwards? (some reshape-related issue)&lt;br&gt;
&lt;br&gt;
Ofek&lt;br&gt;
&lt;br&gt;
&amp;nbsp;merdim wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Here is the error massage:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; ??? Out of memory. Type HELP MEMORY for your options.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Error in ==&amp;gt; dicomread&amp;gt;processRawPixels at 657&lt;br&gt;
&amp;gt; X = reshape(metadata.InstanceData(1:numPixels), metadata.Columns,&lt;br&gt;
&amp;gt; ...&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Error in ==&amp;gt; dicomread&amp;gt;newDicomread at 222&lt;br&gt;
&amp;gt; X = processRawPixels(metadata);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Error in ==&amp;gt; dicomread at 82&lt;br&gt;
&amp;gt; [X, map, alpha, overlays] = newDicomread(msgname, varargin{:});&lt;br&gt;
&amp;gt; I use matlab version of 7.0.4.365 (R14) Service Pack 2&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Ofek Shilon wrote:&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; try and debug-step dicomread as you run it. where *exactly*&lt;br&gt;
does&lt;br&gt;
&amp;gt; it&lt;br&gt;
&amp;gt;&amp;gt; break? (step-in as needed)&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; merdim wrote:&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Hi all,&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; I have a dicom file which is 258MB. When I try to read this&lt;br&gt;
&amp;gt; file&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; using &quot;dicomread&quot; comand, matlab gives error &quot;Out of memory&lt;br&gt;
&amp;gt; &quot;.&lt;br&gt;
&amp;gt; I&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; increased virtual memory of windows but this did not work.&lt;br&gt;
&amp;gt; Does&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; anyone have any idea how can I read the dicom file?&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; thank you</description>
    </item>
    <item>
      <pubDate>Thu, 04 Jan 2007 12:13:04 -0500</pubDate>
      <title>Re: Out of memory- Try to read dicom file</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/138303#349866</link>
      <author>Matt Latourette</author>
      <description>merdim wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Hi all,&lt;br&gt;
&amp;gt; I have a dicom file which is 258MB. When I try to read this file&lt;br&gt;
&amp;gt; using &quot;dicomread&quot; comand, matlab gives error &quot;Out of memory &quot;. I&lt;br&gt;
&amp;gt; increased virtual memory of windows but this did not work. Does&lt;br&gt;
&amp;gt; anyone have any idea how can I read the dicom file?&lt;br&gt;
&amp;gt; thank you&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;br&gt;
258MB is really large for a single DICOM image, no matter what the&lt;br&gt;
modality is. I'm guessing that your data is not a single image, but&lt;br&gt;
rather many images stored as one file using one of the multiframe SOP&lt;br&gt;
classes and that may be related to the &quot;out of memory&quot; problem. I&lt;br&gt;
have seen a few situations before where I got an &quot;out of memory&quot;&lt;br&gt;
message from MATLAB when a lack of memory was not the real problem.&lt;br&gt;
In some circumstances, &quot;out of memory&quot; can really mean &quot;the catch-all&lt;br&gt;
error message you get when something has gone wrong and MATLAB can't&lt;br&gt;
figure out what to tell you&quot;. I don't know for sure whether or not&lt;br&gt;
multiframe data is supported by MATLAB, but it is quite possible that&lt;br&gt;
it may not be. Have you tried setting &quot;dbstop if error&quot; and then&lt;br&gt;
running the program so you can examine your variables after the out&lt;br&gt;
of memory error occurs and execution halts?&lt;br&gt;
&lt;br&gt;
-Matt</description>
    </item>
    <item>
      <pubDate>Thu, 04 Jan 2007 13:48:32 -0500</pubDate>
      <title>Re: Out of memory- Try to read dicom file</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/138303#349880</link>
      <author>Jeff Mather</author>
      <description>merdim wrote:&lt;br&gt;
&amp;nbsp;&amp;gt;&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;gt;&amp;gt; Here is the error massage:&lt;br&gt;
&amp;nbsp;&amp;gt;&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;gt;&amp;gt; ??? Out of memory. Type HELP MEMORY for your options.&lt;br&gt;
&amp;nbsp;&amp;gt;&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;gt;&amp;gt; Error in ==&amp;gt; dicomread&amp;gt;processRawPixels at 657&lt;br&gt;
&amp;nbsp;&amp;gt;&amp;gt; X = reshape(metadata.InstanceData(1:numPixels), metadata.Columns,&lt;br&gt;
&amp;nbsp;&amp;gt;&amp;gt; ...&lt;br&gt;
&amp;nbsp;&amp;gt;&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;gt;&amp;gt; Error in ==&amp;gt; dicomread&amp;gt;newDicomread at 222&lt;br&gt;
&amp;nbsp;&amp;gt;&amp;gt; X = processRawPixels(metadata);&lt;br&gt;
&amp;nbsp;&amp;gt;&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;gt;&amp;gt; Error in ==&amp;gt; dicomread at 82&lt;br&gt;
&amp;nbsp;&amp;gt;&amp;gt; [X, map, alpha, overlays] = newDicomread(msgname, varargin{:});&lt;br&gt;
&amp;nbsp;&amp;gt;&amp;gt; I use matlab version of 7.0.4.365 (R14) Service Pack 2&lt;br&gt;
&amp;nbsp;&amp;gt;&amp;gt;&lt;br&gt;
&lt;br&gt;
Ofek Shilon wrote:&lt;br&gt;
&amp;gt; what happens if you replace lines 657-658 with :&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; X = metadata.InstanceData; % temp duplicity&lt;br&gt;
&amp;gt; rmfield(metadata,'InstanceData'); % remove duplicity&lt;br&gt;
&amp;gt; X=reshape(X, metadata.Columns, metadata.Rows, 1, ...&lt;br&gt;
&amp;gt;           metadata.NumberOfFrames);&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
It's likely that you need some combination of the original &lt;br&gt;
implementation and Ofek's suggestion.  In particular, the code may need &lt;br&gt;
to index into InstanceData.  (Certain naughty &quot;DICOM&quot; file writers put &lt;br&gt;
too much data into the pixel data.)&lt;br&gt;
&lt;br&gt;
It's entirely possible that the combination of indexing into the array &lt;br&gt;
and performing the reshape is overwhelming your system's memory.  The &lt;br&gt;
indexing makes a copy of the data and reshaping makes at least one more. &lt;br&gt;
&amp;nbsp;&amp;nbsp;Add that to the original InstanceData field and you're talking about &lt;br&gt;
258*3 MB or 258*4 MB required for that line.  Consider splitting the &lt;br&gt;
line like this:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;if (numel(metadata.InstanceData) &amp;gt; numPixels)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;metadata.InstanceData((numPixels+1):end) = [];&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;elseif (numel(metadata.InstanceData) &amp;lt; numPixels)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;error('Not enough pixel data')&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;end&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;X = reshape(metadata.InstanceData, ...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;metadata.Columns, ...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;metadata.Rows, ...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1, ...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;metadata.NumberOfFrames);&lt;br&gt;
&lt;br&gt;
Jeff Mather&lt;br&gt;
Image Processing Group&lt;br&gt;
The MathWorks, Inc.</description>
    </item>
    <item>
      <pubDate>Wed, 08 Feb 2012 12:45:16 -0500</pubDate>
      <title>Re: Out of memory- Try to read dicom file</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/138303#866153</link>
      <author>Arso </author>
      <description>Hi there :)&lt;br&gt;
&lt;br&gt;
same problem here, i can read info of dicom but not frames(dicom over 1000 frames)&lt;br&gt;
&lt;br&gt;
from my experience problem is memory. To read huge dicoms matlab need more memory than you have(i have 2GB). &lt;br&gt;
&lt;br&gt;
Possible solutions are: &lt;br&gt;
-use 64bit version&lt;br&gt;
-increase ram memory&lt;br&gt;
-use external software to divide dicom at many images(jpgs). Then read frames as jpgs from folder instead of using dicomread('filename', 'frames', [vector frames]). I use Sante Dicom viewer it is free open source. &lt;br&gt;
&lt;br&gt;
If someone have better solution of problem please share :)&lt;br&gt;
&lt;br&gt;
greetings,&lt;br&gt;
&lt;br&gt;
Arso.&lt;br&gt;
&lt;br&gt;
merdim &amp;lt;merdim06@yahoo.com&amp;gt; wrote in message &amp;lt;ef4915a.-1@webcrossing.raydaftYaTP&amp;gt;...&lt;br&gt;
&amp;gt; Hi all,&lt;br&gt;
&amp;gt; I have a dicom file which is 258MB. When I try to read this file&lt;br&gt;
&amp;gt; using &quot;dicomread&quot; comand, matlab gives error &quot;Out of memory &quot;. I&lt;br&gt;
&amp;gt; increased virtual memory of windows but this did not work. Does&lt;br&gt;
&amp;gt; anyone have any idea how can I read the dicom file?&lt;br&gt;
&amp;gt; thank you</description>
    </item>
  </channel>
</rss>

