[Insight-developers] possible tcon topics
Miller, James V (CRD)
millerjv@crd.ge.com
Fri, 27 Oct 2000 07:35:27 -0400
The solution (currently) is to not use template specialization but rather put a "switch" or "if"
statement in your GenerateData() method that calls the appropriate "specialized" routine. While this
is a run-time specialization, it is called once per execution of the filter. I suspect the compiler
will optimize out the "other" cases if the switches are all based on template parameters and
typedefs.
This switch could either switch on dimension, or even switch on pixel type using the "typeid"
function. For the later, I think the syntax is something like
if (typeid(typename TPixel::ValueType) == typeid(unsigned short))
...
-----Original Message-----
From: Damion Shelton [mailto:dmsst59+@pitt.edu]
Sent: Thursday, October 26, 2000 3:09 PM
To: Insight-Developers
Subject: Re: [Insight-developers] possible tcon topics
This is definitely an important issue...
I've run into cases (and I'm relatively new to ITK) where I'd like to
restrict classes to 2 or 3D. So far I've coded under the assumption that the
user understands the intended dimensionality of the class/algorithm and
defines the template correctly, but this is a relatively dangerous way to
program.
-Damion-
/-----------------------------------------------\
Damion Shelton
University of Pittsburgh
Department of Bioengineering
dmsst59@pitt.edu
412-624-9931
\-----------------------------------------------/
> I would be interested to hear any thoughts on alternative ways to do
> partial template specialization during the tcon. For many algorithms it
> makes sense to specialize for 2 and 3 dimensions while leaving the pixel
> type undefined.
>
> Josh.
>
> +--+--+--+--+--+--+--+--+--+--+--+--
> Josh Cates
> Department of Computer Science
> University of Utah
> Email: cates@cs.utah.edu
> Phone: (801) 587-7697
> URL: www.cs.utk.edu/~cates
> --+--+--+--+--+--+--+--+--+--+--+--->
_______________________________________________
Insight-developers mailing list
Insight-developers@public.kitware.com
http://public.kitware.com/mailman/listinfo/insight-developers