<div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13.333333969116211px;background-color:rgb(255,255,255)">Hello Kevin,</span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13.333333969116211px;background-color:rgb(255,255,255)"><br>
</span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13.333333969116211px;background-color:rgb(255,255,255)">Really appreciate your suggestion. I found that "</span><span style="background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13.333333969116211px">SetNumberOfStreamDivisions" is really powerful when handling large data.</span></div>
<div><span style="background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13.333333969116211px"><br></span></div><div><span style="background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13.333333969116211px">For the Hessian Matrix Filter, I noticed that this problem had already been discussed via the maillist in 2008.</span></div>
<div><span style="background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13.333333969116211px"><br></span></div><div><span style="background-color:rgb(255,255,255)"><font color="#222222" face="arial, sans-serif"> <a href="http://www.itk.org/pipermail/insight-users/2008-June/026328.html">http://www.itk.org/pipermail/insight-users/2008-June/026328.html</a></font></span></div>
<div><span style="background-color:rgb(255,255,255)"><font color="#222222" face="arial, sans-serif"><br></font></span></div><div><span style="background-color:rgb(255,255,255)"><font color="#222222" face="arial, sans-serif">Some tests were conducted there. It showed that it might fail to allocate memory for the Hessian matrix even when there should be enough space theoretically. </font></span></div>
<div><span style="background-color:rgb(255,255,255)"><font color="#222222" face="arial, sans-serif"><br></font></span></div><div><span style="background-color:rgb(255,255,255)"><font color="#222222" face="arial, sans-serif">Anyway, your suggestion of using </font></span><span style="background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13.333333969116211px">SetNumberOfStreamDivisions is very useful. My problem can be solved. </span></div>
<div><span style="background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13.333333969116211px"><br></span></div><div><span style="background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13.333333969116211px">Thanks again for your help.</span></div>
<div><font color="#222222" face="arial, sans-serif">Jianxu Chen</font></div><br><div class="gmail_quote">On Tue, Nov 6, 2012 at 9:26 AM, Kevin H. Hobbs <span dir="ltr"><<a href="mailto:hobbsk@ohio.edu" target="_blank">hobbsk@ohio.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 11/04/2012 03:50 PM, Jianxu Chen wrote:<br>
> Hello,<br>
><br>
> I encountered a weird problem when computing the Hessian Matrix of a 3D<br>
> image stack.<br>
><br>
> I used HessianRecursiveGaussianImageFilter to compte the Hessian matrix.<br>
> However, this filter only works well when the image is very very small.<br>
><br>
> My data is a 1024*1024*30 image stack. When calling<br>
> HessianRecursiveGaussianImageFilter to calculate the Hessian matrix, the<br>
> system cannot allocate the memory space for it. Thus, I cut my data into<br>
> a 350*350*30 image stack. The program works well. My computer has a 8GB<br>
> RAM and is a 64-bit machine. I am wondering why the system fails to<br>
> allocate the memory for the filter. There should be enough usable RAM in<br>
> the machine.<br>
<br>
</div>If your data are unsigned char : 1024*1024*100 / 2^20 = 100 MiB.<br>
If your data are floats : 1024*1024*100 * 4 / 2^20 = 400 MiB.<br>
If your data are doubles : 1024*1024*100 * 8 / 2^20 = 800 MiB.<br>
<br>
The Hessian matrix is symmetric so only 6 values are required :<br>
1024*1024*100 * 8 * 6 / 2^30 = 4.69 GiB.<br>
<br>
If you have a long pipeline your image could be in memory in many places.<br>
<div class="im"><br>
><br>
> My data is at least 1024*1024*30, sometimes even 1024*1024*100. And I<br>
> have to compute the Hessian matrix in my algorithm. What should I do in<br>
> this case? Could you give my some advice? Really appreciate your help.<br>
><br>
<br>
</div>Shorten your pipeline. Reader => Filter => Writer.<br>
<br>
Set the ReleaseDataFlag or GlobalReleaseDataFlag so that filters free<br>
their data after satisfying downstream requests.<br>
<br>
Stream your pipeline :<br>
writer->SetNumberOfStreamDivisions( n );<br>
<br>
<br>
</blockquote></div><br>