📄 loc1.c
字号:
/****************************************************************************
File Name : loc1.c
Purpose : visualization of stratified search locations
Date : Aug 31,1995
GSNAKE API is jointly developed by the Information Technology Institute (ITI), Singapore, and the School of Applied Science, Nanyang Technological
University (NTU), Singapore.
These software programs are available to the user without any license or royalty fees. Permission is hereby granted to use, copy, modify, and distribute this software and its documentation for any purpose. ITI and NTU gives no warranty, express, implied, or statuary for the software and/or documentation provided, including, without limitation, waranty of merchantibility and warranty of fitness for a particular purpose. The software provided hereunder is on an "as is" basis, and ITI and NTU has no obligation to provide maintenance, support, updates, enhancements, or modifications.
GSNAKE API is available for any UNIX compatible system. User feedback, bugs, or software and manual suggestions should be sent via electronic mail to one of the following, who may or may not act on them as he/she desires :
asschan@ntu.ac.sg
kflai@iti.gov.sg
***************************************************************************/
#include "gsnake.h"
#include "xwindow.h"
void getparam(int ac, char** av, int *sspacing,
int *nhoodX, int *nhoodY, SNAKEMODE *mode, int *mag);
void testmain(char *confile, int nhoodx, int nhoody,
int sspacing, SNAKEMODE mode, int mag );
void printhelp();
main(int argc, char **argv)
{
int magnify = 1;
int NhoodX, NhoodY;
int Sspacing ;
SNAKEMODE mode = _CLOSED;
NhoodX = 2; NhoodY =2 ;
Sspacing = 5;
if (argc == 1)
printhelp();
else {
getparam(argc,argv, &Sspacing,
&NhoodX, &NhoodY, &mode, &magnify);
testmain(argv[1], NhoodX, NhoodY,Sspacing, mode, magnify);
return(0);
}
}
void testmain(char *confile, int nhoodx, int nhoody,
int sspacing, SNAKEMODE mode, int mag )
{
CONTOUR mycontour;
LOCATIONS searchloc;
int numloc;
int i,k,j;
if (mycontour.read(confile)) exit(-1);
printf("\nDisplaying search locations ..");
mycontour.display(mag);
getchar();
xwin_setexpandratio(1,mag);
/* compute possible location */
numloc = (2*nhoodx+1) * (2*nhoody+1);
/* Initialising the LOCATION object. Operating generateLoc
in verbose mode will put on the possible locations
on the window */
if (!searchloc.init(mycontour.getNumSnaxel(),numloc))
searchloc.generateLoc( mode, mycontour.getHead(),
mycontour.getTail(),
nhoodx, nhoody,
sspacing, 1, 1);
printf("\nPress enter to end.");
getchar();
}
void getparam(int ac, char** av, int *sspacing,
int *nhoodX, int *nhoodY,
SNAKEMODE *mode, int *mag)
{
register int i;
char *inputstr;
for (i=2; i<ac; i++) {
if( *av[i] != '-' )
continue; /* illegal input */
inputstr = av[i]+2;
switch( *(av[i]+1) ) {
case 'M' :
*mag = atoi(inputstr);
break;
case 'm' :
switch (*(av[i]+2)) {
case 'c': *mode = _CLOSED; break;
case 'o': *mode = _OPENED;break;
}
break;
case 'S' :
*sspacing = atoi(inputstr);
break;
case 'H' :
inputstr=av[i]+3;
switch (*(av[i]+2)) {
case 'x': *nhoodX = atoi(inputstr); break;
case 'y': *nhoodY = atoi(inputstr);break;
}
break;
default: break;
}
}
}
void printhelp()
{
printf("\n\nVisualisation of search locations.");
printf("\nThis program will calculate and display all the possible ");
printf("\nsearch paths taken by the individual snaxels.\n");
printf("\n OOloc1 <contour file> [ -option ] ");
printf(" [ option ]");
printf("\n -M :Magnification factor");
printf("\n -m/o/c :Gsnake mode, default c");
printf("\n :c - closed o - opened");
printf("\n -S :Stratified search segment spacing, default 5");
printf("\n -H :Numbers of the search segment,");
printf("\n :default x = 2, y = 2\n\n");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -