<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><DIV>Dear Andreas and all:</DIV>
<DIV> </DIV>
<DIV>Can you please teach me how to template the image dimension or vector dimesion in template function.</DIV>
<DIV> </DIV>
<DIV>In the following template function, if I give the vector dimension as</DIV>
<DIV> </DIV>
<DIV>typedef typename itk::Vector< double,NumberOfComponents> MeasurementVectorType;<BR></DIV>
<DIV>where Numberof compoents is obtained as trait</DIV>
<DIV>const unsigned int NumberOfComponents=VectorPixelType::GetVectorDimension();</DIV>
<DIV> </DIV>
<DIV>The program cannot be build.</DIV>
<DIV> </DIV>
<DIV>Why and how to solve the problem?</DIV>
<DIV> </DIV>
<DIV>Thanks</DIV>
<DIV> </DIV>
<DIV>Baoyun<BR></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>template <unsigned int Dim,unsigned int NumberOfComponents1,class TInputFilter, class TOutputFilter><BR>void EMClustering( typename TInputFilter::Pointer& inputfilter, typename TOutputFilter::Pointer& outputfilter)<BR>{<BR> typedef typename TInputFilter::PixelType VectorPixelType;<BR> typedef typename TInputFilter::PixelType::SizeType Num;<BR> const unsigned int NumberOfComponents=VectorPixelType::GetVectorDimension();<BR> const unsigned int Dim1=TInputFilter::GetImageDimension();<BR> <BR> typedef typename itk::Vector< double,NumberOfComponents> MeasurementVectorType;<BR> typedef typename itk::Statistics::ListSample< MeasurementVectorType > SampleType;<BR> // SampleType::Pointer sample = SampleType::New();<BR> // sample->SetMeasurementVectorSize(NumberOfComponents );<BR> // MeasurementVectorType mv;<BR> </DIV>
<DIV>};</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">
<BLOCKQUOTE type="cite">
<DIV>ml></DIV></BLOCKQUOTE></DIV></DIV></div><br>
</body></html>