[Insight-users] "Stupid" question about SmartPointer
Vincent Daanen
vincent.daanen at imag.fr
Wed Sep 7 10:24:15 EDT 2005
Hi itk-users,
Currently writing a test program for volume registration, I'd like to
choose dynamically the metric.
So I think to such a thing :
itk::ImageToImageMetric *pMetric;
swicth (metricChoice)
{
case MI :
typedef
itk::MutualInfomationimageToImageMetric<InternalImageType,
InternalImageType> MetricType;
MetricType::Pointer mi_metric = MetricType::New();
mi_metric->.... //mi_metric intialisation
pMetric = mi_metric->GetPointer();
break;
case NMI :
...
}
My problem is that I'm afraid that mi_metric will be deleted at the end
of the "case MI :" statement. am I right ?
If yes, is there a way to still use this way of programming (I'm sure it
is possible but I do not find the way yet) !
Thanks for your help
Vince
--
Vincent Daanen, PhD
Research Engineer, Post-Doctoral Position
Laboratoire TIMC/IMAG (Univ. Joseph Fourier - CNRS UMR 5525)
Equipe GMCAO
Institut d'Ingénierie de l'Information de Santé (IN3S)
Faculté de Médecine - 38706 La Tronche cedex - France
Tel: +33 (0)4 56 52 00 54 - Fax: +33 (0)4 56 52 00 55
Vincent.Daanen at imag.fr
"Les problèmes ne peuvent être résolus par
ceux dont l'horizon se limite aux réalités
quotidiennes, mais par ceux qui rêvent de
choses qui n'ont jamais existées et qui se
disent : Pourquoi Pas ?"
J-F Kennedy, 1963.
More information about the Insight-users
mailing list