[Insight-users] filter Update() segfault...

Miller, James V (GE, Research) millerjv at crd.ge.com
Thu Mar 9 15:05:59 EST 2006


What is the return type of your function?

The output of the grayscaleDilate will be deleted when you return from
your routine unless it is cached in a smartpointer. Since your routine
(implicitly) allocated the image that you returning, the return
type of your function should be a SmartPointer.

Jim



-----Original Message-----
From: insight-users-bounces+millerjv=crd.ge.com at itk.org
[mailto:insight-users-bounces+millerjv=crd.ge.com at itk.org]On Behalf Of
stephane barranx
Sent: Thursday, March 09, 2006 11:10 AM
To: insight-users at itk.org
Subject: [Insight-users] filter Update() segfault...



Hi, can anybody explain to me why this code (typedefs are not included
because it's not the problem..):

////////////
  DilateFilterType::Pointer grayscaleDilate = DilateFilterType::New();
  
  StructuringElementType  structuringElement;
  structuringElement.SetRadius( radiusX );  // 6x6 structuring element
  structuringElement.CreateStructuringElement();
  grayscaleDilate->SetKernel( structuringElement );
  grayscaleDilate->SetInput( data );

  try {
    grayscaleDilate->Update();
  }catch( itk::ExceptionObject & excep ) {
    cerr << "Exception caught !" << endl;
    cerr << excep << endl;
  }
  
  return grayscaleDilate->GetOutput();

///////////

make a segmentation fault while the same code works in a bigger function
where it is used as a step. The only difference is the Update() that is done
to the last step filter in the big function.

please help!
--
View this message in context: http://www.nabble.com/filter-Update%28%29-segfault...-t1253691.html#a3322705
Sent from the ITK - Users forum at Nabble.com.

_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users


More information about the Insight-users mailing list