[Insight-users] ITK Setup problem? Error when filter updates

Bill Lorensen bill.lorensen at gmail.com
Mon Sep 28 11:37:42 EDT 2009


I just cut and pasted your code into a cxx program and it works fine
for me. In your example, the image is allocated, but is not
initialized with any values. This should not cause a seg fault
however.

What version of itk? What platform? Did you build itk?

Bill

On Mon, Sep 28, 2009 at 8:02 AM, Orcalle <calle.hakansson at orzone.se> wrote:
>
> I've used VTK for some visualizations of processed medical volumes, and now I
> want to transfer my medical algorithms from C++/Matlab to ITK.
> My problem is that whenever I Update() a filter in ITK, there is an error.
>
> This is example code do demonstrate the error:
>
>    typedef itk::Image<unsigned short, 3> TestImageType;
>    typedef itk::BinaryThresholdImageFilter<TestImageType, TestImageType>
> ThresholdType;
>
>    TestImageType::Pointer testImage = TestImageType::New();
>    TestImageType::SizeType testSize;
>    testSize[0] = 10;
>    testSize[1] = 11;
>    testSize[2] = 12;
>    TestImageType::IndexType testIndex;
>    testIndex[0] = 0;
>    testIndex[1] = 0;
>    testIndex[2] = 0;
>
>    TestImageType::RegionType testRegion;
>    testRegion.SetSize(testSize);
>    testRegion.SetIndex(testIndex);
>
>    testImage->SetRegions(testRegion);
>    testImage->Allocate();
>    testImage->Update();
>
>    ThresholdType::Pointer thresholdfilter = ThresholdType::New();
>    thresholdfilter->SetInput(testImage);
>    thresholdfilter->SetLowerThreshold(10);
>    thresholdfilter->SetUpperThreshold(101);
>    thresholdfilter->Update();
>
>
>
> The error occurs at the last line: thresholdfilter->Update();
>
>
>
> this is where my debugger says the error is [itkImageBase.txx]:
>
> template<unsigned int VImageDimension>
> void
> ImageBase<VImageDimension>
> ::UpdateOutputInformation()
> {
>  if( this->GetSource() )
>    {
>    this->GetSource()->UpdateOutputInformation(); <-------------------------
>    }
>  else
>    {...................
>
>
> this is what the error message looks like:
> Unhandled exception at 0x57cecd9c (ITKCommon.dll) in ITKVTKQTTest.exe:
> 0xC0000005: Access violation writing location 0xabababeb.
>
>
>
>
> What is wrong here??
> --
> View this message in context: http://www.nabble.com/ITK-Setup-problem--Error-when-filter-updates-tp25644457p25644457.html
> Sent from the ITK - Users mailing list archive at Nabble.com.
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.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
>


More information about the Insight-users mailing list