[Insight-users] Memory management

Bradley Lowekamp blowekamp at mail.nih.gov
Tue Mar 29 09:45:20 EDT 2011


Kana,

The RecursiveGaussianImageFilter is multithreaded, but not streamable. The linked HessianImageFilter is both multithreaded and streamable. It's not clear to me how you were going to use the image functions. If you were planning on computing the hessian on much of the image then the image function would be horrible inefficient. 

Going back to your original e-mail you said your pipeline was as follows:

Original image -> discretegaussian -> gradientmagnitude -> HessianRecursiveGaussianImageFilter->symmetric eigenvalue analysis -> finally 3 vector image

If you add the StreamingImageFilter to the end of the pipeline, I would expect the pipeline to stream and be relatively memory efficient.

Good luck,
Brad

On Mar 29, 2011, at 5:28 AM, Arunachalam Kana wrote:

> Hi Brad,
>  
> Thank you for your reply. As recommended by you, I will use the itkHessianImageFilter to calculate the hessian. I see the filter is multithreaded which
> Was not available before, so i think it will be faster than before. On the other hand the itkHessianImageFilter calculates an output image, which i think
> Will drastically increase the use of RAM compared to the itkDiscreteHessianGaussianImagefunction.h. Am i right?
>  
> However, I will have to test for the speed and for the memory usage.
>  
> Thank you for the filter.
> Regards,
> Kana
>  
> From: Bradley Lowekamp [mailto:blowekamp at mail.nih.gov] 
> Sent: 29 March 2011 06:42
> To: Arunachalam Kana
> Cc: insight-users at itk.org
> Subject: Re: [Insight-users] Memory management
>  
> Hello Kana,
>  
> Sorry for the delay in getting this out there. I have placed what I have been working on github:
>  
> https://github.com/blowekamp/itkLocalDiscreteHessian
>  
> The itkHessianDiscreteGaussianimageFilter is not yet implemented, and I still need to migrate more testing over to the github module. 
>  
> I would recommend just coping over itkHessianImageFilter into your project, writing some test to make yourself confident that it's computing the correctly, then keep an eye on the github repository. 
>  
> Good luck,
> Brad
>  
> On Mar 21, 2011, at 12:20 PM, Arunachalam Kana wrote:
> 
> 
> Hi Brad,
> Thank you for the reply.
> In brief : My goal is to calculate the eigen vectors using eigenanalysisfunction.
> Calculation of hessian with recursivegaussian occupy 12times more memory. discretegaussian is 30 times slower and not multithreaded.
> My image is 10Gb and my ram is 64Gb too.
>  
> Thank you for the advice and for the information that you are already working on it. I will wait for the code.
> Thank you,
> Regards,
> Kana
>  
> From: Bradley Lowekamp [mailto:blowekamp at mail.nih.gov] 
> Sent: 21 March 2011 17:03
> To: Arunachalam Kana
> Cc: insight-users at itk.org
> Subject: Re: [Insight-users] Memory management
>  
> Hello Kana,
>  
> I would strongly not recommend not taking this approach. It is rather inefficient, and version 3.20 has a bug related to this method.
>  
> I have an alternative implementation with exploits the separability of the convolution by a derivative. Simply, I implemented a discrete Hessian filter where a Gaussian convolution can occur as a prior filter. I hopefully will be able to get this to a sharable state this week.
>  
> Brad
>  
>  
>  
> On Mar 21, 2011, at 10:35 AM, Arunachalam Kana wrote:
> 
> 
> 
> Hi Vera,
> Thank you for the information that the recursive Gaussian cannot be streamed.
>  
> Hi Masslawi,
> I have not tried the release version , i will surely try it.
>  
> I decided to use discretehessiancalculation for calculation of hessian matrix. I thought of increasing the speed by multithreading in my own filter.
> My filter takes 1 input image and gives 1 output image. So i calculate the hessian for each voxel.
> The problem: My program breaks due to the following error.
> ERROR MESSAGE:
> Windows has triggered a breakpoint in iAnalyseGUI.exe.
> This may be due to a corruption of the heap, which indicates a bug in iAnalyseGUI.exe or any of the DLLs it has loaded.
> This may also be due to the user pressing F12 while iAnalyseGUI.exe has focus.
> The output window may have more diagnostic information.
>  
> The breakage happens when the 3rd thread starts, and in DiscreteHessianGaussianImageFunction.txx line 116.
> I need some help in solving the heap problem.
>  
> And finally the question comes to whether is it possible to multithread the DiscreteHessianGaussianImageFunction.txx ?????
> As i have to work with large size data, i really need it, so if i can find the code somewhere please direct me or i would need some help to
> Multithread the DiscreteHessianGaussianImageFunction.txx.
>  
> //code
> template<class TInputImageType,  class TOutputImageType>
> void MYFilter<TInputImageType,     TOutputImageType>
> ::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, int threadId)
> {
>   typename OutputImageType::Pointer output = this->GetOutput();
>   typename InputImageType::ConstPointer input = this->GetInput();
>  
>                 //set hessian function
> m_HessianFunction = HessianFunctionType::New();
>                 m_HessianFunction->SetInputImage(m_GradientMagnitudeImage );
>                 m_HessianFunction->SetSigma( 1 );
>                 m_HessianFunction->SetMaximumError( 0.01 );
>                 m_HessianFunction->SetMaximumKernelWidth( 32 );
>                 m_HessianFunction->SetNormalizeAcrossScale( 1 );
>                 m_HessianFunction->SetUseImageSpacing( false );
>                 m_HessianFunction->Initialize( );
>                
>                 //initiate iamge iterators
>                 InputImageRegionIteratorType inIter(m_InputImage, outputRegionForThread);
>                 OutputImageRegionIteratorType outIter(m_OutputImage, outputRegionForThread);
>  
>                 inIter.GoToBegin();
>                 while ( !inIter.IsAtEnd() )
>                 {
>                                InputIndexType currentindex =inIter.GetIndex();
>                                InputPixelType currentpixel = inIter.Get();
>                                               
>                                //initialise the variables
>                                HessianFunctionType::TensorType   hess_matrix;
>                                hess_matrix = m_HessianFunction->EvaluateAtIndex( currentindex );
>                               
>                                ++inIter;                            
>                 }//while
> }
>  
> Thank you,
> Regards,
> Kana
>  

========================================================
Bradley Lowekamp  
Lockheed Martin Contractor for
Office of High Performance Computing and Communications
National Library of Medicine 
blowekamp at mail.nih.gov


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110329/c4b0281e/attachment-0001.htm>


More information about the Insight-users mailing list