[Insight-developers] Statistics Refactoring : A few problems
Kris Thielemans
kris.thielemans at csc.mrc.ac.uk
Thu Jul 21 17:02:35 EDT 2005
Hi Karthik
I really am not familiar with ITK yet, and definitely not with what
you're trying to do. So I'll probably miss the ball completely. I
apologise in advance.
Reading the WIKI I see
--------
MeasurementVectorTraits< MeasurementVectorType >::GetSize()
This returns the length of MeasurementVectorType, which will be the
true length of a FixedArray, Vector, vnl_vector_fixed, Point etc and 0
otherwise
-------
This is a bit different from what you said in the email
> I need something like:
>
> template<class TValueType, unsigned int TLength> class
> MeasurementVectorTraits<FixedArray<TValueType, TLength > > {
> public:
> itkStaticConstMacro( MeasurementVectorLength, unsigned int,
> TLength ); .......
> }
>
I wonder though about a few things:
- how useful is it to have a GetSize (or MeasurementVectorLength) that's
wrong for variable length arrays? Won't you then have to write code that
treats variable length arrays differently anyway?
- is your probably not solvable by not using traits, but by using
function overloading:
template<class TValueType, unsigned int TLength>
unsigned GetSize(FixedArray<TValueType, Tlength)
{ return Tlength; }
// and so on for other types of fixed arrays and indeed variable
length
VC6.0 can usually handle such function overloads (although not always,
and don't ask me when it can't).
Of course, the above function approach does not work for compile time
constants.
Kris Thielemans
Hammersmith Imanet Ltd, part of GE Healthcare
Du Cane Road
London W12 0NN
UK
http://www.HammersmithImanet.com/~kris
More information about the Insight-developers
mailing list