[Insight-users] Crashes with native ITK in Managed C++

Young-Seok Kim ykim5forward at yahoo.com
Tue Sep 18 12:09:13 EDT 2007


Hello,
   
  I am trying to use native ITK (as opposed to ManagedITK) in Manged C++ of VS2005.
   - it compiles, links fine, but crashes when runs.
  It is from the simple code - creating and allocating an image (see below). 
  It actually crashes 'even before the program shows the window'.
  The error message is as following:
   
  Debug Assertion Failed!
  Program:...
File: dbgheap.c
Line: 1414
  Expression: _CrtIsValidHeapPointer(pUserData)
   
  It seems related to a 'bad' pointer - the comment on that file says that.
  I originally suspected that would because I created an image in a managed button event function (as shown below), but it is the same when I do that in a separate unmanaged class.
  Is there any option for this?
   
  Regards,
  Young.
   
   
  P.S.
  void Form1::btnOp_Add_Click(System::Object^ sender, System::EventArgs^ e)
  {
  Interface->SetOperation(ADD);
   
  // ITK Test
  typedef itk::Image<float> ImageType;
  ImageType::Pointer image = ImageType::New();
  ImageType::SizeType size;
  size[0] = 200; // size along X
  size[1] = 200; // size along Y
  size[2] = 200; // size along Z
  ImageType::RegionType region;
  region.SetSize( size );
  image->SetRegions( region );
  image->Allocate();
  }
   

       
---------------------------------
Don't let your dream ride pass you by.    Make it a reality with Yahoo! Autos. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070918/afafe89a/attachment.htm


More information about the Insight-users mailing list