[Insight-users] output of intermediate images from level set segmentation

P K xtalswing at yahoo.com
Tue Feb 1 16:39:21 EST 2005


I'm trying to visualize intermediate images from
segmentation via the
GeodesicActiveContourLevelSetImageFilter.  Using the
post last July by Luis
(http://www.itk.org/pipermail/insight-users/2004-July/009289.html
) as a guide, I attempted to grab the image using the
GetOutput() method.  However, I get a compiler error
because it seems GetOutput() wants a non-const 'this'
argument.

Can anyone offer advice on how to do this correctly?
Thanks!

Compiler message and code snippet follow:

makesurf_vis.cpp:86: passing `const 
  
itk::GeodesicActiveContourLevelSetImageFilter<InternalImageType,

   InternalImageType, float>' as `this' argument of
`TOutputImage* 
   itk::ImageSource<TOutputImage>::GetOutput() [with
TOutputImage = 
   itk::Image<InternalPixelType, 3>]' discards
qualifiers

class CommandIterationUpdate : public itk::Command 
{
public:
  typedef  CommandIterationUpdate   Self;
  typedef  itk::Command             Superclass;
  typedef  itk::SmartPointer<Self>  Pointer;
  itkNewMacro( Self );
protected:
  CommandIterationUpdate() {};
  void writeimage(InternalImageType::Pointer img, int
itnum);
  void duplicateimage(const InternalImageType::Pointer
src, InternalImageType::Pointer &target);
public:
  typedef 
itk::GeodesicActiveContourLevelSetImageFilter<
InternalImageType, InternalImageType >    FilterType;

  void Execute(itk::Object *caller, const
itk::EventObject & event)
    {
      Execute( (const itk::Object *)caller, event);
    }

  void Execute(const itk::Object * object, const
itk::EventObject & event)
    {
     const FilterType *
activecontour=dynamic_cast<const FilterType
*>(object);

      if( typeid( event ) != typeid(
itk::IterationEvent ) )
        {
        return;
        }
      std::cout <<
activecontour->GetElapsedIterations()<< "   ";
	if ((activecontour->GetElapsedIterations() % 10)==1)
	{
	//handle image output

	InternalImageType::Pointer
srcimg=activecontour->GetOutput();
	InternalImageType::Pointer img;

	//duplicate image via iterators
	duplicateimage(srcimg,img);
		
	//write image
	writeimage(img,activecontour->GetElapsedIterations()
);
	}
    }
};
 



		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses. 
http://promotions.yahoo.com/new_mail


More information about the Insight-users mailing list