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

Luis Ibanez luis.ibanez at kitware.com
Wed May 26 13:00:44 EDT 2010


Hi Juan,


A)  The error in

>>::SetTransform(itk::SmartPointer<itk::Euler2DTransform<double> >&)’

says that the function is expecting:

> TImage>::SetTransform(itk::AffineTransform<typename

   That is, that you should use an AffineTransform instead of an
Euler2DTransform.


B) The error in

> error: passing ‘const
> TOutputImage = itk::Image<float, 2u>]’ discards qualifiers


Means that you are attempting to call a non-const method from the
Execute() method of the Command observer where the observed
class is supposed to be const.

You should move that code to the non-const version of Execute().


    Regards,


          Luis


----------------------------------------------------
On Tue, May 25, 2010 at 9:50 AM, Juan Cardelino
<juan.cardelino at gmail.com> wrote:
> 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
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>


More information about the Insight-users mailing list