[Insight-users] [switch structure] within a command-line app

J Mst gave_edgar@hotmail.com
Mon, 07 Apr 2003 11:21:56 +0000


Hi all,

I was trying to build a program which could include several different 
configurations of a registration procedure. I was inspirated by the 
ImageRegistration example from the InsightApplications dir.

I tried to build a sortlike program but now in the command line. The example 
uses switch statements in order to pass the correct metric or optimizer 
etc... The whole application I built compiles well except for the part where 
I use these switch statements.

VC++ gives me an error saying  I cant use a switch statement using a * char 
as input. I looked in the VC help and I found that the switch statement has 
to have an int as input. I was confused because I saw in the example that a 
char type was used is input for the switch.

I did the following thigs:
--------------------------------------
typedef enum{
MutualInformation,
MeanSquares,
...etc
} metricIdentifier

metricIdentifier   m_selectedMetric;

m_selectedMetric = argv[4];

switch (m_selectedMetric){
case MutualInformation:
{ registration->SetMetric( MutualInformationMetric )
  break;
}
etc for other cases.
--------------------------------------------------

So it gives an error with the argv input I think. I have no idea how I 
should build an good switch structure with a argv as input.

Any help would be greatly appreciated.

Joris





_________________________________________________________________
Chatten met je online vrienden via MSN Messenger. http://messenger.msn.nl/