[Insight-users] "Stupid" question about SmartPointer
Tao, Xiaodong (Research)
taox at research.ge.com
Wed Sep 7 10:38:02 EDT 2005
Vincent,
Simply using
pMetric = mi_metric;
should be okay.
Xiaodong
-----Original Message-----
From: insight-users-bounces+taox=research.ge.com at itk.org
[mailto:insight-users-bounces+taox=research.ge.com at itk.org]On Behalf Of
Vincent Daanen
Sent: Wednesday, September 07, 2005 10:24 AM
To: insight-users at itk.org
Subject: [Insight-users] "Stupid" question about SmartPointer
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.
_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users
More information about the Insight-users
mailing list