[Insight-users] how to template the image dimension or vector dimesion in template function
Baoyun Li
baoyun_li123 at yahoo.com
Wed Mar 18 17:00:30 EDT 2009
Dear Andreas and all:
Can you please teach me how to template the image dimension or vector dimesion in template function.
In the following template function, if I give the vector dimension as
typedef typename itk::Vector< double,NumberOfComponents> MeasurementVectorType;
where Numberof compoents is obtained as trait
const unsigned int NumberOfComponents=VectorPixelType::GetVectorDimension();
The program cannot be build.
Why and how to solve the problem?
Thanks
Baoyun
template <unsigned int Dim,unsigned int NumberOfComponents1,class TInputFilter, class TOutputFilter>
void EMClustering( typename TInputFilter::Pointer& inputfilter, typename TOutputFilter::Pointer& outputfilter)
{
typedef typename TInputFilter::PixelType VectorPixelType;
typedef typename TInputFilter::PixelType::SizeType Num;
const unsigned int NumberOfComponents=VectorPixelType::GetVectorDimension();
const unsigned int Dim1=TInputFilter::GetImageDimension();
typedef typename itk::Vector< double,NumberOfComponents> MeasurementVectorType;
typedef typename itk::Statistics::ListSample< MeasurementVectorType > SampleType;
// SampleType::Pointer sample = SampleType::New();
// sample->SetMeasurementVectorSize(NumberOfComponents );
// MeasurementVectorType mv;
};
ml>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090318/2b4e2739/attachment-0001.htm>
More information about the Insight-users
mailing list