[Insight-users] About the MultiScaleHessianBasedMeasureImageFilter's function GetHessianOutput()

Wang Zhimin zwang at i2r.a-star.edu.sg
Sat Mar 5 13:15:30 EST 2011


Hi, Luca,

Thank you. 

But since the return pointer from GetHessianImage() is a const one, can I still declare a const smart pointer or just raw or smart pointer in my .h header file?

Regards,
Zhimin

On Mar 6, 2011, at 1:48, "Luca Antiga" <luca.antiga at gmail.com> wrote:

> Hi Zhimin,
>  the problem is that your m_itkHessianImageData is declared in your .h file as a const raw pointer, and Graft is a non-const method. So you either declare it as
> HessianImageType::Pointer m_itkHessianImageData;
> or even
> const HessianImageType::Pointer m_itkHessianImageData;
> or you still use a raw pointer but you drop const
> HessianImageType* m_itkHessianImageData;
> 
> Please forward the message to the list, so that others can take advantage from it.
> 
> Best regards
> 
> Luca
> 
> 
> On 05/mar/2011, at 17:56, Wang Zhimin <zwang at i2r.a-star.edu.sg> wrote:
> 
>> Hi, Luca,
>> 
>> Here you go
>> 
>> myAlgorithm.h
>> 
>> ...
>> // hessian image
>> 	const HessianImageType* m_itkHessianImageData;
>> ...
>> 
>> myAlgorithm.cpp
>> 
>> ...
>> 
>> myAlgorithm::myAlgorithm( QWidget* parent ) : QDockWidget( parent )
>> {
>>  	setupUi( this );
>> ...
>> 		m_itkHessianImageData = HessianImageType::New();
>> ...
>> }
>> 
>> ...
>> 
>> void myAlgorithm::pbGetVesselnessClicked()
>> {
>> ...
>> m_itkHessianImageData->Graft( hessianFilter->GetHessianOutput() );
>> ...
>> }
>> 
>> Thank you.
>> 
>> Regards,
>> Zhimin
>> 
>> 
>> On 05-Mar-2011, at 9:56 PM, Luca Antiga wrote:
>> 
>>> Hi Wang,
>>>  how is m_itkHessianImageData defined exactly? Can you post the portion of the code in your .h file and the constructor that shows it?
>>> Thanks
>>> 
>>> Luca
>>> 
>>> 
>>> On Mar 5, 2011, at 9:22 AM, Wang Zhimin wrote:
>>> 
>>>> Hi, Luca,
>>>> 
>>>> I have problem of using Graft() method. I use m_itkHessianImageData->Graft( hessianFilter->GetHessianOutput() ), I got the following error:
>>>> 
>>>> cpp:231: error: passing 'const HessianImageType' as 'this' argument of 'void itk::Image<TPixel, VImageDimension>::Graft(const itk::DataObject*) [with TPixel = itk::SymmetricSecondRankTensor<float, 3u>, unsigned int VImageDimension = 3u]' discards qualifiers
>>>> 
>>>> 
>>>> I already instantiated it in constructor. 
>>>> 
>>>> If I don't use Graft(), directly assign it as m_itkHessianImageData = hessianFilter->GetHessianOutput(); instead, there is no compiling error. 
>>>> 
>>>> The reason why I define it in the class level is that, I want to use this m_itkHessianImageData for some other functions and classes. 
>>>> 
>>>> Thank you very much.
>>>> 
>>>> Regards,
>>>> Zhimin
>>>> 
>>>> 
>>>> On 02-Mar-2011, at 6:11 AM, Luca Antiga wrote:
>>>> 
>>>>> Hi Wang,
>>>>>  you have a problem with const-correctedness: GetHessianOutput returns a const HessianImageType reference, while your m_itkHessianImageData is not const.
>>>>> 
>>>>> I suggest you use instead
>>>>> 
>>>>> const HessianImageType * hessianImage = hessianFilter->GetHessianOutput();
>>>>> 
>>>>> or, if m_itkHessianImageData is already declared at the class level (as the m_ in the name suggests) and instantiated, e.g., in the constructor, 
>>>>> 
>>>>> m_itkHessianImageData->Graft(hessianFilter->GetHessianOutput());
>>>>> 
>>>>> Note that for the above to work m_itkHessianImageData must have been instantiated as
>>>>> 
>>>>> m_itkHessianImageData = HessianImageType::New();
>>>>> 
>>>>> Hope this helps
>>>>> 
>>>>> Luca
>>>>> 
>>>>> 
>>>>> 
>>>>> On Mar 1, 2011, at 10:32 AM, Wang Zhimin wrote:
>>>>> 
>>>>>> Hi, Luca
>>>>>> 
>>>>>> Thanks for the reply.
>>>>>> 
>>>>>> From what you have written, I think the MultiScaleHessianBasedMeasureImageFilter is the one I am looking for. 
>>>>>> 
>>>>>> But now when I try to use it to get the Hessian matrix. I got the following compiling errors. 
>>>>>> ----------------------------------------------
>>>>>> In the header file myAlgorithm.h, I declare
>>>>>> 
>>>>>> typedef itk::SymmetricSecondRankTensor< float, 3 > HessianPixelType;
>>>>>> typedef itk::Image< HessianPixelType, 3 >    HessianImageType;
>>>>>> typedef itk::MultiScaleHessianBasedMeasureImageFilter< FloatVolumeImageType, HessianImageType, 
>>>>>>                                                 FloatVolumeImageType > MultiScaleHessianFilterType;
>>>>>> 
>>>>>> HessianImageType::Pointer m_itkHessianImageData;
>>>>>> 
>>>>>> And then, in the myAlgorithm.cpp, I have
>>>>>> 
>>>>>> MultiScaleHessianFilterType::Pointer hessianFilter = MultiScaleHessianFilterType::New();
>>>>>> 	
>>>>>> 	hessianFilter->SetInput( cast2float->GetOutput() );
>>>>>> 	hessianFilter->SetNumberOfSigmaSteps( 10 );
>>>>>> 	hessianFilter->SetSigmaStepMethodToEquispaced();
>>>>>> 	hessianFilter->SetSigmaMinimum( 0.5 );
>>>>>> 	hessianFilter->SetSigmaMaximum( 4.0 );
>>>>>> 	hessianFilter->SetGenerateHessianOutput( true );
>>>>>> 	hessianFilter->SetGenerateScalesOutput( true );
>>>>>> 	
>>>>>> 	m_itkHessianImageData = hessianFilter->GetHessianOutput();
>>>>>> 
>>>>>> And I compile, I have the following errors:
>>>>>> /Users/zwang/workspace/myFuzzyVesselSegmentation/VesselSegmentationPanel.cpp:214:0 /Users/zwang/workspace/myFuzzyVesselSegmentation/VesselSegmentationPanel.cpp:214: error: invalid conversion from 'const itk::Image<itk::SymmetricSecondRankTensor<float, 3u>, 3u>*' to 'itk::Image<itk::SymmetricSecondRankTensor<float, 3u>, 3u>*'
>>>>>> 
>>>>>> /Users/zwang/workspace/myFuzzyVesselSegmentation/VesselSegmentationPanel.cpp:214:0 /Users/zwang/workspace/myFuzzyVesselSegmentation/VesselSegmentationPanel.cpp:214: error:   initializing argument 1 of 'itk::SmartPointer<TObjectType>& itk::SmartPointer<TObjectType>::operator=(TObjectType*) [with TObjectType = itk::Image<itk::SymmetricSecondRankTensor<float, 3u>, 3u>]'
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> May I know what the reason? Or what's the proper way to get the hessian matrix with the itk::MultiscalHessianBasedMeasureImageFilter?
>>>>>> 
>>>>>> Regards,
>>>>>> Zhimin
>>>>>> 
>>>>>> 
>>>>>> On 25-Feb-2011, at 9:22 PM, Luca Antiga wrote:
>>>>>> 
>>>>>>> Hi Zhimin,
>>>>>>>  if you just need to compute the hessian and eigenvectors at a particular scale, you are better off using the HessianRecursiveGaussianImageFilter and manipulate the hessian to get the eigenvectors directly, pretty much in the same way as done in the ThreadedGenerateData method, in Code/Review/itkHessianToObjectnessMeasureImageFilter.txx
>>>>>>> 
>>>>>>> If, on the other hand, you need to perform a multi-scale analysis and then look at the eigenvectors, then using MultiScaleHessianBasedMeasureImageFilter is correct. In that case, the GetHessianOutput method will get you an image where each voxel holds the Hessian at the scale that gave the highest response (in terms of the generic Hessian-based measure you plug in the filter, for instance Sato's vesselness).
>>>>>>> 
>>>>>>> As for accessing the individual values of the Hessian, use the H(0,0), H(1,0), etc signature (see Code/Common/itkSymmetricSecondRankTensor.h). That way you can access all 9 components (except that only 6 will be stored, but that's transparent to you).
>>>>>>> 
>>>>>>> Hope this helps
>>>>>>> 
>>>>>>> Luca
>>>>>>> 
>>>>>>> 
>>>>>>> On Feb 25, 2011, at 9:21 AM, Wang Zhimin wrote:
>>>>>>> 
>>>>>>>> 
>>>>>>>> I am a newbie to ITK. I currently want to compute the hessian matrix, eigen vector out of some volume CT images. I found that I can use itk::MultiScaleHessianBasedMeasureImageFilter, or itk::HessianRecursiveGaussianImageFilter plus itk::SymmetricEigenAnalysis and SymmetricSecondRankTensor image iterator to finish the job. Am I right?
>>>>>>>> 
>>>>>>>> For the itk::MultiScaleHessianBasedMeasureImageFilter, I understand that I can turn the GenerateHessianOutputOn() function to compute the Hessian image and use GetHessianOutput() to get the SymmetricSecondRankTensor image. Is this a correct procedure? If yes, so here comes my question. Since the multi scale hessian filter is multi scale, if I use GetHessianOutput() function, what scale is the Hessian output of?
>>>>>>>> 
>>>>>>>> Suppose my volume image dimension is 3, how can I access all the values in Hessian matrix? Can I use H[][] to access all 9 values? Or I can only access 6 and I need to fill up all the rest based on symmetric rule?
>>>>>>>> 
>>>>>>>> For my second option, from HessianRecursiveGaussianImageFilter -> SymmetricSecondRankTensor image -> SymmetricEigenAnalysis -> eigen vector, will it work as predicted? 
>>>>>>>> 
>>>>>>>> Sorry for so many questions. 
>>>>>>>> 
>>>>>>>> Thank you and best regards,
>>>>>>>> Zhimin
>>>>>>>> 
>>>>>>>> Research Fellow
>>>>>>>> Institute for Infocomm Research
>>>>>>>> A-STAR, Singapore
>>>>>>>> 
>>>>>>>> 
>>>>>>>> Institute for Infocomm Research disclaimer: "This email is confidential and may be privileged. If you are not the intended recipient, please delete it and notify us immediately. Please do not copy or use it for any purpose, or disclose its contents to any other person. Thank you."
>>>>>>>> _____________________________________
>>>>>>>> Powered by www.kitware.com
>>>>>>>> 
>>>>>>>> Visit other Kitware open-source projects at
>>>>>>>> http://www.kitware.com/opensource/opensource.html
>>>>>>>> 
>>>>>>>> Kitware offers ITK Training Courses, for more information visit:
>>>>>>>> http://www.kitware.com/products/protraining.html
>>>>>>>> 
>>>>>>>> Please keep messages on-topic and check the ITK FAQ at:
>>>>>>>> http://www.itk.org/Wiki/ITK_FAQ
>>>>>>>> 
>>>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>>>> http://www.itk.org/mailman/listinfo/insight-users
>>>>>>> 
>>>>>> 
>>>>>> Institute for Infocomm Research disclaimer: "This email is confidential and may be privileged. If you are not the intended recipient, please delete it and notify us immediately. Please do not copy or use it for any purpose, or disclose its contents to any other person. Thank you."
>>>>> 
>>>> 
>>>> Institute for Infocomm Research disclaimer: "This email is confidential and may be privileged. If you are not the intended recipient, please delete it and notify us immediately. Please do not copy or use it for any purpose, or disclose its contents to any other person. Thank you."
>>> 
>> 
>> Institute for Infocomm Research disclaimer: "This email is confidential and may be privileged. If you are not the intended recipient, please delete it and notify us immediately. Please do not copy or use it for any purpose, or disclose its contents to any other person. Thank you."

Institute for Infocomm Research disclaimer:  "This email is confidential and may be privileged. If you are not the intended recipient, please delete it and notify us immediately. Please do not copy or use it for any purpose, or disclose its contents to any other person. Thank you."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110306/4fd99b35/attachment.htm>


More information about the Insight-users mailing list