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

Orcalle calle.hakansson at orzone.se
Mon Sep 28 08:02:18 EDT 2009


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.



More information about the Insight-users mailing list