[Insight-users] itkImageMaskSpatialObject segmentation fault

Paolo Zaffino p.zaffino at yahoo.it
Fri Jun 28 17:26:36 EDT 2013


It is a compiler issue.
I compiled in release mode ITK and the test code using gcc 4.3 and it 
works fine.
The problem seems raises with gcc 4.8 and 4.7

Thanks a lot.
Paolo



On 28/06/2013 13:14, Bill Lorensen wrote:
> I tried your code on both itkv3 and itkv4. With my own data, they both 
> ran.
>
> What data format are you using?
>
>
>
> On Fri, Jun 28, 2013 at 11:38 AM, Paolo Zaffino <p.zaffino at yahoo.it 
> <mailto:p.zaffino at yahoo.it>> wrote:
>
>     Hi,
>     this is the output:
>
>     Image (0x2a2cdf0)
>       RTTI typeinfo:   itk::Image<unsigned char, 3u>
>       Reference Count: 1
>       Modified Time: 193
>       Debug: Off
>       Observers:
>         none
>       Source: (0x2a28a10)
>       Source output index: 0
>       Release Data: Off
>       Data Released: False
>       Global Release Data: Off
>       PipelineMTime: 10
>       UpdateMTime: 194
>       LargestPossibleRegion:
>         Dimension: 3
>         Index: [0, 0, 0]
>         Size: [512, 512, 89]
>       BufferedRegion:
>         Dimension: 3
>         Index: [0, 0, 0]
>         Size: [512, 512, 89]
>       RequestedRegion:
>         Dimension: 3
>         Index: [0, 0, 0]
>         Size: [512, 512, 89]
>       Spacing: [0.539, 0.539, 2.5]
>       Origin: [0, 0, 0]
>       Direction:
>     1 0 0
>     0 1 0
>     0 0 1
>
>       IndexToPointMatrix:
>       0.539 0 0
>     0 0.539 0
>     0 0 2.5
>
>       PointToIndexMatrix:
>       1.85529 0 0
>     0 1.85529 0
>     0 0 0.4
>
>       PixelContainer:
>         ImportImageContainer (0x2a2d050)
>           RTTI typeinfo: itk::ImportImageContainer<unsigned long,
>     unsigned char>
>           Reference Count: 1
>           Modified Time: 192
>           Debug: Off
>           Observers:
>             none
>           Pointer: 0x7f5cf3736010
>           Container manages memory: true
>           Size: 23330816
>           Capacity: 23330816
>
>
>     Thanks.
>     Paolo
>
>
>
>
>     On 28/06/2013 11:02, Bill Lorensen wrote:
>>     After reader->Update()
>>
>>     put
>>     reader->GetOutput()->Print(std::cout);
>>     to see the read image.
>>
>>
>>     On Thu, Jun 27, 2013 at 9:16 PM, Paolo Zaffino
>>     <p.zaffino at yahoo.it <mailto:p.zaffino at yahoo.it>> wrote:
>>
>>         Hi,
>>         The strange thing is that in debug mode (both ITK that my
>>         code) it works fine.
>>
>>
>>         ------------------------------------------------------------------------
>>         *From: * Bradley Lowekamp <blowekamp at mail.nih.gov
>>         <mailto:blowekamp at mail.nih.gov>>;
>>         *To: * Paolo Zaffino <p.zaffino at yahoo.it
>>         <mailto:p.zaffino at yahoo.it>>;
>>         *Cc: * Bill Lorensen <bill.lorensen at gmail.com
>>         <mailto:bill.lorensen at gmail.com>>; insight-users at itk.org
>>         <mailto:insight-users at itk.org> <insight-users at itk.org
>>         <mailto:insight-users at itk.org>>;
>>         *Subject: * Re: [Insight-users] itkImageMaskSpatialObject
>>         segmentation fault
>>         *Sent: * Thu, Jun 27, 2013 11:17:06 PM
>>
>>         Hello,
>>
>>         I don't see anything obviously wrong with your code, but I
>>         haven't recently used that class myself.
>>
>>         Do you know how to run the program in  gdb to determine where
>>         the segfault is happening? A stack trace is quite useful for
>>         tracking down this type of error.
>>
>>         Brad
>>
>>         On Jun 27, 2013, at 1:43 PM, Paolo Zaffino
>>         <p.zaffino at yahoo.it> wrote:
>>
>>>         The problem is not in the reader->Update() but in
>>>         mask->SetImage(reader->GetOutput());
>>>
>>>         Until this row it is ok.
>>>
>>>
>>>
>>>
>>>         On 27/06/2013 16:37, Bill Lorensen wrote:
>>>>         You should put a try/catch around reader->Update(). It may
>>>>         provide for information.
>>>>
>>>>         http://itk.org/Wiki/ITK/Examples/SimpleOperations/TryCatch
>>>>
>>>>
>>>>
>>>>         On Thu, Jun 27, 2013 at 4:25 PM, Paolo Zaffino
>>>>         <p.zaffino at yahoo.it> wrote:
>>>>
>>>>             Dear ITK community,
>>>>             I'm facing a strange ITK behavior.
>>>>             I wrote this code:
>>>>
>>>>             #include "itkImage.h"
>>>>             #include "itkImageFileReader.h"
>>>>             #include "itkImageMaskSpatialObject.h"
>>>>
>>>>             int main( int argc, char **argv )
>>>>             {
>>>>               typedef itk::Image<unsigned char,3> ImageType;
>>>>               typedef itk::ImageFileReader<ImageType> ReaderType;
>>>>
>>>>               typedef itk::ImageMaskSpatialObject<3> MaskImageType;
>>>>               typedef MaskImageType::Pointer MaskTypePointer;
>>>>
>>>>             ReaderType::Pointer reader = ReaderType::New();
>>>>
>>>>             reader->SetFileName( argv[1] );
>>>>             reader->Update();
>>>>
>>>>             MaskTypePointer mask = MaskImageType::New();
>>>>             mask->SetImage(reader->GetOutput());
>>>>
>>>>               return 0;
>>>>             }
>>>>
>>>>             and it compiles without error.
>>>>             When I try to run the executable I get a segmentation
>>>>             error (core dumped).
>>>>             What's is wrong?
>>>>             I'm using ITK 3.20.1 on a 64 bit Linux box.
>>>>             If needed I can provide the mask image.
>>>>
>>>>             Thanks a lot for your help.
>>>>             Best regards.
>>>>             Paolo
>>>>             _____________________________________
>>>>             Powered by www.kitware.com <http://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.php
>>>>
>>>>             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
>>>>
>>>>
>>>>
>>>>
>>>>         -- 
>>>>         Unpaid intern in BillsBasement at noware dot com
>>>
>>>         _____________________________________
>>>         Powered by www.kitware.com <http://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.php
>>>
>>>         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
>>
>>
>>
>>
>>     -- 
>>     Unpaid intern in BillsBasement at noware dot com
>
>
>
>
> -- 
> Unpaid intern in BillsBasement at noware dot com

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


More information about the Insight-users mailing list