[ITK Community] [Insight-developpers] filter update causes libc++abi error

Thibault Lucidarme thibault.lucidarme at gmail.com
Mon Feb 17 17:40:05 EST 2014


Dear Matt,
I have successfully tried your answer to my registration problem (using
SetNumberOfRequiredInputs and this->SetInput( 0, fixedImage )  )
However this->GetInput() returns a casual pointer instead of a
SmartPointer. In order to be consistent with the rest of my filters (and
the rest of my program), I have had to cast it like this:

ImageType::Pointer fixedImage = const_cast<ImageType*>( this->GetInput(0)
);

as per mentioned here:
http://www.itk.org/pipermail/insight-users/2008-February/024988.html
Yet, when later on in the code I use

registrator->SetFixedImageRegion( fixedImage->GetLargestPossibleRegion() );

the program ends with a segfault. Somehow the casting does not work and
returns NULL.
Do you have any ideas why that is?


Yours Sincerely

Thibault


2014-02-13 19:10 GMT-06:00 Thibault Lucidarme <thibault.lucidarme at gmail.com>
:

> Dear Matt,
> Thank you for taking the time to make it buildable, I am sorry for not
> doing so in the first place.
> I will try your suggestions as soon as possible and will come back to you.
>
> Sincerely
>
> Thibault
>
>
> 2014-02-13 16:02 GMT-06:00 Matt McCormick <matt.mccormick at kitware.com>:
>
> Hi Thibault,
>>
>> This was not buildable, but I made it buildable here:
>>
>> https://gist.github.com/thewtex/8984576
>>
>> When this is run, the caught exception says:
>>
>> Error:
>> itk::ExceptionObject (0x1c95630)
>> Location: "unknown"
>> File: /home/matt/src/ITK/Modules/Core/Common/src/itkProcessObject.cxx
>> Line: 1370
>> Description: itk::ERROR: RegistrationFilter(0x1c92430): Input Primary is
>> required but not set.
>>
>> Since ImageToImageFilter (the base class) is a filter, that transform
>> inputs to outputs, these must be specified.  ImageToImageFilter call
>> SetNumberOfRequiredInputs(1) in its constructor [1].  Therefore, this class
>> should set the NumberOfRequiredInputs to 2, and call this->SetInput( 0, fi
>> ) in SetFixedImage, and similar in SetMovingImage.
>>
>> Hope this helps,
>> Matt
>>
>> [1]
>> http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Core/Common/include/itkImageToImageFilter.hxx;h=59f44fac45bd22be1a362584466ae593be1e602b;hb=HEAD#l44
>>
>>
>>
>>
>> On Thu, Feb 13, 2014 at 3:39 PM, Thibault Lucidarme <
>> thibault.lucidarme at gmail.com> wrote:
>>
>>> Here is a link to the public gist:
>>> https://gist.github.com/anonymous/8983351
>>>
>>> Thank you for your help
>>>
>>>
>>> 2014-02-13 14:25 GMT-06:00 Matt McCormick <matt.mccormick at kitware.com>:
>>>
>>> Hi Thibault,
>>>>
>>>> Yes, a self-contained, buildable set of code may be the only way to
>>>> understand what is happening.  Github Gists [1] work well for this.
>>>>
>>>> Thanks,
>>>>  Matt
>>>>
>>>> [1] https://gist.github.com/
>>>>
>>>>
>>>> On Thu, Feb 13, 2014 at 2:23 PM, Thibault Lucidarme <
>>>> thibault.lucidarme at gmail.com> wrote:
>>>>
>>>>> Dear ITK Community,
>>>>> I am trying ITK for the first time to perform a simple registration on
>>>>> 3D data on a mac.
>>>>> Using various tutorials found online I came to write a simple
>>>>> registration composite filter.
>>>>> However when I launch the filter (registration->Update() ), the
>>>>> process stops with the error:
>>>>>
>>>>> libc++abi.dylib: terminate called throwing an exception. Abort trap: 6
>>>>>
>>>>> Here is the backtrace
>>>>>
>>>>> #8  0x00000001000f3b57 in itk::ProcessObject::VerifyPreconditions ()
>>>>>
>>>>> #9  0x00000001000f4248 in itk::ProcessObject::UpdateOutputInformation
>>>>> ()
>>>>>
>>>>> #10 0x00000001000263a1 in itk::ImageBase<3u>::UpdateOutputInformation
>>>>> (this=0x101758dd0) at itkImageBase.hxx:234
>>>>>
>>>>> #11 0x00000001000fcd72 in itk::DataObject::Update ()
>>>>>
>>>>> #12 0x000000010001b1b9 in main (argc=1, argv=0x7fff5fbffb68) at
>>>>> [...]/src/main.cpp:126 (this is the registration->Update line)
>>>>>
>>>>> Google hasn't helped.
>>>>> I do not think the problems comes from the library build or the
>>>>> structure of my GenerateData (I have already tested a composited enhanced
>>>>> watershed filter and it works fine). But I am running out of ideas as to
>>>>> how to solve this issue.
>>>>>
>>>>> Do you want me to provide the code for the filter?
>>>>>
>>>>> Thank you very much in advance for your help.
>>>>>
>>>>> Sincerely
>>>>>
>>>>> --
>>>>>
>>>>> Thibault Lucidarme
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Community mailing list
>>>>> Community at itk.org
>>>>> http://public.kitware.com/cgi-bin/mailman/listinfo/community
>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>>
>>> Thibault
>>>
>>>
>>
>
>
> --
>
> Thibault
>
>


-- 

Thibault
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20140217/686134a5/attachment-0002.html>


More information about the Community mailing list