The Beginners Guide to MPE
This is the name of the Program.
This tells the computer all the Variable names, and what they are. For example, it now knows that 'Lastframe' is an INTEGER, but OK is boolean - i.e it is either TRUE or FALSE, and 'composite' is an IMAGE.
Our main types are INTEGER - just numbers. MPE has lots of different types,all listed in the Manual. If you don't assign a VAR to a variable, MPE assumes it is of type LONGINT.
You can generally give these variables any name, except those already taken by the system - like END or FOR or IMAGE, and names used as procedures & functions - more of them later.
Funnily enough, this is where the executable code begins! There is also an END.
This is a comment.
It is ignored, but its useful to remind you whats going on etc.
Comments start with (* and end with *)
The first bit of real code.
We want to find out how many images there are in the splash. We use
a FUNCTION called GETNUMBEROF- a little bit of pre-packaged code
which returns a value into our variable called 'NumofImg'.
What type of variable is it? (Look under VAR).
All Functions return a value of a specific type i.e. INTEGER, BOOLEAN,REAL etc. In this case, it returns the number of images in the study - but, its very precise actually, it returns the number of images in study number 1, because we asked it to , using GETNUMBEROF (1,143) The 1 in brackets means Study number 1, and it returns the number of images because we used 143 which is the code for images, you can use mImage insted of 143, and most people do!
Now we could have returned the number of regions instead if we used the code for regions.
So, now NumofImg is actually the number of images in the study (study 1).
In MPE all lines end with a semicolon ;
All Procedure and functions arguments are in brackets.
White space is ignored - layout is only important for clarity.
Capitals have no effect.
Equals (more strictly "becomes") are represented by :=
OK := GETINTEGER('FIRST FRAME? ',TRUE,{200,200},1,NumOfImg,Firstframe);
This next line is another Function, what it does is to ask the user
for some input. Its called GETINTEGER and it does just that! Note how
the equals sign is used, and notice that the function returns TRUE or
FALSE to OK.
The arguments in brackets are seperated by commas - there are 6 of
'em!
Complicated, but well worth it as you'll see later.
If the user hits the OK button, the function returns the boolean
value TRUE to the variable OK;
Cancel returns FALSE.
What this line does is to conditionally look at the value of OK,
not OK is the same as OK being FALSE.
If that is so then the next instuction is carried out, if OK isn't
FALSE, then the program skips to the next line.
Stop();
Stop() is a Procedure. This is the same as a function,
except it doesn't return anything!
As you might have guessed, this procedure stops the program running.
Last modified on: Wed, Jan 15, 1997.