[Insight-developers] template depth limit

Lydia Ng lng@insightful.com
Thu, 28 Jun 2001 11:23:41 -0700


This is a multi-part message in MIME format.

------=_NextPart_000_0006_01C0FFC4.C953F750
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit


Attached is the error message I got from Cygwin-gcc -
I have summarized it below.
Basically the complilation fails because it takes more
than 17 "steps" to instantiated the vnl_vector used to
represent the quaternion inside the registration.

It looks to me whenever you ::New() an object that counts as two
one for the function New() and one for the constructor.
Is that correct?

The statistics are:
 2 levels are taken by my multi-resolution extension
12 levels are taken by the registration framework
 3 (+ 1) levels are taken up just to represent the quaternion

 4 levels are taken up because of New()

Given that 4 levels are taken by the quaternion and
New() takes up two levels - you can easily hit the 17 limit
by having nesting of 6 template classes.
That's not hard to do if we are trying to make each component
of an algorithm generic.

I agree that we shouldn't make our hierarchy too deep
- but is a limit of 17 too low?

Lydia

-------------------------------------------
1) MutiResolutionMutualInformationRigidRegistration (constructor)
2) MultiResolutionRegistration (constructor)
3) ImageToImageRigidMutualInformationGradientDescentRegistration (New)
4) ImageToImageRigidMutualInformationGradientDescentRegistration 
(constructor)
5) RegistrationMethod (constructor)
6) MutualInformationImageToImageMetric (New)
7) MutualInformationImageToImageMetric (constructor)
8) SimilarityRegistrationMetric (constructor)
9) ImageMapper (New)
10) ImageMapper (constructor)
11) RegistrationMapper (constructor)
12) QuaternionRigidRegistrationTransform (New)
13) QuaternionRigidRegistrationTransform (constructor)
14) Rigid3DTransform (constructor)
15) vnl_quaternion (constructor)
16) vnl_vector_fixed (constructor)
17) vnl_vector_ref (constructor)
( one more is required to get to the constructor of vnl_vector )



 
------=_NextPart_000_0006_01C0FFC4.C953F750
Content-Type: application/octet-stream;
	name="log.log"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="log.log"

c++ -g -O2    =
-I/cygdrive/f/lng/Insight-latest/Insight/Testing/Code/Algorithms =
-I/cygdrive/f/lng/Insight-latest/Insight-Cygwin =
-I/cygdrive/f/lng/Insight-latest/Insight/Code/Numerics =
-I/cygdrive/f/lng/Insight-latest/Insight/Code/Common =
-I/cygdrive/f/lng/Insight-latest/Insight-Cygwin/Code/Numerics/vxl =
-I/cygdrive/f/lng/Insight-latest/Insight/Code/Numerics/vxl =
-I/cygdrive/f/lng/Insight-latest/Insight-Cygwin/Code/Numerics/vxl/vcl =
-I/cygdrive/f/lng/Insight-latest/Insight/Code/Numerics/vxl/vcl =
-I/cygdrive/f/lng/Insight-latest/Insight/Code/BasicFilters =
-I/cygdrive/f/lng/Insight-latest/Insight/Code/Algorithms   -c =
/cygdrive/f/lng/Insight-latest/Insight/Testing/Code/Algorithms/itkMultiRe=
solutionMutualInformationRigidRegistrationTest.cxx -o =
itkMultiResolutionMutualInformationRigidRegistrationTest.o=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Numerics/vxl/vnl/vnl_vector_r=
ef.h: In method `vnl_vector_ref<double>::vnl_vector_ref(int, double *)':=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Numerics/vxl/vnl/vnl_vector_r=
ef.h:31: template instantiation depth exceeds maximum of 17=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Numerics/vxl/vnl/vnl_vector_r=
ef.h:31:  (use -ftemplate-depth-NN to increase the maximum)=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Numerics/vxl/vnl/vnl_vector_r=
ef.h:31:   instantiating `vnl_vector<double>::vnl_vector()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Numerics/vxl/vnl/vnl_vector_r=
ef.h:31:   instantiated from =
`vnl_vector_ref<double>::vnl_vector_ref(int, double *)'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Numerics/vxl/vnl/vnl_vector_f=
ixed.h:33:   instantiated from =
`vnl_vector_fixed<double,4>::vnl_vector_fixed()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Numerics/vxl/vnl/vnl_quaterni=
on.h:65:   instantiated from `vnl_quaternion<double>::vnl_quaternion()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Common/itkRigid3DTransform.tx=
x:54:   instantiated from =
`itk::Rigid3DTransform<double,3>::Rigid3DTransform()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Common/itkQuaternionRigidRegi=
strationTransform.txx:33:   instantiated from =
`itk::QuaternionRigidRegistrationTransform<double,itk::Point<double,7> =
>::QuaternionRigidRegistrationTransform()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Common/itkQuaternionRigidRegi=
strationTransform.h:101:   instantiated from =
`itk::QuaternionRigidRegistrationTransform<double,itk::Point<double,7> =
>::New()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Algorithms/itkRegistrationMap=
per.txx:57:   instantiated from =
`itk::RegistrationMapper<itk::PhysicalImage<float,3,itk::DefaultImageTrai=
ts<float,3,itk::ValarrayImageContainer<long unsigned int,float> > =
>,itk::QuaternionRigidRegistrationTransform<double,itk::Point<double,7> =
> >::RegistrationMapper()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Algorithms/itkImageMapper.txx=
:55:   instantiated from =
`itk::ImageMapper<itk::PhysicalImage<float,3,itk::DefaultImageTraits<floa=
t,3,itk::ValarrayImageContainer<long unsigned int,float> > =
>,itk::QuaternionRigidRegistrationTransform<double,itk::Point<double,7> =
> >::ImageMapper()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Algorithms/itkImageMapper.h:1=
70:   instantiated from =
`itk::ImageMapper<itk::PhysicalImage<float,3,itk::DefaultImageTraits<floa=
t,3,itk::ValarrayImageContainer<long unsigned int,float> > =
>,itk::QuaternionRigidRegistrationTransform<double,itk::Point<double,7> =
> >::New()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Algorithms/itkSimilarityRegis=
trationMetric.txx:58:   instantiated from =
`itk::SimilarityRegistrationMetric<itk::PhysicalImage<float,3,itk::Defaul=
tImageTraits<float,3,itk::ValarrayImageContainer<long unsigned =
int,float> > =
>,itk::ImageMapper<itk::PhysicalImage<float,3,itk::DefaultImageTraits<flo=
at,3,itk::ValarrayImageContainer<long unsigned int,float> > =
>,itk::QuaternionRigidRegistrationTransform<double,itk::Point<double,7> =
> >,double,itk::CovariantVector<double,7> =
>::SimilarityRegistrationMetric()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Algorithms/itkMutualInformati=
onImageToImageMetric.txx:58:   instantiated from =
`itk::MutualInformationImageToImageMetric<itk::PhysicalImage<float,3,itk:=
:DefaultImageTraits<float,3,itk::ValarrayImageContainer<long unsigned =
int,float> > =
>,itk::ImageMapper<itk::PhysicalImage<float,3,itk::DefaultImageTraits<flo=
at,3,itk::ValarrayImageContainer<long unsigned int,float> > =
>,itk::QuaternionRigidRegistrationTransform<double,itk::Point<double,7> =
> > >::MutualInformationImageToImageMetric()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Algorithms/itkMutualInformati=
onImageToImageMetric.h:226:   instantiated from =
`itk::MutualInformationImageToImageMetric<itk::PhysicalImage<float,3,itk:=
:DefaultImageTraits<float,3,itk::ValarrayImageContainer<long unsigned =
int,float> > =
>,itk::ImageMapper<itk::PhysicalImage<float,3,itk::DefaultImageTraits<flo=
at,3,itk::ValarrayImageContainer<long unsigned int,float> > =
>,itk::QuaternionRigidRegistrationTransform<double,itk::Point<double,7> =
> > >::New()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Algorithms/itkRegistrationMet=
hod.txx:57:   instantiated from =
`itk::RegistrationMethod<itk::ImageToImageRigidMutualInformationGradientD=
escentRegistrationTraits<itk::PhysicalImage<float,3,itk::DefaultImageTrai=
ts<float,3,itk::ValarrayImageContainer<long unsigned int,float> > =
>,itk::PhysicalImage<float,3,itk::DefaultImageTraits<float,3,itk::Valarra=
yImageContainer<long unsigned int,float> > > > >::RegistrationMethod()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Algorithms/itkImageToImageRig=
idMutualInformationGradientDescentRegistration.txx:56:   instantiated =
from =
`itk::ImageToImageRigidMutualInformationGradientDescentRegistration<itk::=
PhysicalImage<float,3,itk::DefaultImageTraits<float,3,itk::ValarrayImageC=
ontainer<long unsigned int,float> > =
>,itk::PhysicalImage<float,3,itk::DefaultImageTraits<float,3,itk::Valarra=
yImageContainer<long unsigned int,float> > > =
>::ImageToImageRigidMutualInformationGradientDescentRegistration()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Algorithms/itkImageToImageRig=
idMutualInformationGradientDescentRegistration.h:295:   instantiated =
from =
`itk::ImageToImageRigidMutualInformationGradientDescentRegistration<itk::=
PhysicalImage<float,3,itk::DefaultImageTraits<float,3,itk::ValarrayImageC=
ontainer<long unsigned int,float> > =
>,itk::PhysicalImage<float,3,itk::DefaultImageTraits<float,3,itk::Valarra=
yImageContainer<long unsigned int,float> > > >::New()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Algorithms/itkMultiResolution=
Registration.txx:60:   instantiated from =
`itk::MultiResolutionRegistration<itk::MultiResolutionMutualInformationRi=
gidRegistrationTraits<itk::PhysicalImage<float,3,itk::DefaultImageTraits<=
float,3,itk::ValarrayImageContainer<long unsigned int,float> > =
>,itk::PhysicalImage<float,3,itk::DefaultImageTraits<float,3,itk::Valarra=
yImageContainer<long unsigned int,float> > > > =
>::MultiResolutionRegistration()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Algorithms/itkMultiResolution=
MutualInformationRigidRegistration.txx:57:   instantiated from =
`itk::MultiResolutionMutualInformationRigidRegistration<itk::PhysicalImag=
e<float,3,itk::DefaultImageTraits<float,3,itk::ValarrayImageContainer<lon=
g unsigned int,float> > =
>,itk::PhysicalImage<float,3,itk::DefaultImageTraits<float,3,itk::Valarra=
yImageContainer<long unsigned int,float> > > =
>::MultiResolutionMutualInformationRigidRegistration()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Algorithms/itkMultiResolution=
MutualInformationRigidRegistration.h:142:   instantiated from here=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Numerics/vxl/vnl/vnl_vector_r=
ef.h:31: template instantiation depth exceeds maximum of 17=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Numerics/vxl/vnl/vnl_vector_r=
ef.h:31:  (use -ftemplate-depth-NN to increase the maximum)=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Numerics/vxl/vnl/vnl_vector_r=
ef.h:31:   instantiating `vnl_vector<double>::vnl_vector()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Numerics/vxl/vnl/vnl_vector_r=
ef.h:31:   instantiated from =
`vnl_vector_ref<double>::vnl_vector_ref(int, double *)'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Numerics/vxl/vnl/vnl_vector_f=
ixed.h:33:   instantiated from =
`vnl_vector_fixed<double,4>::vnl_vector_fixed()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Numerics/vxl/vnl/vnl_quaterni=
on.h:65:   instantiated from `vnl_quaternion<double>::vnl_quaternion()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Common/itkRigid3DTransform.tx=
x:54:   instantiated from =
`itk::Rigid3DTransform<double,3>::Rigid3DTransform()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Common/itkQuaternionRigidRegi=
strationTransform.txx:33:   instantiated from =
`itk::QuaternionRigidRegistrationTransform<double,itk::Point<double,7> =
>::QuaternionRigidRegistrationTransform()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Common/itkQuaternionRigidRegi=
strationTransform.h:101:   instantiated from =
`itk::QuaternionRigidRegistrationTransform<double,itk::Point<double,7> =
>::New()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Algorithms/itkRegistrationMap=
per.txx:57:   instantiated from =
`itk::RegistrationMapper<itk::PhysicalImage<float,3,itk::DefaultImageTrai=
ts<float,3,itk::ValarrayImageContainer<long unsigned int,float> > =
>,itk::QuaternionRigidRegistrationTransform<double,itk::Point<double,7> =
> >::RegistrationMapper()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Algorithms/itkImageMapper.txx=
:55:   instantiated from =
`itk::ImageMapper<itk::PhysicalImage<float,3,itk::DefaultImageTraits<floa=
t,3,itk::ValarrayImageContainer<long unsigned int,float> > =
>,itk::QuaternionRigidRegistrationTransform<double,itk::Point<double,7> =
> >::ImageMapper()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Algorithms/itkImageMapper.h:1=
70:   instantiated from =
`itk::ImageMapper<itk::PhysicalImage<float,3,itk::DefaultImageTraits<floa=
t,3,itk::ValarrayImageContainer<long unsigned int,float> > =
>,itk::QuaternionRigidRegistrationTransform<double,itk::Point<double,7> =
> >::New()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Algorithms/itkSimilarityRegis=
trationMetric.txx:58:   instantiated from =
`itk::SimilarityRegistrationMetric<itk::PhysicalImage<float,3,itk::Defaul=
tImageTraits<float,3,itk::ValarrayImageContainer<long unsigned =
int,float> > =
>,itk::ImageMapper<itk::PhysicalImage<float,3,itk::DefaultImageTraits<flo=
at,3,itk::ValarrayImageContainer<long unsigned int,float> > =
>,itk::QuaternionRigidRegistrationTransform<double,itk::Point<double,7> =
> >,double,itk::CovariantVector<double,7> =
>::SimilarityRegistrationMetric()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Algorithms/itkMutualInformati=
onImageToImageMetric.txx:58:   instantiated from =
`itk::MutualInformationImageToImageMetric<itk::PhysicalImage<float,3,itk:=
:DefaultImageTraits<float,3,itk::ValarrayImageContainer<long unsigned =
int,float> > =
>,itk::ImageMapper<itk::PhysicalImage<float,3,itk::DefaultImageTraits<flo=
at,3,itk::ValarrayImageContainer<long unsigned int,float> > =
>,itk::QuaternionRigidRegistrationTransform<double,itk::Point<double,7> =
> > >::MutualInformationImageToImageMetric()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Algorithms/itkMutualInformati=
onImageToImageMetric.h:226:   instantiated from =
`itk::MutualInformationImageToImageMetric<itk::PhysicalImage<float,3,itk:=
:DefaultImageTraits<float,3,itk::ValarrayImageContainer<long unsigned =
int,float> > =
>,itk::ImageMapper<itk::PhysicalImage<float,3,itk::DefaultImageTraits<flo=
at,3,itk::ValarrayImageContainer<long unsigned int,float> > =
>,itk::QuaternionRigidRegistrationTransform<double,itk::Point<double,7> =
> > >::New()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Algorithms/itkRegistrationMet=
hod.txx:57:   instantiated from =
`itk::RegistrationMethod<itk::ImageToImageRigidMutualInformationGradientD=
escentRegistrationTraits<itk::PhysicalImage<float,3,itk::DefaultImageTrai=
ts<float,3,itk::ValarrayImageContainer<long unsigned int,float> > =
>,itk::PhysicalImage<float,3,itk::DefaultImageTraits<float,3,itk::Valarra=
yImageContainer<long unsigned int,float> > > > >::RegistrationMethod()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Algorithms/itkImageToImageRig=
idMutualInformationGradientDescentRegistration.txx:56:   instantiated =
from =
`itk::ImageToImageRigidMutualInformationGradientDescentRegistration<itk::=
PhysicalImage<float,3,itk::DefaultImageTraits<float,3,itk::ValarrayImageC=
ontainer<long unsigned int,float> > =
>,itk::PhysicalImage<float,3,itk::DefaultImageTraits<float,3,itk::Valarra=
yImageContainer<long unsigned int,float> > > =
>::ImageToImageRigidMutualInformationGradientDescentRegistration()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Algorithms/itkImageToImageRig=
idMutualInformationGradientDescentRegistration.h:295:   instantiated =
from =
`itk::ImageToImageRigidMutualInformationGradientDescentRegistration<itk::=
PhysicalImage<float,3,itk::DefaultImageTraits<float,3,itk::ValarrayImageC=
ontainer<long unsigned int,float> > =
>,itk::PhysicalImage<float,3,itk::DefaultImageTraits<float,3,itk::Valarra=
yImageContainer<long unsigned int,float> > > >::New()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Algorithms/itkMultiResolution=
Registration.txx:60:   instantiated from =
`itk::MultiResolutionRegistration<itk::MultiResolutionMutualInformationRi=
gidRegistrationTraits<itk::PhysicalImage<float,3,itk::DefaultImageTraits<=
float,3,itk::ValarrayImageContainer<long unsigned int,float> > =
>,itk::PhysicalImage<float,3,itk::DefaultImageTraits<float,3,itk::Valarra=
yImageContainer<long unsigned int,float> > > > =
>::MultiResolutionRegistration()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Algorithms/itkMultiResolution=
MutualInformationRigidRegistration.txx:57:   instantiated from =
`itk::MultiResolutionMutualInformationRigidRegistration<itk::PhysicalImag=
e<float,3,itk::DefaultImageTraits<float,3,itk::ValarrayImageContainer<lon=
g unsigned int,float> > =
>,itk::PhysicalImage<float,3,itk::DefaultImageTraits<float,3,itk::Valarra=
yImageContainer<long unsigned int,float> > > =
>::MultiResolutionMutualInformationRigidRegistration()'=0A=
/cygdrive/f/lng/Insight-latest/Insight/Code/Algorithms/itkMultiResolution=
MutualInformationRigidRegistration.h:142:   instantiated from here=0A=
make: *** [itkMultiResolutionMutualInformationRigidRegistrationTest.o] =
Error 1=0A=

------=_NextPart_000_0006_01C0FFC4.C953F750--