[Insight-users] Computing Hessian Matrix of Large Image

Kevin H. Hobbs hobbsk at ohio.edu
Tue Nov 6 09:26:05 EST 2012


On 11/04/2012 03:50 PM, Jianxu Chen wrote:
> Hello,
> 
> I encountered a weird problem when computing the Hessian Matrix of a 3D
> image stack. 
> 
> I used HessianRecursiveGaussianImageFilter to compte the Hessian matrix.
> However, this filter only works well when the image is very very small.
> 
> My data is a 1024*1024*30 image stack. When calling
> HessianRecursiveGaussianImageFilter to calculate the Hessian matrix, the
> system cannot allocate the memory space for it. Thus, I cut my data into
> a 350*350*30 image stack. The program works well. My computer has a 8GB
> RAM and is a 64-bit machine. I am wondering why the system fails to
> allocate the memory for the filter. There should be enough usable RAM in
> the machine.

If your data are unsigned char : 1024*1024*100 / 2^20 = 100 MiB.
If your data are floats : 1024*1024*100 * 4 / 2^20 = 400 MiB.
If your data are doubles : 1024*1024*100 * 8 / 2^20 = 800 MiB.

The Hessian matrix is symmetric so only 6 values are required :
	1024*1024*100 * 8 * 6 / 2^30 = 4.69 GiB.

If you have a long pipeline your image could be in memory in many places.

> 
> My data is at least 1024*1024*30, sometimes even 1024*1024*100. And I
> have to compute the Hessian matrix in my algorithm. What should I do in
> this case? Could you give my some advice? Really appreciate your help.
> 

Shorten your pipeline. Reader => Filter => Writer.

Set the ReleaseDataFlag or GlobalReleaseDataFlag so that filters free
their data after satisfying downstream requests.

Stream your pipeline :
	writer->SetNumberOfStreamDivisions( n );


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 251 bytes
Desc: OpenPGP digital signature
URL: <http://www.itk.org/pipermail/insight-users/attachments/20121106/f3fb767a/attachment.pgp>


More information about the Insight-users mailing list