Hi Luis,<br><br>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 <a href="http://www.cmake.org/pipermail/insight-users/2007-April/022003.html">http://www.cmake.org/pipermail/insight-users/2007-April/022003.html</a> ) I am still getting an error. <br>
<br>I really appreciate if you could help on this.<br><br>Thanks,<br>Ricardo<br><br><br><br>#include "io.h"<br>#include "itkImageToVectorImageFilter.h"<br>#include "itkScalarToArrayCastImageFilter.h"<br>
#include "itkImageToListAdaptor.h"<br><br>/// Pixel type definition<br>typedef signed short TInputPixelType;<br><br>/// Define type of the input and output images<br>
typedef itk::Image< TInputPixelType, Dimension > TInputImageType;<br><br><br>///<br>/// Main function<br>///<br>int main( int argc, char **argv )<br>{<br> // Read a minc image <br> TInputImageType::Pointer img = ReadMincImage< TInputImageType >( "test.mnc" );<br>
<br> typedef itk::ImageToVectorImageFilter< TInputImageType > ImageToVectorImageFilterType;<br> ImageToVectorImageFilterType::Pointer vectorImage = ImageToVectorImageFilterType::New();<br> vectorImage->SetNthInput( 0, img );<br>
vectorImage->Update();<br><br> typedef itk::Statistics::ImageToListAdaptor< ImageToVectorImageFilterType::OutputImageType > ImageToListAdaptorType;<br> ImageToListAdaptorType::Pointer adaptor = ImageToListAdaptorType::New();<br>
adaptor->SetImage( vectorImage->GetOutput() );<br><br> return 0;<br>}<br><br> <br>[100%] Building CXX object segmentation/gmm/CMakeFiles/gmm_classifier.dir/main.cpp.o<br>In file included from /usr/local/include/InsightToolkit/Common/itkConceptChecking.h:23,<br>
from /usr/local/include/InsightToolkit/Common/itkImageHelper.h:20,<br> from /usr/local/include/InsightToolkit/Common/itkImageBase.h:35,<br> from /usr/local/include/InsightToolkit/Common/itkImage.h:20,<br>
from /home/ferrari/Workspace/MIP_PROJECTS/trunk/io/io.h:6,<br> from /home/ferrari/Workspace/MIP_PROJECTS/trunk/segmentation/gmm/main.cpp:2:<br>/usr/local/include/InsightToolkit/Common/itkPixelTraits.h: In instantiation of ‘itk::PixelTraits<itk::VariableLengthVector<short int> >’:<br>
/usr/local/include/InsightToolkit/Numerics/Statistics/itkImageToListAdaptor.h:97: instantiated from ‘itk::Statistics::ImageToListAdaptor<itk::VectorImage<short int, 3u>, itk::VariableLengthVector<short int> >’<br>
/home/ferrari/Workspace/MIP_PROJECTS/trunk/segmentation/gmm/main.cpp:51: instantiated from here<br>/usr/local/include/InsightToolkit/Common/itkPixelTraits.h:41: error: ‘Length’ is not a member of ‘itk::VariableLengthVector<short int>’<br>
In file included from /home/ferrari/Workspace/MIP_PROJECTS/trunk/segmentation/gmm/main.cpp:8:<br>/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>]’:<br>
/home/ferrari/Workspace/MIP_PROJECTS/trunk/segmentation/gmm/main.cpp:56: instantiated from here<br>/usr/local/include/InsightToolkit/Numerics/Statistics/itkImageToListAdaptor.h:323: warning: taking address of temporary<br>
/usr/local/include/InsightToolkit/Numerics/Statistics/itkImageToListAdaptor.h:323: warning: returning reference to temporary<br>make[2]: *** [segmentation/gmm/CMakeFiles/gmm_classifier.dir/main.cpp.o] Error 1<br>make[1]: *** [segmentation/gmm/CMakeFiles/gmm_classifier.dir/all] Error 2<br>
make: *** [all] Error 2<br><br><br><br><br><br>