Error ->>> ImageToVectorImageFilter + ImageToListAdaptor

View: New views
1 Messages — Rating Filter:   Alert me  

Error ->>> ImageToVectorImageFilter + ImageToListAdaptor

by Ricardo Ferrari-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Luis,

I am trying to use the two following itk classes to get Vector Samples into an Gaussian Mixture Model classifier. Although, I am following your suggestion (please see  http://www.cmake.org/pipermail/insight-users/2007-April/022003.html ) I am still getting an error.

I really appreciate if you could help on this.

Thanks,
Ricardo



#include "io.h"
#include "itkImageToVectorImageFilter.h"
#include "itkScalarToArrayCastImageFilter.h"
#include "itkImageToListAdaptor.h"

/// Pixel type definition
typedef signed short                                                                  TInputPixelType;

/// Define type of the input and output images
typedef itk::Image< TInputPixelType, Dimension >              TInputImageType;


///
/// Main function
///
int main( int argc, char **argv )
{
    // Read a minc image
    TInputImageType::Pointer img = ReadMincImage< TInputImageType >( "test.mnc" );

    typedef itk::ImageToVectorImageFilter< TInputImageType > ImageToVectorImageFilterType;
    ImageToVectorImageFilterType::Pointer vectorImage = ImageToVectorImageFilterType::New();
    vectorImage->SetNthInput( 0, img );
    vectorImage->Update();

    typedef itk::Statistics::ImageToListAdaptor< ImageToVectorImageFilterType::OutputImageType > ImageToListAdaptorType;
    ImageToListAdaptorType::Pointer adaptor = ImageToListAdaptorType::New();
    adaptor->SetImage( vectorImage->GetOutput() );

    return 0;
}

 
[100%] Building CXX object segmentation/gmm/CMakeFiles/gmm_classifier.dir/main.cpp.o
In file included from /usr/local/include/InsightToolkit/Common/itkConceptChecking.h:23,
                 from /usr/local/include/InsightToolkit/Common/itkImageHelper.h:20,
                 from /usr/local/include/InsightToolkit/Common/itkImageBase.h:35,
                 from /usr/local/include/InsightToolkit/Common/itkImage.h:20,
                 from /home/ferrari/Workspace/MIP_PROJECTS/trunk/io/io.h:6,
                 from /home/ferrari/Workspace/MIP_PROJECTS/trunk/segmentation/gmm/main.cpp:2:
/usr/local/include/InsightToolkit/Common/itkPixelTraits.h: In instantiation of ‘itk::PixelTraits<itk::VariableLengthVector<short int> >’:
/usr/local/include/InsightToolkit/Numerics/Statistics/itkImageToListAdaptor.h:97:   instantiated from ‘itk::Statistics::ImageToListAdaptor<itk::VectorImage<short int, 3u>, itk::VariableLengthVector<short int> >’
/home/ferrari/Workspace/MIP_PROJECTS/trunk/segmentation/gmm/main.cpp:51:   instantiated from here
/usr/local/include/InsightToolkit/Common/itkPixelTraits.h:41: error: ‘Length’ is not a member of ‘itk::VariableLengthVector<short int>’
In file included from /home/ferrari/Workspace/MIP_PROJECTS/trunk/segmentation/gmm/main.cpp:8:
/usr/local/include/InsightToolkit/Numerics/Statistics/itkImageToListAdaptor.h: In member function ‘const TMeasurementVector& itk::Statistics::ImageToListAdaptor<TImage, TMeasurementVector>::GetMeasurementVector(const typename TImage::PixelContainer::ElementIdentifier&) const [with TImage = itk::VectorImage<short int, 3u>, TMeasurementVector = itk::VariableLengthVector<short int>]’:
/home/ferrari/Workspace/MIP_PROJECTS/trunk/segmentation/gmm/main.cpp:56:   instantiated from here
/usr/local/include/InsightToolkit/Numerics/Statistics/itkImageToListAdaptor.h:323: warning: taking address of temporary
/usr/local/include/InsightToolkit/Numerics/Statistics/itkImageToListAdaptor.h:323: warning: returning reference to temporary
make[2]: *** [segmentation/gmm/CMakeFiles/gmm_classifier.dir/main.cpp.o] Error 1
make[1]: *** [segmentation/gmm/CMakeFiles/gmm_classifier.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