[Insight-users] writing debug images to see the evolution of a level set

Juan Cardelino juan.cardelino at gmail.com
Tue May 25 09:50:12 EDT 2010


I have a rather generic question: I'm using
GeodesicActiveContourShapePriorLevelSetImageFilter.cxx to run some
examples of segmentation, but my question applies for most of level
sets methods. As the evolutions are usually slow, I'm used to save the
distance function at some key-frames, lets say 1 time each 10
iterations. I've seen the usage of itk:Command on
GeodesicActiveContourShapePriorLevelSetImageFilter.cxx and I've tried
to add my code there. For the most part it compiles, but this line
gives me an error "thresholder->SetInput(filter->GetOutput());". I
itk::Command is templated over the filter type and filter is declared
as const TFilter* filter; where TFilter is the template. I know the
problem lies around the const modifier, but I think I'm not good
enough at C++ to find out why. I hope you can give me some hints, the
code and errors are pasted below.
Thanks in advance.
Best Regards,
                      Juan

--------------------------------------------
CODE
--------------------------------------------
 WriterType::Pointer writer = WriterType::New();
char filename[64];
sprintf(filename,"debug.%04d.png",filter->GetElapsedIterations() );
writer->SetFileName(  filename);

ThresholdingFilterType::Pointer thresholder = ThresholdingFilterType::New();
							
thresholder->SetLowerThreshold( -1000.0 );
thresholder->SetUpperThreshold(     0.0 );

thresholder->SetOutsideValue(  0  );
thresholder->SetInsideValue(  255 );
thresholder->SetInput(filter->GetOutput());
writer->SetInput(thresholder->GetOutput());
writer->Update();

--------------------------------------------
ERROR
--------------------------------------------
[ 36%] Building CXX object
CMakeFiles/GeodesicActiveContourShapePriorLevelSetImageFilterOrig.dir/GeodesicActiveContourShapePriorLevelSetImageFilterOrig.o
/home/juan/juanc/develop/misc_projects/examples/itk/shape/GeodesicActiveContourShapePriorLevelSetImageFilterOrig.cxx:
In function ‘int main(int, char**)’:
/home/juan/juanc/develop/misc_projects/examples/itk/shape/GeodesicActiveContourShapePriorLevelSetImageFilterOrig.cxx:777:
error: no matching function for call to
‘itk::PCAShapeSignedDistanceFunction<double, 2u, itk::Image<float, 2u>
>::SetTransform(itk::SmartPointer<itk::Euler2DTransform<double> >&)’
/home/juan/juanc/develop/misc_projects/examples/itk/shape/itkPCAShapeSignedDistanceFunction.h:160:
note: candidates are: void
itk::PCAShapeSignedDistanceFunction<TCoordRep, VSpaceDimension,
TImage>::SetTransform(itk::AffineTransform<typename
itk::ShapeSignedDistanceFunction<TCoordRep,
VSpaceDimension>::CoordRepType,
itk::PCAShapeSignedDistanceFunction<TCoordRep, VSpaceDimension,
TImage>::SpaceDimension>*) [with TCoordRep = double, unsigned int
VSpaceDimension = 2u, TImage = itk::Image<float, 2u>]
/home/juan/juanc/develop/misc_projects/examples/itk/shape/GeodesicActiveContourShapePriorLevelSetImageFilterOrig.cxx:
In member function ‘void
CommandIterationUpdate<TFilter>::Execute(const itk::Object*, const
itk::EventObject&) [with TFilter =
itk::GeodesicActiveContourShapePriorLevelSetImageFilter<itk::Image<float,
2u>, itk::Image<float, 2u>, float>]’:
/home/juan/juanc/develop/misc_projects/examples/itk/shape/GeodesicActiveContourShapePriorLevelSetImageFilterOrig.cxx:1164:
  instantiated from here
/home/juan/juanc/develop/misc_projects/examples/itk/shape/GeodesicActiveContourShapePriorLevelSetImageFilterOrig.cxx:207:
error: passing ‘const
itk::GeodesicActiveContourShapePriorLevelSetImageFilter<itk::Image<float,
2u>, itk::Image<float, 2u>, float>’ as ‘this’ argument of
‘TOutputImage* itk::ImageSource<TOutputImage>::GetOutput() [with
TOutputImage = itk::Image<float, 2u>]’ discards qualifiers
make[2]: *** [CMakeFiles/GeodesicActiveContourShapePriorLevelSetImageFilterOrig.dir/GeodesicActiveContourShapePriorLevelSetImageFilterOrig.o]
Error 1
make[1]: *** [CMakeFiles/GeodesicActiveContourShapePriorLevelSetImageFilterOrig.dir/all]
Error 2
make: *** [all] Error 2


More information about the Insight-users mailing list