[Insight-users] SliceBySliceImageFilter with ScalarImageKMeansImageFilter

Kishore Mosaliganti kishoreraom at gmail.com
Fri Nov 20 10:00:35 EST 2009


Hi Samuele,

Your k-means filter does not have the right ImageType defined in its
template. From what I see, you want it to run k-means on 2D slices but
you are providing a 3D k-means filter. Can you replace with the 2D
typedef as follows:

typedef itk::Image<PixelType, 2 > SliceImageType;
itk::ScalarImageKmeansImageFilter< SliceImageType > KMeansFilterType;


Kishore



On Fri, Nov 20, 2009 at 8:29 AM, Samuele Dietler <samuele_82 at hotmail.com> wrote:
> Hello Itk users,
> i try to run the SliceBySliceImageFilter but i don't understand how it work.
> I have look at the pdf publication in the midas journal with examples and in
> the forum without success.
> I have a compile problem , when i try to compile it with the
> ScalaImageKmeansImageFilter ( i want to run slice by slice because i have a
> ram problem otherwise).
> I will show you a part of the code where is implemented it and the error
> reported in vs2008.
>
>
> ...
> const char * inputImageFileName = argv[1];
>
> typedef float PixelType;
> const unsigned int Dimension = 3;
>
> typedef itk::Image<PixelType, Dimension > ImageType;
> typedef itk::ImageFileReader< ImageType > ReaderType;
>
> ReaderType::Pointer reader = ReaderType::New();
> reader->SetFileName( inputImageFileName );
>
> typedef itk::SliceBySliceImageFilter< ImageType, ImageType> FilterType;
> FilterType::Pointer filter = FilterType::New();
> filter->SetInput(reader->GetOutput());
>
> typedef
> itk::ScalarImageKmeansImageFilter<FilterType::InternalInputImageType>
> KMeansFilterType;
> KMeansFilterType::Pointer kmeansFilter = KMeansFilterType::New();
>
> filter->SetFilter(kmeansFilter);
>
> const unsigned int numberOfInitialClasses = atoi( argv[4] );
>
>
> ...
>
>
> The error is :
>
>
> skin.cxx
> 2>..\skin\skin.cxx(47) : error C2664:
> 'itk::SliceBySliceImageFilter<TInputImage,TOutputImage>::SetFilter' : cannot
> convert parameter 1 from 'itk::SmartPointer<TObjectType>' to
> 'itk::ImageToImageFilter<TInputImage,TOutputImage> *'
> 2> with
> 2> [
> 2> TInputImage=ImageType,
> 2> TOutputImage=ImageType
> 2> ]
> 2> and
> 2> [
> 2> TObjectType=itk::ScalarImageKmeansImageFilter<itk::Image<float,2>>
> 2> ]
> 2> and
> 2> [
> 2> TInputImage=itk::Image<float,2>,
> 2> TOutputImage=itk::Image<float,2>
> 2> ]
> 2> No user-defined-conversion operator available that can perform this
> conversion, or the operator cannot be called
>
>
>
> Does anyone can solve this problem??
> Thank you, best
> Samuele
>
> ________________________________
> Windows Live: tieni aggiornati i tuoi amici sulle tue attività in linea.
> _____________________________________
> 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