[Insight-users] Typedef overloading on derived classes

Tim Allman dr.tim.allman at gmail.com
Tue Oct 29 10:54:24 EDT 2013


It's not entirely clear what you want to do but it sounds like you want 
to make a typedef which describes a partially specialised template class 
instead of the fully specialised typedefs we usually use.

Are you trying to do something like this?

template <unsigned Dimension>
typedef itk::Image<float, Dimension> FloatImageType<Dimension>;

C11 allows this with a rather strange syntax.

template <unsigned Dimension>
using FloatImageType = itk::Image<float, Dimension>;

To make an instance of a three dimensional float image:
FloatImageType<3> image;

I did this to make a partially specialised template to create fixed 
length arrays of length 4 to hold different types.

template <typename TValueType>
using ParamVector = itk::FixedArray<TValueType, 4>;

Tim

On 13-10-29 09:42 AM, Jose Ignacio Prieto wrote:
> Hi all,
> I have a object manager class that has to work with 3d and 4d itk 
> images. Then I was planning to have an abstract obj manager for the 
> common functions and derived classes om3d and om4d for the dimension 
> specific functions. My problem is how can I define an abstract 
>  typedef ImageType on base OM, then overloading it like typedef 
> itkImage(short, 3) ImageType on om3d and typedef itkImage(short, 4) 
> ImageType on om4d. That way my methods would have the same signature.
> Is this possible? Is it a wrong approach?
>
> Thank you very much
>
>
> -- 
> José Ignacio Prieto
> celular(nuevo): 94348182
>
>
> _____________________________________
> 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.php
>
> 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

-- 
Tim Allman, Ph.D.
35 Margaret Street,
Guelph Ontario N1E 5R6
Canada

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20131029/6fe265d4/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dr_tim_allman.vcf
Type: text/x-vcard
Size: 159 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20131029/6fe265d4/attachment.vcf>


More information about the Insight-users mailing list