这篇教程C++ usage_exit函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中usage_exit函数的典型用法代码示例。如果您正苦于以下问题:C++ usage_exit函数的具体用法?C++ usage_exit怎么用?C++ usage_exit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了usage_exit函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: main/*---------------------------------------------------------------*/int main(int argc, char *argv[]) { int nargs, nthvtx, nnbrs1, nnbrs2, nthnbr, nbrvtxno1, nbrvtxno2; int nthface, annot1, annot2; VERTEX *vtx1, *vtx2; FACE *face1, *face2; float diff, maxdiff; nargs = handle_version_option (argc, argv, vcid, "$Name: stable5 $"); if (nargs && argc - nargs == 1) exit (0); argc -= nargs; cmdline = argv2cmdline(argc,argv); uname(&uts); getcwd(cwd,2000); Progname = argv[0] ; argc --; argv++; ErrorInit(NULL, NULL, NULL) ; DiagInit(NULL, NULL, NULL) ; if (argc == 0) usage_exit(); parse_commandline(argc, argv); check_options(); if (checkoptsonly) return(0); SUBJECTS_DIR = getenv("SUBJECTS_DIR"); if (SUBJECTS_DIR == NULL) { printf("INFO: SUBJECTS_DIR not defined in environment/n"); //exit(1); } if (SUBJECTS_DIR1 == NULL) SUBJECTS_DIR1 = SUBJECTS_DIR; if (SUBJECTS_DIR2 == NULL) SUBJECTS_DIR2 = SUBJECTS_DIR; if (surf1path == NULL && surfname == NULL) surfname = "orig"; if (surf1path == NULL) { sprintf(tmpstr,"%s/%s/surf/%s.%s",SUBJECTS_DIR1,subject1,hemi,surfname); surf1path = strcpyalloc(tmpstr); } if (surf2path == NULL) { sprintf(tmpstr,"%s/%s/surf/%s.%s",SUBJECTS_DIR2,subject2,hemi,surfname); surf2path = strcpyalloc(tmpstr); } dump_options(stdout); //read-in each surface. notice that the random number generator is //seeded with the same value prior to each read. this is because in //the routine MRIScomputeNormals, if it finds a zero-length vertex //normal, is adds a random value to the x,y,z and recomputes the normal. //so if comparing identical surfaces, the seed must be the same so that //any zero-length vertex normals appear the same. setRandomSeed(seed) ; surf1 = MRISread(surf1path); if (surf1 == NULL) { printf("ERROR: could not read %s/n",surf1path); exit(1); } setRandomSeed(seed) ; surf2 = MRISread(surf2path); if (surf2 == NULL) { printf("ERROR: could not read %s/n",surf2path); exit(1); } printf("Number of vertices %d %d/n",surf1->nvertices,surf2->nvertices); printf("Number of faces %d %d/n",surf1->nfaces,surf2->nfaces); //Number of Vertices ---------------------------------------- if (surf1->nvertices != surf2->nvertices) { printf("Surfaces differ in number of vertices %d %d/n", surf1->nvertices,surf2->nvertices); exit(101); } //Number of Faces ------------------------------------------ if (surf1->nfaces != surf2->nfaces) { printf("Surfaces differ in number of faces %d %d/n", surf1->nfaces,surf2->nfaces); exit(101); } //surf1->faces[10000].area = 100; //surf1->vertices[10000].x = 100; if (ComputeNormalDist) { double dist, dx, dy, dz, dot ; MRI *mri_dist ; mri_dist = MRIalloc(surf1->nvertices,1,1,MRI_FLOAT) ; MRIScomputeMetricProperties(surf1) ; MRIScomputeMetricProperties(surf2) ; for (nthvtx=0; nthvtx < surf1->nvertices; nthvtx++) { vtx1 = &(surf1->vertices[nthvtx]); vtx2 = &(surf2->vertices[nthvtx]); dx = vtx2->x-vtx1->x ; dy = vtx2->y-vtx1->y ; dz = vtx2->z-vtx1->z ; dist = sqrt(dx*dx + dy*dy + dz*dz) ; dot = dx*vtx1->nx + dy*vtx1->ny + dz*vtx1->nz ; dist = dist * dot / fabs(dot) ; MRIsetVoxVal(mri_dist, nthvtx, 0, 0, 0, dist) ; }//.........这里部分代码省略.........
开发者ID:guo2004131,项目名称:freesurfer,代码行数:101,
示例2: mainint CLIB_ROUTINE main( int argc, char** argv){/************************************** * * m a i n * ************************************** * * Functional description * Install or remove Firebird. * **************************************/ TEXT directory[MAXPATHLEN]; USHORT sw_command = COMMAND_NONE; bool sw_version = false; // Let's get the root directory from the instance path of this program. // argv[0] is only _mostly_ guaranteed to give this info, // so we GetModuleFileName() const USHORT len = GetModuleFileName(NULL, directory, sizeof(directory)); if (len == 0) return reg_error(GetLastError(), "GetModuleFileName", NULL); // Get to the last '/' (this one precedes the filename part). There is // always one after a call to GetModuleFileName(). TEXT* p = directory + len; do {--p;} while (*p != '//'); // Get to the previous '/' (this one should precede the supposed 'bin//' part). // There is always an additional '/' OR a ':'. do {--p;} while (*p != '//' && *p != ':'); *p = '/0'; const TEXT* const* const end = argv + argc; while (++argv < end) { if (**argv != '-') { const TEXT* cmd; USHORT i; for (i = 0; cmd = commands[i].name; i++) { const TEXT* q = cmd; for (p = *argv; *p && UPPER(*p) == *q; ++p, ++q) ; if (!*p && commands[i].abbrev <= (USHORT) (q - cmd)) break; } if (!cmd) { printf("Unknown command /"%s/"/n", *argv); usage_exit(); } sw_command = commands[i].code; } else { p = *argv + 1; switch (UPPER(*p)) { case 'Z': sw_version = true; break; case '?': usage_exit(); default: printf("Unknown switch /"%s/"/n", p); usage_exit(); } } } if (sw_version) printf("instreg version %s/n", FB_VERSION); if (sw_command == COMMAND_NONE) usage_exit(); HKEY hkey_node = HKEY_LOCAL_MACHINE; USHORT ret; switch (sw_command) { case COMMAND_INSTALL: ret = REGISTRY_install(hkey_node, directory, reg_error); if (ret != FB_SUCCESS) printf ("Firebird has not been installed in the registry./n"); else printf("Firebird has been successfully installed in the registry./n"); break; case COMMAND_REMOVE: ret = REGISTRY_remove(hkey_node, false, reg_error); if (ret != FB_SUCCESS) printf("Firebird has not been deleted from the registry./n"); else printf("Firebird has been successfully deleted from the registry./n");//.........这里部分代码省略.........
开发者ID:andrewleech,项目名称:firebird,代码行数:101,
示例3: mainintmain (int argc, char *argv []){ SNDFILE *infile, *outfile = NULL ; SF_INFO sfinfo ; sf_count_t count ; double src_ratio = -1.0, gain = 1.0 ; int new_sample_rate = -1, k, converter, max_speed = SF_FALSE ; if (argc == 2 && strcmp (argv [1], "--version") == 0) { char buffer [64], *cptr ; if ((cptr = strrchr (argv [0], '/')) != NULL) argv [0] = cptr + 1 ; if ((cptr = strrchr (argv [0], '//')) != NULL) argv [0] = cptr + 1 ; sf_command (NULL, SFC_GET_LIB_VERSION, buffer, sizeof (buffer)) ; printf ("%s (%s,%s)/n", argv [0], src_get_version (), buffer) ; exit (0) ; } ; if (argc != 5 && argc != 7 && argc != 8) usage_exit (argv [0]) ; /* Set default converter. */ converter = DEFAULT_CONVERTER ; for (k = 1 ; k < argc - 2 ; k++) { if (strcmp (argv [k], "--max-speed") == 0) max_speed = SF_TRUE ; else if (strcmp (argv [k], "-to") == 0) { k ++ ; new_sample_rate = parse_int_or_die (argv [k], "sample rate") ; } else if (strcmp (argv [k], "-by") == 0) { k ++ ; src_ratio = atof (argv [k]) ; } else if (strcmp (argv [k], "-c") == 0) { k ++ ; converter = parse_int_or_die (argv [k], "converter") ; } else usage_exit (argv [0]) ; } ; if (new_sample_rate <= 0 && src_ratio <= 0.0) usage_exit (argv [0]) ; if (src_get_name (converter) == NULL) { printf ("Error : bad converter number./n") ; usage_exit (argv [0]) ; } ; if (strcmp (argv [argc - 2], argv [argc - 1]) == 0) { printf ("Error : input and output file names are the same./n") ; exit (1) ; } ; memset (&sfinfo, 0, sizeof (sfinfo)) ; if ((infile = sf_open (argv [argc - 2], SFM_READ, &sfinfo)) == NULL) { printf ("Error : Not able to open input file '%s'/n", argv [argc - 2]) ; exit (1) ; } ; printf ("Input File : %s/n", argv [argc - 2]) ; printf ("Sample Rate : %d/n", sfinfo.samplerate) ; printf ("Input Frames : %ld/n/n", (long) sfinfo.frames) ; if (new_sample_rate > 0) { src_ratio = (1.0 * new_sample_rate) / sfinfo.samplerate ; sfinfo.samplerate = new_sample_rate ; } else if (src_is_valid_ratio (src_ratio)) sfinfo.samplerate = (int) floor (sfinfo.samplerate * src_ratio) ; else { printf ("Not able to determine new sample rate. Exiting./n") ; sf_close (infile) ; exit (1) ; } ; if (fabs (src_ratio - 1.0) < 1e-20) { printf ("Target samplerate and input samplerate are the same. Exiting./n") ; sf_close (infile) ; exit (0) ; } ; printf ("SRC Ratio : %f/n", src_ratio) ; printf ("Converter : %s/n/n", src_get_name (converter)) ; if (src_is_valid_ratio (src_ratio) == 0) { printf ("Error : Sample rate change out of valid range./n") ; sf_close (infile) ; exit (1) ; } ; /* Delete the output file length to zero if already exists. */ remove (argv [argc - 1]) ;//.........这里部分代码省略.........
开发者ID:adityasriteja4u,项目名称:sndfile-tools,代码行数:101,
示例4: mainint main(int argc, char *argv[]) { char **av, *in_fname; int ac, nargs; MRIS *mris; int msec, minutes, seconds, nv, nf, ne, eno ; struct timeb start ; double total_volume; /* rkt: check for and handle version tag */ nargs = handle_version_option (argc, argv, "$Id: mris_volume.c,v 1.6 2011/03/02 00:04:34 nicks Exp $", "$Name: $"); if (nargs && argc - nargs == 1) exit (0); argc -= nargs; Progname = argv[0] ; ErrorInit(NULL, NULL, NULL) ; DiagInit(NULL, NULL, NULL) ; TimerStart(&start) ; ac = argc ; av = argv ; for ( ; argc > 1 && ISOPTION(*argv[1]) ; argc--, argv++) { nargs = get_option(argc, argv) ; argc -= nargs ; argv += nargs ; } if (argc < 2) usage_exit(1) ; // printf("command line parsing finished/n"); /*** Read in the input surfaces ***/ in_fname = argv[1] ; if (verbose) printf("reading %s.../n", in_fname) ; mris = MRISread(in_fname) ; if(mris == NULL) ErrorExit(ERROR_NOFILE, "%s: could not read surface %s", Progname, in_fname) ; eno = MRIScomputeEulerNumber(mris, &nv, &nf, &ne) ; if (eno != 2) ErrorExit(ERROR_BADPARM, "%s: surface %s has an incorrect topology (eno=%d)", Progname, in_fname, eno) ; if(verbose) printf("surface file read in./n"); total_volume = MRISvolumeInSurf(mris); msec = TimerStop(&start) ; seconds = nint((float)msec/1000.0f) ; minutes = seconds / 60 ; seconds = seconds % 60 ; if (verbose) printf("Volume computation took %d minutes and %d seconds./n", minutes, seconds) ; if (verbose) printf("total volume surrounded by the surface is %g/n", total_volume); else printf("%lf/n", total_volume); MRISfree(&mris); exit(0);}
开发者ID:ewong718,项目名称:freesurfer,代码行数:67,
示例5: mainintmain(int argc, char *argv[]) { char **av, *in_vol, *out_vol; int ac, nargs; MRI *mri_in, *mri_out, *mri_tmp ; LTA *lta = 0; MATRIX *i_to_r_src = 0; /* src geometry of the input LTA */ MATRIX *V_to_V = 0; /* Final voxel-to-voxel transform */ MATRIX *r_to_i_dst = 0; /* dst geometry of the input LTA */ MATRIX *m_tmp = 0; MATRIX *i_to_r_reg = 0; /* i_to_r of the volume after registration */ MATRIX *r_to_i_out = 0; /* r_to_i of the final output volume */ VOL_GEOM vgm_in; int x, y, z; double maxV, minV, value; int transform_type; // MATRIX *i_to_r, *r_to_i; HISTOGRAM *h, *hsmooth ; float fmin, fmax, val, peak, smooth_peak; int i, nbins, bin; /* rkt: check for and handle version tag */ nargs = handle_version_option (argc, argv, "$Id: mri_transform_to_COR.c,v 1.3 2011/03/02 00:04:25 nicks Exp $", "$Name: stable5 $"); if (nargs && argc - nargs == 1) usage_exit (0); argc -= nargs; Progname = argv[0] ; ErrorInit(NULL, NULL, NULL) ; DiagInit(NULL, NULL, NULL) ; ac = argc ; av = argv ; for ( ; argc > 1 && ISOPTION(*argv[1]) ; argc--, argv++) { nargs = get_option(argc, argv) ; argc -= nargs ; argv += nargs ; } if (argc < 3) usage_exit(0) ; in_vol = argv[1] ; out_vol = argv[2] ; printf("reading volume from %s.../n", in_vol) ; mri_in = MRIread(in_vol) ; if (!mri_in) ErrorExit(ERROR_NOFILE, "%s: could not read MRI volume %s", Progname, in_vol) ; /* Convert mri_in to float type */ /* double would be more accurate */ if (mri_in->type != MRI_FLOAT) { printf("Input volume type is %d/n", mri_in->type); printf("Change input volume to float type for convenience and accuracy"); mri_tmp = MRIchangeType(mri_in, MRI_FLOAT, 0, 1.0, 1); MRIfree(&mri_in); mri_in = mri_tmp; //swap } /* Get input volume geometry, which is needed to compute i_to_r * and r_to_i of input volume. Note that i_to_r and r_to_i assumed * a certain prespecified c_r, c_a, c_s */ getVolGeom(mri_in, &vgm_in); maxV = -10000.0; minV = 10000.0; for (z=0; z < mri_in->depth; z++) for (y=0; y< mri_in->height; y++) for (x=0; x < mri_in->width; x++) { if (MRIFvox(mri_in, x, y, z) > maxV ) maxV = MRIFvox(mri_in, x, y,z) ; if (MRIFvox(mri_in, x, y, z) < minV ) minV = MRIFvox(mri_in, x, y,z) ; } printf("Input volume has max = %g, min =%g/n", maxV, minV); printf("Scale input volume by %g /n", scale); maxV = -10000.0; minV = 10000.0; for (z=0; z < mri_in->depth; z++) for (y=0; y< mri_in->height; y++) for (x=0; x < mri_in->width; x++) { MRIFvox(mri_in, x, y, z) *= scale; if (MRIFvox(mri_in, x, y, z) > maxV ) maxV = MRIFvox(mri_in, x, y,z) ; if (MRIFvox(mri_in, x, y, z) < minV ) minV = MRIFvox(mri_in, x, y,z) ; } printf("Input volume after scaling has max = %g, min =%g/n", maxV, minV); /* Try to compute the Voxel_to_Voxel transform from the input volume * and the registration target/reference volume! * If no registration is involved, vox_to_vox is simply identity//.........这里部分代码省略.........
开发者ID:guo2004131,项目名称:freesurfer,代码行数:101,
示例6: get_option/*---------------------------------------------------------------------- Parameters: Description:----------------------------------------------------------------------*/static intget_option(int argc, char *argv[]) { int nargs = 0 ; char *option ; option = argv[1] + 1 ; /* past '-' */ if (!stricmp(option, "debug_voxel")) { Gx = atoi(argv[2]) ; Gy = atoi(argv[3]) ; Gz = atoi(argv[4]) ; debug_flag = 1; nargs = 3 ; printf("debugging voxel (%d, %d, %d).../n", Gx, Gy, Gz) ; } else if (!stricmp(option, "window")) { window_flag = 1 ; window_size = atoi(argv[2]) ; nargs = 1; printf("interpolating volume to be isotropic 1mm^3/n") ; } else if (!stricmp(option, "shift")) { shift_value = atof(argv[2]) ; nargs = 1; printf("shift output by %g before truncating at zero /n", shift_value) ; } else if (!stricmp(option, "out_type")) { out_type = atoi(argv[2]); nargs = 1; printf("Output type is %d/n", out_type); } else if (!stricmp(option, "conform")) { conform = 1 ; printf("interpolating volume to be isotropic 1mm^3/n") ; } else if (!stricmp(option, "use_one")) { USE_ONE = 1 ; printf("Using only the covariance matrix of first class as SW /n") ; } else if (!stricmp(option, "whole_volume")) { whole_volume = 1 ; printf("Synthesize background region too (if LDA)/n") ; } else if (!stricmp(option, "lda")) { ldaflag = 1; class1 = atoi(argv[2]) ; class2 = atoi(argv[3]) ; nargs = 2; printf("Using LDA method to generate synthesized volume (%d, %d) /n", class1, class2); } else if (!stricmp(option, "mask")) { mask_fname = argv[2]; printf("using %s as mask for regions of interest /n", mask_fname); nargs = 1; } else if (!stricmp(option, "label")) { label_fname = argv[2]; printf("using %s as segmentation volume /n", label_fname); nargs = 1; } else if (!stricmp(option, "synth")) { synth_fname = argv[2]; printf("using %s as output for synthesized volume /n", synth_fname); nargs = 1; } else if (!stricmp(option, "weight")) { weight_fname = argv[2]; printf("using %s as input for LDA weights /n", weight_fname); nargs = 1; } else if (!stricmp(option, "noconform")) { conform = 0 ; printf("inhibiting isotropic volume interpolation/n") ; } else if (!stricmp(option, "test")) { just_test = 1 ; printf("Test: set Sw to identity matrix./n") ; } else if (!stricmp(option, "regularize")) { regularize = 1 ; lambda = atof(argv[2]); nargs = 1; printf("regularization for covarinace matrix, lambda = %g/n", lambda) ; } else if (!stricmp(option, "distance")) { compute_m_distance = 1 ; printf("Compute M distance between cluster centers./n") ; } else switch (toupper(*option)) { case 'T': noise_threshold = atof(argv[2]) ; printf("Threshold for background noise = %g/n", noise_threshold) ; printf("The threshold is applied on first input volume./n") ; nargs = 1 ; break ; case 'W': have_weight = 1; break; case '?': case 'U': usage_exit(0) ; break ; default: printf("unknown option %s/n", argv[1]) ; exit(1) ; break ; } return(nargs) ;}
开发者ID:ewong718,项目名称:freesurfer,代码行数:98,
示例7: mainintmain(int argc, char *argv[]) { char **av ; int ac, nargs ; MRI *mri_orig, *mri_norm, *mri_bias ; int msec, minutes, seconds ; struct timeb start ; /* rkt: check for and handle version tag */ nargs = handle_version_option (argc, argv, "$Id: mri_apply_bias.c,v 1.5 2011/03/02 00:04:13 nicks Exp $", "$Name: stable5 $"); if (nargs && argc - nargs == 1) exit (0); argc -= nargs; Progname = argv[0] ; ErrorInit(NULL, NULL, NULL) ; DiagInit(NULL, NULL, NULL) ; TimerStart(&start) ; ac = argc ; av = argv ; for ( ; argc > 1 && ISOPTION(*argv[1]) ; argc--, argv++) { nargs = get_option(argc, argv) ; argc -= nargs ; argv += nargs ; } if (argc < 4) usage_exit(1) ; mri_orig = MRIread(argv[1]) ; if (mri_orig == NULL) ErrorExit(ERROR_NOFILE, "%s: could not read %s",Progname, argv[1]) ; mri_bias = MRIread(argv[2]) ; if (mri_bias == NULL) ErrorExit(ERROR_NOFILE, "%s: could not read %s",Progname, argv[2]) ; if (xform_fname) { TRANSFORM *transform ; MRI *mri ; transform = TransformRead(xform_fname) ; if (transform == NULL) ErrorExit(ERROR_NOFILE, "%s: could not load transform %s", Progname, xform_fname) ; mri = MRIcloneDifferentType(mri_orig, MRI_FLOAT) ; TransformApplyInverse(transform, mri_bias, mri) ; MRIfree(&mri_bias) ; mri_bias = mri ; } mri_norm = apply_bias(mri_orig, NULL, mri_bias); fprintf(stderr, "writing to %s.../n", argv[3]) ; MRIwrite(mri_norm, argv[3]) ; MRIfree(&mri_norm) ; msec = TimerStop(&start) ; seconds = nint((float)msec/1000.0f) ; minutes = seconds / 60 ; seconds = seconds % 60 ; fprintf(stderr, "bias correction took %d minutes and %d seconds./n", minutes, seconds) ; exit(0) ; return(0) ;}
开发者ID:guo2004131,项目名称:freesurfer,代码行数:68,
示例8: parse_commandline/* ------------------------------------------------------------------ */static int parse_commandline(int argc, char **argv) { int nargc , nargsused; char **pargv, *option ; if (argc < 1) usage_exit(); nargc = argc; pargv = argv; while (nargc > 0) { option = pargv[0]; if (debug) printf("%d %s/n",nargc,option); nargc -= 1; pargv += 1; nargsused = 0; if (!strcasecmp(option, "--help")) print_help() ; else if (!strcasecmp(option, "--version")) print_version() ; else if (!strcasecmp(option, "--debug")) debug = 1; else if (!strcasecmp(option, "--oldtxtstyle")) oldtxtstyle = 1; else if (!strcasecmp(option, "--plaintxtstyle")) plaintxtstyle = 1; else if (!strcasecmp(option, "--mskinvert")) mskinvert = 1; else if (!strcmp(option, "--fixxfm")) fixxfm = 1; else if (!strcmp(option, "--nofixxfm")) fixxfm = 0; /* -------- ROI output file ------ */ else if (!strcmp(option, "--roiavgtxt")) { if (nargc < 1) argnerr(option,1); roitxtfile = pargv[0]; nargsused = 1; } else if (!strcmp(option, "--roiavg")) { if (nargc < 1) argnerr(option,1); roifile = pargv[0]; nargsused = 1; } /* -------- source volume inputs ------ */ else if (!strcmp(option, "--srcvol")) { if (nargc < 1) argnerr(option,1); srcvolid = IDnameFromStem(pargv[0]); if(srcvolid == NULL) srcvolid = pargv[0]; nargsused = 1; } else if (!strcmp(option, "--srcfmt")) { if (nargc < 1) argnerr(option,1); srcfmt = pargv[0]; nargsused = 1; } else if (!strcmp(option, "--srcreg")) { if (nargc < 1) argnerr(option,1); srcregfile = pargv[0]; nargsused = 1; } else if (!strcmp(option, "--srcoldreg")) { srcoldreg = 1; } else if (!strcmp(option, "--srcwarp")) { if (nargc < 1) argnerr(option,1); srcwarp = pargv[0]; nargsused = 1; } /* -------- label inputs ------ */ else if (!strcmp(option, "--labelfile") || !strcmp(option, "--label")) { if (nargc < 1) argnerr(option,1); labelfile = pargv[0]; nargsused = 1; } else if (!strcmp(option, "--labelreg")) { if (nargc < 1) argnerr(option,1); src2lblregfile = pargv[0]; nargsused = 1; } else if (!strcmp(option, "--labeltal")) { labeltal = 1; fixxfm = 1; nargsused = 0; } else if (!strcmp(option, "--talxfm")) { if (nargc < 1) argnerr(option,1); talxfm = pargv[0]; labeltal = 1; fixxfm = 1; nargsused = 1; } else if (!strcmp(option, "--labelfillthresh")) { if (nargc < 1) argnerr(option,1); sscanf(pargv[0],"%f",&labelfillthresh); nargsused = 1; } /* -------- mask volume inputs ------ */ else if (!strcmp(option, "--mskvol")) { if (nargc < 1) argnerr(option,1); mskvolid = IDnameFromStem(pargv[0]); if(mskvolid == NULL) mskvolid = pargv[0]; nargsused = 1; } else if (!strcmp(option, "--mskfmt")) { if (nargc < 1) argnerr(option,1); mskfmt = pargv[0]; nargsused = 1; } //.........这里部分代码省略.........
开发者ID:guo2004131,项目名称:freesurfer,代码行数:101,
示例9: mainintmain(int argc, char *argv[]) { char **av, *in_fname, *out_fname, path[STRLEN], fname[STRLEN], hemi[STRLEN], *cp ; int ac, nargs ; MRI_SURFACE *mris ; /* rkt: check for and handle version tag */ nargs = handle_version_option (argc, argv, "$Id: mris_reverse.c,v 1.10 2011/03/02 00:04:33 nicks Exp $", "$Name: $"); if (nargs && argc - nargs == 1) exit (0); argc -= nargs; Progname = argv[0] ; ErrorInit(NULL, NULL, NULL) ; DiagInit(NULL, NULL, NULL) ; ac = argc ; av = argv ; for ( ; argc > 1 && ISOPTION(*argv[1]) ; argc--, argv++) { nargs = get_option(argc, argv) ; argc -= nargs ; argv += nargs ; } if (argc < 3) usage_exit() ; in_fname = argv[1] ; out_fname = argv[2] ; if (patch_flag) { FileNamePath(in_fname, path) ; FileNameOnly(in_fname, hemi) ; cp = strchr(hemi, '.') ; if (cp) *cp = 0 ; else ErrorExit(ERROR_BADPARM, "%s: could not scan hemisphere from %s/n", in_fname) ; sprintf(fname, "%s/%s.%s", path, hemi, ORIG_NAME) ; mris = MRISread(fname) ; if (!mris) ErrorExit(ERROR_NOFILE, "%s: could not read surface file %s", Progname, fname) ; if (MRISreadPatch(mris, in_fname) != NO_ERROR) ErrorExit(Gerror, "%s: could not read patch/n", Progname) ; } else { mris = MRISread(in_fname) ; if (!mris) ErrorExit(ERROR_NOFILE, "%s: could not read surface file %s", Progname, in_fname) ; } FileNamePath(out_fname, path) ; MRISreverse(mris, which, 1) ; if (Gdiag & DIAG_SHOW) fprintf(stderr, "writing reversed surface to %s/n", out_fname) ; mris->type = MRIS_TRIANGULAR_SURFACE ; if (patch_flag) MRISwritePatch(mris, out_fname) ; else MRISwrite(mris, out_fname) ; exit(0) ; return(0) ; /* for ansi */}
开发者ID:ewong718,项目名称:freesurfer,代码行数:66,
示例10: mainint main(int argc, char* argv[]){ int sock, s_sock, client_fd; socklen_t client_size; struct sockaddr_in addr, client_addr; struct timeval tv; static pool pool; sigset_t mask; if (argc != 9) usage_exit(); // parse arguments STATE.port = (int)strtol(argv[1], (char**)NULL, 10); STATE.s_port = (int)strtol(argv[2], (char**)NULL, 10); strcpy(STATE.log_path, argv[3]); strcpy(STATE.lck_path, argv[4]); strcpy(STATE.www_path, argv[5]); strcpy(STATE.cgi_path, argv[6]); strcpy(STATE.key_path, argv[7]); strcpy(STATE.ctf_path, argv[8]); if (STATE.www_path[strlen(STATE.www_path)-1] == '/') STATE.www_path[strlen(STATE.www_path)-1] = '/0'; daemonize(); STATE.log = log_open(STATE.log_path); Log("Start Liso server. Server is running in background. /n"); /* all networked programs must create a socket * PF_INET - IPv4 Internet protocols * SOCK_STREAM - sequenced, reliable, two-way, connection-based byte stream * 0 (protocol) - use default protocol */ // create sock for HTTP connection if ((sock = socket(PF_INET, SOCK_STREAM, 0)) == -1) { Log("Error: failed creating socket for HTTP connection./n"); fclose(STATE.log); return EXIT_FAILURE; } STATE.sock = sock; Log("Create socket success: sock = %d /n", sock); addr.sin_family = AF_INET; addr.sin_port = htons(STATE.port); addr.sin_addr.s_addr = INADDR_ANY; /* servers bind sockets to ports---notify the OS they accept connections */ if (bind(sock, (struct sockaddr *) &addr, sizeof(addr))) { Log("Error: failed binding socket./n"); clean(); return EXIT_FAILURE; } Log("Bind success! /n"); if (listen(sock, MAX_CONN)) { Log("Error: listening on socket./n"); clean(); return EXIT_FAILURE; } Log("Listen success! >>>>>>>>>>>>>>>>>>>> /n"); // create sock for HTTPS connection Log("Create sock for HTTPS connection /n"); if ((s_sock = socket(PF_INET, SOCK_STREAM, 0)) == -1) { Log("Error: failed creating socket for HTTPS connection./n"); close(sock); fclose(STATE.log); return EXIT_FAILURE; } STATE.s_sock = s_sock; Log("Create HTTPS socket success: sock = %d /n", s_sock); addr.sin_family = AF_INET; addr.sin_port = htons(STATE.s_port); addr.sin_addr.s_addr = INADDR_ANY; /* servers bind sockets to ports---notify the OS they accept connections */ if (bind(s_sock, (struct sockaddr *) &addr, sizeof(addr))) { Log("Error: failed binding socket./n"); close(sock); close(s_sock); fclose(STATE.log); return EXIT_FAILURE; } Log("Bind success! /n"); if (listen(s_sock, MAX_CONN)) { Log("Error: listening on socket./n"); close(sock); close(s_sock); fclose(STATE.log); return EXIT_FAILURE; } Log("Listen success! >>>>>>>>>>>>>>>>>>>> /n"); init_pool(&pool); // the main loop to wait for connections and serve requests//.........这里部分代码省略.........
开发者ID:ledinhminh,项目名称:Lisod,代码行数:101,
示例11: main/*---------------------------------------------------------*/int main(int argc, char **argv) { int n,err, f, nhits, r,c,s; float ipr, bpr, intensity; float *framepower=NULL, val; LTA *lta; int nargs; //int endian,roitype; /* rkt: check for and handle version tag */ nargs = handle_version_option (argc, argv, "$Id: mri_vol2roi.c,v 1.32 2011/03/02 00:04:25 nicks Exp $", "$Name: stable5 $"); if (nargs && argc - nargs == 1) exit (0); argc -= nargs; Progname = argv[0] ; argc --; argv++; ErrorInit(NULL, NULL, NULL) ; DiagInit(NULL, NULL, NULL) ; if (argc == 0) usage_exit(); parse_commandline(argc, argv); check_options(); printf("--------------------------------------------------------/n"); getcwd(tmpstr,2000); printf("%s/n",tmpstr); printf("%s/n",Progname); for (n=0;n<argc;n++) printf(" %s",argv[n]); printf("/n"); printf("version %s/n",vcid); printf("--------------------------------------------------------/n"); dump_options(stdout); /* --------- load in the (possibly 4-D) source volume --------------*/ printf("Loading volume %s ...",srcvolid); mSrcVol = MRIread(srcvolid); if(mSrcVol == NULL) exit(1); printf("done/n"); /* Dsrc: read the source registration file */ if (srcregfile != NULL) { err = regio_read_register(srcregfile, &srcsubject, &ipr, &bpr, &intensity, &Dsrc, &float2int_src); if (err) exit(1); printf("srcreg Dsrc -------------/n"); MatrixPrint(stdout,Dsrc); printf("----------------------------------/n"); } else Dsrc = NULL; /* Wsrc: Get the source warping Transform */ Wsrc = NULL; /* Fsrc: Get the source FOV registration matrix */ Fsrc = NULL; /* Qsrc: Compute the quantization matrix for src volume */ Qsrc = FOVQuantMatrix(mSrcVol->width, mSrcVol->height, mSrcVol->depth, mSrcVol->xsize, mSrcVol->ysize, mSrcVol->zsize); printf("ras2vox src (tkreg) Qsrc -------------/n"); MatrixPrint(stdout,Qsrc); printf("----------------------------------/n"); /* ----------- load in the label ----------------- */ if (labelfile != NULL) { Label = LabelReadFile(labelfile); if (Label == NULL) exit(1); /* load in the source-to-label registration */ if (src2lblregfile != NULL) { //err = regio_read_xfm(src2lblregfile, &Msrc2lbl); //if(err) exit(1); lta = LTAread(src2lblregfile); if (lta->type == LINEAR_VOX_TO_VOX) { printf("INFO: converting LTA to RAS/n"); LTAvoxelTransformToCoronalRasTransform(lta); } Msrc2lbl = MatrixCopy(lta->xforms[0].m_L,NULL); } else if (labeltal) { /* Load the talairach.xfm and make it approp for reg.dat*/ Msrc2lbl = DevolveXFM(srcsubject,NULL,talxfm); if (Msrc2lbl==NULL) exit(1); } else Msrc2lbl = NULL; if (Msrc2lbl != NULL) { printf("-- Source2Label %s ---- /n",src2lblregfile); MatrixPrint(stdout,Msrc2lbl); printf("-------------------------------/n"); } } else { Label = NULL; Msrc2lbl = NULL; } /* -------------- load mask volume stuff -----------------------------*/ if (mskvolid != NULL) { /* load the mask volume (single frame) */ printf("Reading %s/n",mskvolid); mMskVol = MRIread(mskvolid); if(mMskVol == NULL) exit(1); if(mskframe > 0){//.........这里部分代码省略.........
开发者ID:guo2004131,项目名称:freesurfer,代码行数:101,
示例12: mainintmain (int argc, char * argv []){ PARAMS params = { 1.0, -1, -1, 0, 0, 0, NULL } ; const char * filename ; int k ; if (argc < 4) usage_exit (argv [0]) ; for (k = 1 ; k < argc - 3 ; k++) { if (strcmp (argv [k], "-from") == 0) { k++ ; params.start_freq = parse_double_or_die (argv [k], "from frequency") ; continue ; } ; if (strcmp (argv [k], "-to") == 0) { k++ ; params.end_freq = parse_double_or_die (argv [k], "to frequency") ; continue ; } ; if (strcmp (argv [k], "-amp") == 0) { k++ ; params.amplitude = strtod (argv [k], NULL) ; continue ; } ; if (argv [k][0] == '-') { params.sweep_func = parse_sweep_type (argv [k]) ; continue ; } ; printf ("/nUnknow option '%s'./n/n", argv [k]) ; exit (1) ; } ; params.samplerate = parse_int_or_die (argv [argc - 3], "sample rate") ; params.seconds = parse_double_or_die (argv [argc - 2], "seconds") ; filename = argv [argc - 1] ; check_int_range ("sample rate", params.samplerate, 1000, 200 * 1000) ; check_double_range ("seconds", params.seconds, 0.1, 100.0) ; if (params.sweep_func == NULL) params.sweep_func = parse_sweep_type ("-log") ; if (params.start_freq <= 0.0) params.start_freq = 100.0 ; if (params.end_freq <= 0.0) params.end_freq = params.samplerate / 2.0 - 100.0 ; if (params.end_freq <= params.start_freq) { printf ("/nError : end frequency %g < start frequency %g./n/n", params.end_freq, params.start_freq) ; exit (1) ; } ; params.format = guess_major_format (filename) | SF_FORMAT_FLOAT ; generate_file (filename, ¶ms) ; return 0 ;} /* main */
开发者ID:erikd,项目名称:sndfile-tools,代码行数:61,
示例13: parse_commandline/* --------------------------------------------- */static int parse_commandline(int argc, char **argv) { int nargc , nargsused; char **pargv, *option ; if (argc < 1) usage_exit(); nargc = argc; pargv = argv; while (nargc > 0) { option = pargv[0]; if (debug) printf("%d %s/n",nargc,option); nargc -= 1; pargv += 1; nargsused = 0; if (!strcasecmp(option, "--help")) print_help() ; else if (!strcasecmp(option, "--version")) print_version() ; else if (!strcasecmp(option, "--debug")) debug = 1; else if (!strcasecmp(option, "--checkopts")) checkoptsonly = 1; else if (!strcasecmp(option, "--nocheckopts")) checkoptsonly = 0; else if (!strcasecmp(option, "--no-check-xyz")) CheckXYZ = 0; else if (!strcasecmp(option, "--no-check-nxyz")) CheckNXYZ = 0; else if (!strcasecmp(option, "--ndist")) { ComputeNormalDist = 1; out_fname = pargv[0]; nargsused = 1; } else if (!strcasecmp(option, "--s1")) { if (nargc < 1) CMDargNErr(option,1); subject1 = pargv[0]; nargsused = 1; } else if (!strcasecmp(option, "--s2")) { if (nargc < 1) CMDargNErr(option,1); subject2 = pargv[0]; nargsused = 1; } else if (!strcasecmp(option, "--sd1")) { if (nargc < 1) CMDargNErr(option,1); SUBJECTS_DIR1 = pargv[0]; nargsused = 1; } else if (!strcasecmp(option, "--sd2")) { if (nargc < 1) CMDargNErr(option,1); SUBJECTS_DIR2 = pargv[0]; nargsused = 1; } else if (!strcasecmp(option, "--hemi")) { if (nargc < 1) CMDargNErr(option,1); hemi = pargv[0]; nargsused = 1; } else if (!strcasecmp(option, "--surf")) { if (nargc < 1) CMDargNErr(option,1); surfname = pargv[0]; CheckSurf=1; nargsused = 1; } else if (!strcasecmp(option, "--curv")) { if (nargc < 1) CMDargNErr(option,1); curvname = pargv[0]; CheckCurv=1; nargsused = 1; } else if (!strcasecmp(option, "--aparc")) { if (nargc < 1) CMDargNErr(option,1); aparcname = pargv[0]; CheckAParc=1; nargsused = 1; } else if (!strcasecmp(option, "--aparc2")) { if (nargc < 1) CMDargNErr(option,1); aparc2name = pargv[0]; CheckAParc=1; nargsused = 1; } else if (!strcasecmp(option, "--thresh")) { if (nargc < 1) CMDargNErr(option,1); sscanf(pargv[0],"%lf",&thresh); nargsused = 1; } else if (!strcasecmp(option, "--maxerrs")) { if (nargc < 1) CMDargNErr(option,1); sscanf(pargv[0],"%d",&MAX_NUM_ERRORS); nargsused = 1; } else { if (surf1path == NULL) { surf1path = option; CheckSurf=1; } else if (surf2path == NULL) surf2path = option; else { fprintf(stderr,"ERROR: Option %s unknown/n",option); if (CMDsingleDash(option)) fprintf(stderr," Did you really mean -%s ?/n",option); exit(-1); } } nargc -= nargsused; pargv += nargsused; } return(0);}
开发者ID:guo2004131,项目名称:freesurfer,代码行数:94,
示例14: main_loop//.........这里部分代码省略......... postproc = 1; vp8_dbg_color_mb_modes = flags; } } else if (arg_match(&arg, &pp_disp_b_modes, argi)) { unsigned int flags = arg_parse_int(&arg); if (flags) { postproc = 1; vp8_dbg_color_b_modes = flags; } } else if (arg_match(&arg, &pp_disp_mvs, argi)) { unsigned int flags = arg_parse_int(&arg); if (flags) { postproc = 1; vp8_dbg_display_mv = flags; } } else if (arg_match(&arg, &error_concealment, argi)) { ec_enabled = 1; }#endif else argj++; } /* Check for unrecognized options */ for (argi = argv; *argi; argi++) if (argi[0][0] == '-' && strlen(argi[0]) > 1) die("Error: Unrecognized option %s/n", *argi); /* Handle non-option arguments */ fn = argv[0]; if (!fn) usage_exit(); /* Open file */ infile = strcmp(fn, "-") ? fopen(fn, "rb") : set_binary_mode(stdin); if (!infile) { fprintf(stderr, "Failed to open file '%s'", strcmp(fn, "-") ? fn : "stdin"); return EXIT_FAILURE; }#if CONFIG_OS_SUPPORT /* Make sure we don't dump to the terminal, unless forced to with -o - */ if (!outfile_pattern && isatty(fileno(stdout)) && !do_md5 && !noblit) { fprintf(stderr, "Not dumping raw video to your terminal. Use '-o -' to " "override./n"); return EXIT_FAILURE; }#endif input.vpx_input_ctx->file = infile; if (file_is_ivf(input.vpx_input_ctx)) input.vpx_input_ctx->file_type = FILE_TYPE_IVF; else if (file_is_webm(input.webm_ctx, input.vpx_input_ctx)) input.vpx_input_ctx->file_type = FILE_TYPE_WEBM; else if (file_is_raw(input.vpx_input_ctx)) input.vpx_input_ctx->file_type = FILE_TYPE_RAW; else { fprintf(stderr, "Unrecognized input file type./n"); return EXIT_FAILURE; } outfile_pattern = outfile_pattern ? outfile_pattern : "-"; single_file = is_single_file(outfile_pattern);
开发者ID:cavedweller,项目名称:massplay-server,代码行数:66,
示例15: main/*---------------------------------------------------------------*/int main(int argc, char **argv){ int c,r,s,f; double val,rval; FILE *fp; MRI *mritmp; Progname = argv[0] ; argc --; argv++; ErrorInit(NULL, NULL, NULL) ; DiagInit(NULL, NULL, NULL) ; /* assign default geometry */ cdircos[0] = 1.0; cdircos[1] = 0.0; cdircos[2] = 0.0; rdircos[0] = 0.0; rdircos[1] = 1.0; rdircos[2] = 0.0; sdircos[0] = 0.0; sdircos[1] = 0.0; sdircos[2] = 1.0; res[0] = 1.0; res[1] = 1.0; res[2] = 1.0; cras[0] = 0.0; cras[1] = 0.0; cras[2] = 0.0; res[3] = 2.0; /* TR */ if (argc == 0) usage_exit(); parse_commandline(argc, argv); check_options(); dump_options(stdout); if(tempid != NULL) { printf("INFO: reading template header/n"); if(! DoCurv) mritemp = MRIreadHeader(tempid,tempfmtid); else mritemp = MRIread(tempid); if (mritemp == NULL) { printf("ERROR: reading %s header/n",tempid); exit(1); } if(NewVoxSizeSpeced){ dim[0] = round(mritemp->width*mritemp->xsize/res[0]); dim[1] = round(mritemp->height*mritemp->ysize/res[1]); dim[2] = round(mritemp->depth*mritemp->zsize/res[2]); dim[3] = mritemp->nframes; res[3] = mritemp->tr; dimSpeced = 1; } if(dimSpeced){ mritmp = MRIallocSequence(dim[0],dim[1],dim[2],MRI_FLOAT,dim[3]); MRIcopyHeader(mritemp,mritmp); MRIfree(&mritemp); mritemp = mritmp; } if(resSpeced){ mritemp->xsize = res[0]; mritemp->ysize = res[1]; mritemp->zsize = res[2]; mritemp->tr = res[3]; } dim[0] = mritemp->width; dim[1] = mritemp->height; dim[2] = mritemp->depth; if (nframes > 0) dim[3] = nframes; else dim[3] = mritemp->nframes; mritemp->nframes = dim[3]; } if(mritemp) { if(SpikeTP >= mritemp->nframes){ printf("ERROR: SpikeTP = %d >= mritemp->nframes = %d/n", SpikeTP,mritemp->nframes); exit(1); } } printf("Synthesizing/n"); srand48(seed); if (strcmp(pdfname,"gaussian")==0) mri = MRIrandn(dim[0], dim[1], dim[2], dim[3], gausmean, gausstd, NULL); else if (strcmp(pdfname,"uniform")==0) mri = MRIdrand48(dim[0], dim[1], dim[2], dim[3], 0, 1, NULL); else if (strcmp(pdfname,"const")==0) mri = MRIconst(dim[0], dim[1], dim[2], dim[3], ValueA, NULL); else if (strcmp(pdfname,"sphere")==0) { if(voxradius < 0) voxradius = sqrt( pow(dim[0]/2.0,2)+pow(dim[1]/2.0,2)+pow(dim[2]/2.0,2) )/2.0; printf("voxradius = %lf/n",voxradius); mri = MRIsphereMask(dim[0], dim[1], dim[2], dim[3], dim[0]/2.0, dim[1]/2.0, dim[2]/2.0, voxradius, ValueA, NULL); } else if (strcmp(pdfname,"delta")==0) {//.........这里部分代码省略.........
开发者ID:ewong718,项目名称:freesurfer,代码行数:101,
示例16: mainintmain(int argc, char *argv[]) { char **av, *in_fname; int ac, nargs, i, j, x, y, z, width, height, depth; MRI *mri_flash[MAX_IMAGES], *mri_label, *mri_mask, *mri_tmp; int msec, minutes, seconds, nvolumes, nvolumes_total ; struct timeb start ; float max_val, min_val, value; float *LDAmean1, *LDAmean2, *LDAweight; int label; double sum_white, sum_gray; int count_white, count_gray; /* rkt: check for and handle version tag */ nargs = handle_version_option (argc, argv, "$Id: mri_ms_LDA.c,v 1.4 2011/03/02 00:04:23 nicks Exp $", "$Name: $"); if (nargs && argc - nargs == 1) exit (0); argc -= nargs; Progname = argv[0] ; ErrorInit(NULL, NULL, NULL) ; DiagInit(NULL, NULL, NULL) ; TimerStart(&start) ; ac = argc ; av = argv ; for ( ; argc > 1 && ISOPTION(*argv[1]) ; argc--, argv++) { nargs = get_option(argc, argv) ; argc -= nargs ; argv += nargs ; } if (argc < 2) usage_exit(1) ; printf("command line parsing finished/n"); if (have_weight == 0 && ldaflag == 0) { printf("Use -lda option to specify two class labels to optimize CNR on /n"); usage_exit(0); } if (have_weight == 0 && label_fname == NULL) { printf("Use -label option to specify file for segmentation /n"); usage_exit(0); } if (have_weight == 1 && weight_fname == NULL) { printf("Use -weight option to specify file for input LDA weights /n") ; usage_exit(0); } if (have_weight == 1 && synth_fname == NULL) { printf("Use -synth option to specify file for output synthesized volume /n") ; usage_exit(0); } ////////////////////////////////////////////////////////////////////////////////// /*** Read in the input multi-echo volumes ***/ nvolumes = 0 ; for (i = 1 ; i < argc; i++) { in_fname = argv[i] ; printf("reading %s.../n", in_fname) ; mri_flash[nvolumes] = MRIread(in_fname) ; if (mri_flash[nvolumes] == NULL) ErrorExit(ERROR_NOFILE, "%s: could not read volume %s", Progname, in_fname) ; /* conform will convert all data to UCHAR, which will reduce data resolution*/ printf("%s read in. /n", in_fname) ; if (conform) { printf("embedding and interpolating volume/n") ; mri_tmp = MRIconform(mri_flash[nvolumes]) ; MRIfree(&mri_flash[nvolumes]); mri_flash[nvolumes] = mri_tmp ; } /* Change all volumes to float type for convenience */ if (mri_flash[nvolumes]->type != MRI_FLOAT) { printf("Volume %d type is %d/n", nvolumes+1, mri_flash[nvolumes]->type); printf("Change data to float type /n"); mri_tmp = MRIchangeType(mri_flash[nvolumes], MRI_FLOAT, 0, 1.0, 1); MRIfree(&mri_flash[nvolumes]); mri_flash[nvolumes] = mri_tmp; //swap } nvolumes++ ; } printf("All data read in/n"); /////////////////////////////////////////////////////////////////////////// nvolumes_total = nvolumes ; /* all volumes read in */ for (i = 0 ; i < nvolumes ; i++) { for (j = i+1 ; j < nvolumes ; j++) { if ((mri_flash[i]->width != mri_flash[j]->width) || (mri_flash[i]->height != mri_flash[j]->height) ||//.........这里部分代码省略.........
开发者ID:ewong718,项目名称:freesurfer,代码行数:101,
示例17: parse_commandline/* ------------------------------------------------------------------ */static int parse_commandline(int argc, char **argv) { int i, nargc , nargsused; char **pargv, *option ; char tmpstr[1000]; if (argc < 1) usage_exit(); nargc = argc; pargv = argv; while (nargc > 0) { option = pargv[0]; if (debug) printf("%d %s/n",nargc,option); nargc -= 1; pargv += 1; nargsused = 0; if (!strcasecmp(option, "--help")) print_help() ; else if (!strcasecmp(option, "--version")) print_version() ; else if (!strcasecmp(option, "--debug")) debug = 1; else if (!strcasecmp(option, "--abs")) DoAbs = 1; else if (!strcasecmp(option, "--nogmnnorm")) gmnnorm = 0; else if (!strcasecmp(option, "--rescale")) rescale=1; else if (!strcasecmp(option, "--norescale")) rescale=0; else if (!strcasecmp(option, "--no-output")) NoOutput = 1; else if (!strcasecmp(option, "--fft")) UseFFT = 1; else if (!strcasecmp(option, "--offset")) AddOffset=1; else if (!strcasecmp(option, "--offset-mid")){ AddOffset = 1; OffsetFrame = -1; } else if (!strcmp(option, "--hsc")) { if (nargc < 2) argnerr(option,2); sscanf(pargv[0],"%lf",&HSCMin); sscanf(pargv[1],"%lf",&HSCMax); DoHSC = 1; nargsused = 2; } else if (!strcmp(option, "--sum2")) { if (nargc < 1) argnerr(option,1); sum2file = pargv[0]; pdfname = "delta"; //NoOutput = 1; nframes = 1; nargsused = 1; } else if (!strcmp(option, "--hsynth")) { // eres mask DoTnorm out if (nargc < 3) argnerr(option,3); mri = MRIread(pargv[0]); mask = MRIread(pargv[1]); sscanf(pargv[2],"%d",&DoTNorm); mri2 = fMRIhsynth(mri, mask, DoTNorm); MRIwrite(mri2,pargv[3]); exit(0); nargsused = 2; } else if (!strcmp(option, "--vol") || !strcmp(option, "--o")) { if (nargc < 1) argnerr(option,1); volid = pargv[0]; nargsused = 1; if (nth_is_arg(nargc, pargv, 1)) { volfmt = pargv[1]; nargsused ++; volfmtid = checkfmt(volfmt); } } else if (!strcmp(option, "--temp") || !strcmp(option, "--template")) { if(DoCurv){ printf("ERROR: cannot use --temp and --curv/n"); exit(1); } if(nargc < 1) argnerr(option,1); tempid = pargv[0]; nargsused = 1; if (nth_is_arg(nargc, pargv, 1)) { tempfmt = pargv[1]; nargsused ++; tempfmtid = checkfmt(tempfmt); } else tempfmtid = getfmtid(tempid); } else if (!strcmp(option, "--curv")) { if(tempid != NULL){ printf("ERROR: cannot use --temp and --curv/n"); exit(1); } if(nargc < 2) argnerr(option,2); subject = pargv[0]; hemi = pargv[1]; DoCurv = 1; nargsused = 2; sprintf(tmpstr,"%s/%s/surf/%s.thickness",getenv("SUBJECTS_DIR"),subject,hemi); tempid = strcpyalloc(tmpstr); } else if ( !strcmp(option, "--dim") ) { if (nargc < 4) argnerr(option,4); for (i=0;i<4;i++) sscanf(pargv[i],"%d",&dim[i]); nargsused = 4; dimSpeced = 1; } //.........这里部分代码省略.........
开发者ID:ewong718,项目名称:freesurfer,代码行数:101,
示例18: mainintmain (int argc, char *argv []){ const char *progname, *outfilename ; SNDFILE *outfile, **infiles ; SF_INFO sfinfo_out, sfinfo_in ; void (*func) (SNDFILE*, SNDFILE*, int) ; int k ; progname = program_name (argv [0]) ; if (argc < 4) usage_exit (progname) ; argv ++ ; argc -- ; argc -- ; outfilename = argv [argc] ; if ((infiles = calloc (argc, sizeof (SNDFILE*))) == NULL) { printf ("/nError : Malloc failed./n/n") ; exit (1) ; } ; memset (&sfinfo_in, 0, sizeof (sfinfo_in)) ; if ((infiles [0] = sf_open (argv [0], SFM_READ, &sfinfo_in)) == NULL) { printf ("/nError : failed to open file '%s'./n/n", argv [0]) ; exit (1) ; } ; sfinfo_out = sfinfo_in ; for (k = 1 ; k < argc ; k++) { if ((infiles [k] = sf_open (argv [k], SFM_READ, &sfinfo_in)) == NULL) { printf ("/nError : failed to open file '%s'./n/n", argv [k]) ; exit (1) ; } ; if (sfinfo_in.channels != sfinfo_out.channels) { printf ("/nError : File '%s' has %d channels (should have %d)./n/n", argv [k], sfinfo_in.channels, sfinfo_out.channels) ; exit (1) ; } ; } ; if ((outfile = sf_open (outfilename, SFM_WRITE, &sfinfo_out)) == NULL) { printf ("/nError : Not able to open input file %s./n", outfilename) ; puts (sf_strerror (NULL)) ; exit (1) ; } ; if ((sfinfo_out.format & SF_FORMAT_SUBMASK) == SF_FORMAT_DOUBLE || (sfinfo_out.format & SF_FORMAT_SUBMASK) == SF_FORMAT_FLOAT) func = concat_data_fp ; else func = concat_data_int ; for (k = 0 ; k < argc ; k++) { func (outfile, infiles [k], sfinfo_out.channels) ; sf_close (infiles [k]) ; } ; sf_close (outfile) ; free (infiles) ; return 0 ;} /* main */
开发者ID:stohrendorf,项目名称:libsndfile,代码行数:67,
示例19: mainintmain(int argc, char *argv[]) { MRI_SURFACE *mris ; char **av, *curv_name, *surf_name, *hemi, fname[STRLEN], *cp, *subject_name, subjects_dir[STRLEN], **c1_subjects, **c2_subjects ; int ac, nargs, n, num_class1, num_class2, i, nvertices, avgs, max_snr_avgs, nlabels = 0, done ; float **c1_thickness, **c2_thickness, *curvs, *total_mean, *c1_mean, *c2_mean, *class_mean, *c1_var, *c2_var, *class_var,*pvals, **c1_avg_thickness, *vbest_snr, *vbest_avgs, *vtotal_var, *vsnr, **c2_avg_thickness, *vbest_pvalues, current_min_label_area, current_fthresh ; MRI_SP *mrisp ; LABEL *area, **labels = NULL ; FILE *fp = NULL ; double snr, max_snr ; struct timeb start ; int msec, minutes, seconds ; double **c1_label_thickness, **c2_label_thickness ; int *sorted_indices = NULL, vno ; float *test_thickness, *test_avg_thickness ; double label_avg ; /* rkt: check for and handle version tag */ nargs = handle_version_option (argc, argv, "$Id: mris_classify_thickness.c,v 1.8 2011/03/02 00:04:29 nicks Exp $", "$Name: stable5 $"); if (nargs && argc - nargs == 1) exit (0); argc -= nargs; if (write_flag && DIAG_VERBOSE_ON) fp = fopen("scalespace.dat", "w") ; Progname = argv[0] ; ErrorInit(NULL, NULL, NULL) ; DiagInit(NULL, NULL, NULL) ; ac = argc ; av = argv ; for ( ; argc > 1 && ISOPTION(*argv[1]) ; argc--, argv++) { nargs = get_option(argc, argv) ; argc -= nargs ; argv += nargs ; } TimerStart(&start) ; /* subject_name hemi surface curvature */ if (argc < 7) usage_exit() ; if (output_subject == NULL) ErrorExit(ERROR_BADPARM, "output subject must be specified with -o <subject name>"); cp = getenv("SUBJECTS_DIR") ; if (!cp) ErrorExit(ERROR_BADPARM, "%s: SUBJECTS_DIR not defined in environment", Progname) ; strcpy(subjects_dir, cp) ; hemi = argv[1] ; surf_name = argv[2] ; curv_name = argv[3] ;#define ARGV_OFFSET 4 /* first determine the number of subjects in each class */ num_class1 = 0 ; n = ARGV_OFFSET ; do { num_class1++ ; n++ ; if (argv[n] == NULL || n >= argc) ErrorExit(ERROR_BADPARM, "%s: must spectify ':' between class lists", Progname) ; } while (argv[n][0] != ':') ; /* find # of vertices in output subject surface */ sprintf(fname, "%s/%s/surf/%s.%s", subjects_dir,output_subject,hemi,surf_name); mris = MRISread(fname) ; if (!mris) ErrorExit(ERROR_NOFILE, "%s: could not read surface file %s", Progname, fname) ; nvertices = mris->nvertices ; MRISfree(&mris) ; total_mean = (float *)calloc(nvertices, sizeof(float)) ; if (!total_mean) ErrorExit(ERROR_NOMEMORY, "%s: could not allocate mean list of %d curvatures", Progname, n, nvertices) ; c1_mean = (float *)calloc(nvertices, sizeof(float)) ; if (!c1_mean) ErrorExit(ERROR_NOMEMORY, "%s: could not allocate c1 mean list of %d curvatures", Progname, n, nvertices) ; pvals = (float *)calloc(nvertices, sizeof(float)) ;//.........这里部分代码省略.........
开发者ID:guo2004131,项目名称:freesurfer,代码行数:101,
示例20: parse_argsvoid parse_args(int argc, char **argv){ char *tail; int c; int index; static struct option opts[] = { { "file", required_argument, NULL, 'f' }, { "loop", required_argument, NULL, 'l' }, { "infinite", no_argument, NULL, 'i' }, { "speed", required_argument, NULL, 's' }, { "port", required_argument, NULL, 'p' }, { "help", no_argument, NULL, 'h' }, { 0 } }; while (1) { c = getopt_long(argc, argv, "f:l:is:p:h", opts, &index); if (c == -1) break; switch (c) { case 'f': filename = optarg; break; case 'l': loopcount = strtoul(optarg, &tail, 10); if (*tail) { fprintf(stderr, "invalid argument to loop: %s/n", optarg); usage_exit(1); } break; case 'i': loopcount = 0; break; case 's': speed = strtoul(optarg, &tail, 10); if (*tail) speed = -1; switch (speed) { case 1: case 100: speed = RAW1394_ISO_SPEED_100; break; case 2: case 200: speed = RAW1394_ISO_SPEED_200; break; case 4: case 400: speed = RAW1394_ISO_SPEED_400; break; default: fprintf(stderr, "invalid argument to speed: %s/n", optarg); usage_exit(1); } break; case 'p': which_port = strtoul(optarg, &tail, 10); if (*tail) { fprintf(stderr, "invalid argument to port: %s/n", optarg); usage_exit(1); } break; case 'h': usage_exit(0); case '?': usage_exit(1); case 0: break; default: abort(); } } argv += optind; argc -= optind; if (argc > 1) { fprintf(stderr, "Too many arguments./n"); usage_exit(1); } if (argc) filename = *argv;}
开发者ID:Din09,项目名称:libraw1394,代码行数:90,
示例21: mainintmain(int argc, char *argv[]) { char **av, *label_name, *vol_name, *out_name ; int ac, nargs ; int msec, minutes, seconds, i ; LABEL *area ; struct timeb start ; MRI *mri, *mri_seg ; Real xw, yw, zw, xv, yv, zv, val; /* rkt: check for and handle version tag */ nargs = handle_version_option (argc, argv, "$Id: mri_label_vals.c,v 1.16 2015/08/24 18:22:05 fischl Exp $", "$Name: $"); if (nargs && argc - nargs == 1) exit (0); argc -= nargs; Progname = argv[0] ; ErrorInit(NULL, NULL, NULL) ; DiagInit(NULL, NULL, NULL) ; TimerStart(&start) ; ac = argc ; av = argv ; for ( ; argc > 1 && ISOPTION(*argv[1]) ; argc--, argv++) { nargs = get_option(argc, argv) ; argc -= nargs ; argv += nargs ; } if (argc < 3) usage_exit(1) ; vol_name = argv[1] ; label_name = argv[2] ; out_name = argv[3] ; mri = MRIread(vol_name) ; if (!mri) ErrorExit(ERROR_NOFILE, "%s: could not read volume from %s",Progname, vol_name) ; if (scaleup_flag) { float scale, fov_x, fov_y, fov_z ; scale = 1.0/MIN(MIN(mri->xsize, mri->ysize),mri->zsize) ; fprintf(stderr, "scaling voxel sizes up by %2.2f/n", scale) ; mri->xsize *= scale ; mri->ysize *= scale ; mri->zsize *= scale ; fov_x = mri->xsize * mri->width; fov_y = mri->ysize * mri->height; fov_z = mri->zsize * mri->depth; mri->xend = fov_x / 2.0; mri->xstart = -mri->xend; mri->yend = fov_y / 2.0; mri->ystart = -mri->yend; mri->zend = fov_z / 2.0; mri->zstart = -mri->zend; mri->fov = (fov_x > fov_y ? (fov_x > fov_z ? fov_x : fov_z) : (fov_y > fov_z ? fov_y : fov_z) ); } if (segmentation_flag >= 0) { int x, y, z ; VECTOR *v_seg, *v_mri ; MATRIX *m_seg_to_mri ; v_seg = VectorAlloc(4, MATRIX_REAL) ; v_mri = VectorAlloc(4, MATRIX_REAL) ; VECTOR_ELT(v_seg, 4) = 1.0 ; VECTOR_ELT(v_mri, 4) = 1.0 ; mri_seg = MRIread(argv[2]) ; if (!mri_seg) ErrorExit(ERROR_NOFILE, "%s: could not read volume from %s",Progname, argv[2]) ; if (erode) { MRI *mri_tmp ; mri_tmp = MRIclone(mri_seg, NULL) ; MRIcopyLabel(mri_seg, mri_tmp, segmentation_flag) ; while (erode-- > 0) MRIerode(mri_tmp, mri_tmp) ; MRIcopy(mri_tmp, mri_seg) ; MRIfree(&mri_tmp) ; } m_seg_to_mri = MRIgetVoxelToVoxelXform(mri_seg, mri) ; for (x = 0 ; x < mri_seg->width ; x++) { V3_X(v_seg) = x ; for (y = 0 ; y < mri_seg->height ; y++) { V3_Y(v_seg) = y ; for (z = 0 ; z < mri_seg->depth ; z++) { V3_Z(v_seg) = z ; if (MRIvox(mri_seg, x, y, z) == segmentation_flag) { MatrixMultiply(m_seg_to_mri, v_seg, v_mri) ; xv = V3_X(v_mri) ; yv = V3_Y(v_mri) ; zv = V3_Z(v_mri) ; MRIsampleVolumeType(mri, xv, yv, zv, &val, SAMPLE_NEAREST);#if 0 if (val < .000001) {//.........这里部分代码省略.........
开发者ID:neurodebian,项目名称:freesurfer,代码行数:101,
示例22: mainintmain (int argc, char * argv []){ RENDER render = { NULL, NULL, NULL, 0, 0, /* width, height */ true, false, false, /* border, log_freq, gray_scale */ 0.0, 0.0, 0.0, /* {min,max,fft}_freq */ KAISER, SPEC_FLOOR_DB } ; int k ; if (argc < 5) usage_exit (argv [0], 0) ; for (k = 1 ; k < argc - 4 ; k++) { double fval ; if (sscanf (argv [k], "--dyn-range=%lf", &fval) == 1) { render.spec_floor_db = -1.0 * fabs (fval) ; continue ; } if (strcmp (argv [k], "--no-border") == 0) { render.border = false ; continue ; } ; if (strcmp (argv [k], "--log-freq") == 0) { render.log_freq = true ; continue ; } ; if (sscanf (argv [k], "--min-freq=%lf", &fval) == 1) { if (fval < 0.0) { printf ("--min-freq cannot be negative./n") ; exit (1) ; } ; render.min_freq = fval ; continue ; } if (sscanf (argv [k], "--max-freq=%lf", &fval) == 1) { render.max_freq = fabs (fval) ; continue ; } if (sscanf (argv [k], "--fft-freq=%lf", &fval) == 1) { if (fval <= 0.0) { printf ("--fft-freq must be positive./n") ; exit (1) ; } ; render.fft_freq = fabs (fval) ; continue ; } if (sscanf (argv [k], "--dyn-range=%lf", &fval) == 1) { render.spec_floor_db = -1.0 * fabs (fval) ; continue ; } if (strcmp (argv [k], "--gray-scale") == 0) { render.gray_scale = true ; continue ; } ; if (strcmp (argv [k], "--rectangular") == 0) { render.window_function = RECTANGULAR ; continue ; } ; if (strcmp (argv [k], "--kaiser") == 0) { render.window_function = KAISER ; continue ; } ; if (strcmp (argv [k], "--nuttall") == 0) { render.window_function = NUTTALL ; continue ; } ; if (strcmp (argv [k], "--hann") == 0) { render.window_function = HANN ; continue ; } ; printf ("/nError : Bad command line argument '%s'/n", argv [k]) ; usage_exit (argv [0], 1) ; } ; render.sndfilepath = argv [k] ; render.width = parse_int_or_die (argv [k + 1], "width") ; render.height = parse_int_or_die (argv [k + 2], "height") ; render.pngfilepath = argv [k + 3] ; render.filename = strrchr (render.sndfilepath, '/') ; render.filename = (render.filename != NULL) ? render.filename + 1 : render.sndfilepath ; render_sndfile (&render) ;//.........这里部分代码省略.........
开发者ID:erikd,项目名称:sndfile-tools,代码行数:101,
示例23: mainintmain(int argc, char *argv[]){ char **av, surf_fname[STRLEN], *template_fname, *hemi, *sphere_name, *cp, *subject, fname[STRLEN] ; int ac, nargs, ino, sno, nbad = 0, failed, n,nfields; VERTEX *v; VALS_VP *vp; MRI_SURFACE *mris ; MRI_SP *mrisp, /* *mrisp_aligned,*/ *mrisp_template ; INTEGRATION_PARMS parms ; /* rkt: check for and handle version tag */ nargs = handle_version_option (argc, argv, "$Id: mris_make_template.c,v 1.27 2011/03/02 00:04:33 nicks Exp $", "$Name: stable5 $"); if (nargs && argc - nargs == 1) exit (0); argc -= nargs; memset(&parms, 0, sizeof(parms)) ; Progname = argv[0] ; ErrorInit(NULL, NULL, NULL) ; DiagInit(NULL, NULL, NULL) ; /* setting default values for vectorial registration */ setParms(&parms); ac = argc ; av = argv ; for ( ; argc > 1 && ISOPTION(*argv[1]) ; argc--, argv++) { nargs = get_option(argc, argv,&parms) ; argc -= nargs ; argv += nargs ; } if (argc < 5) usage_exit() ; /* multiframe registration */ if (multiframes) parms.flags |= IP_USE_MULTIFRAMES; if (!strlen(subjects_dir)) /* not specified on command line*/ { cp = getenv("SUBJECTS_DIR") ; if (!cp) ErrorExit(ERROR_BADPARM, "%s: SUBJECTS_DIR not defined in environment./n", Progname) ; strcpy(subjects_dir, cp) ; } hemi = argv[1] ; sphere_name = argv[2] ; template_fname = argv[argc-1] ; if (1 || !FileExists(template_fname)) /* first time - create it */ { fprintf(stderr, "creating new parameterization.../n") ; if (multiframes) { mrisp_template = MRISPalloc(scale, atlas_size * IMAGES_PER_SURFACE ); /* if (no_rot) //* don't do rigid alignment *// */ /* mrisp_aligned = NULL ; */ /* else */ /* mrisp_aligned = MRISPalloc(scale, PARAM_FRAMES); */ } else { mrisp_template = MRISPalloc(scale, PARAM_IMAGES); /* if (no_rot) //* don't do rigid alignment *// */ /* mrisp_aligned = NULL ; */ /* else */ /* mrisp_aligned = MRISPalloc(scale, PARAM_IMAGES); */ } } else { fprintf(stderr, "reading template parameterization from %s.../n", template_fname) ; /* mrisp_aligned = NULL ; */ mrisp_template = MRISPread(template_fname) ; if (!mrisp_template) ErrorExit(ERROR_NOFILE, "%s: could not open template file %s", Progname, template_fname) ; } argv += 3 ; argc -= 3 ; for (ino = 0 ; ino < argc-1 ; ino++) { failed = 0 ; subject = argv[ino] ; fprintf(stderr, "/nprocessing subject %s (%d of %d)/n", subject, ino+1, argc-1) ; sprintf(surf_fname, "%s/%s/surf/%s.%s", subjects_dir, subject, hemi, sphere_name) ; fprintf(stderr, "reading spherical surface %s.../n", surf_fname) ; mris = MRISread(surf_fname) ; if (!mris) {//.........这里部分代码省略.........
开发者ID:guo2004131,项目名称:freesurfer,代码行数:101,
示例24: get_option//.........这里部分代码省略......... lta_dst = MRIreadHeader(argv[2], MRI_VOLUME_TYPE_UNKNOWN); if (!lta_dst) { ErrorExit(ERROR_BADPARM, "Could not read file %s/n", argv[2]); } nargs = 1; } else if (!stricmp(option, "invert_transform") || !stricmp(option, "ait")) { transform_fname = argv[2]; transform_flag = 1; invert_flag = 1; nargs = 1; printf("Apply inversely the transformation specified by file %s/n", transform_fname); } /*E* Interpolation method. Default is trilinear, other options are nearest, cubic, sinc. You can say -foo or -interp foo. For sinc, you can say -interp sinc 3 or -interp sinc -hw 3 or -sinc 3 or -sinc -hw 3. Maybe -hw 3 should imply sinc, but right now it doesn't. */ else if (!stricmp(option, "st") || !stricmp(option, "sample") || !stricmp(option, "sample_type") || !stricmp(option, "interp")) { nargs = 1; if (!stricmp(argv[2], "bspline")) InterpMethod = SAMPLE_BSPLINE; else InterpMethod = MRIinterpCode(argv[2]) ; if (InterpMethod==SAMPLE_SINC) { if ((argc<4) || !strncmp(argv[3],"-",1)) /*E* i.e. no sinchalfwindow value supplied */ { printf("using sinc interpolation (default windowwidth is 6)/n"); } else { sinchalfwindow = atoi(argv[3]); nargs = 2; printf("using sinc interpolation with windowwidth of %d/n", 2*sinchalfwindow); } } else if (InterpMethod == SAMPLE_BSPLINE) { if ((argc<4) || !strncmp(argv[3],"-",1)) /* i.e. no spline-degree value supplied */ { printf("using BSPline interpolation (default Bspline degree is 3)/n"); } else { SplineDegree = atoi(argv[3]); nargs = 2; printf("using BSpline interpolation with degree of %d/n", SplineDegree); } } } else if (!stricmp(option, "sinc")) { InterpMethod = SAMPLE_SINC; if ((argc<3) || !strncmp(argv[2],"-",1)) /*E* i.e. no sinchalfwindow value supplied */ { printf("using sinc interpolation (default windowwidth is 6)/n"); } else { sinchalfwindow = atoi(argv[2]); nargs = 1; printf("using sinc interpolation with windowwidth of %d/n", 2*sinchalfwindow); } } else if (!stricmp(option, "bspline")) { InterpMethod = SAMPLE_BSPLINE; if ((argc<3) || !strncmp(argv[2],"-",1)) /*E* i.e. no spline degree supplied */ { printf("using cubic-bspline interpolation /n"); } else { SplineDegree = atoi(argv[2]); nargs = 1; printf("using B-spline interpolation with degree of %d/n", SplineDegree); } } else if (!stricmp(option, "sinchalfwindow") || !stricmp(option, "hw")) { InterpMethod = SAMPLE_SINC; sinchalfwindow = atoi(argv[2]); nargs = 1; printf("using sinc interpolation with windowwidth of %d/n", 2*sinchalfwindow); } else if (!stricmp(option, "trilinear")) { InterpMethod = SAMPLE_TRILINEAR; printf("using trilinear interpolation/n"); } else if (!stricmp(option, "cubic")) { InterpMethod = SAMPLE_CUBIC; printf("using cubic interpolation/n"); } else if (!stricmp(option, "nearest")) { InterpMethod = SAMPLE_NEAREST; printf("using nearest-neighbor interpolation/n"); } else switch (toupper(*option)) { case '?': case 'U': usage_exit(0) ; break ; default: printf("unknown option %s/n", argv[1]) ; exit(1) ; break ; } return(nargs) ;}
开发者ID:guo2004131,项目名称:freesurfer,代码行数:101,
示例25: mainint main (int argc, char* const argv[]){ ssize_t bufsz = 0, niter = 0; const char *fname = NULL; int rc = 0; struct test_spec sp; static const int MIN_ARGC = 3; if (argc < MIN_ARGC) { usage_exit (argv[0]); } (void) memset (&sp, 0, sizeof(sp)); rc = read_opt (argc, argv, &sp); if (rc) return EINVAL; /* uses getopt, exposes optind*/ if (argc < (optind + 2)) { /* expecting at least 2 more arguments */ (void) fprintf (stderr, "%s: expecting 2 mandatory parameters " "after option flags/n", argv[0]); usage_exit (argv[0]); } fname = argv[optind]; ++optind; bufsz = (ssize_t) atol (argv[optind]); if ((bufsz < (ssize_t)MIN_BUFSZ) || (bufsz > (ssize_t)MAX_BUFSZ)) { (void) fprintf (stderr, "%s: buffer size [%s] must be within [%ld .. %ld] range/n", argv[0], argv[optind], (long)MIN_BUFSZ, (long)MAX_BUFSZ); return EINVAL; } sp.len = bufsz; ++optind; if (0 >= (niter = (ssize_t) atol (argv[optind]))) { (void) fprintf (stderr, "%s: invalid value for niter: %s/n", argv[0], argv[optind]); return EINVAL; } sp.niter = niter; ++optind; if (!sp.len) sp.len = MIN_BUFSZ; if (!sp.incr) sp.incr = MIN_INCR; if (!sp.nincr) sp.nincr = MIN_NINCR; if (sp.num_chunks >= sp.len) { (void) fprintf (stderr, "%s: number of chunks (-U option) [%ld] " "should not exceed buffer size [%ld]/n", argv[0], (long)sp.num_chunks, (long)sp.len); return EINVAL; } setbuf (stdout, NULL); rc = run_odsync (fname, &sp); return rc;}
开发者ID:pcherenkov,项目名称:bsl45-misc.tools,代码行数:61,
示例26: dievoid die(const char *fmt, ...) { LOG_ERROR(NULL); usage_exit();}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:4,
示例27: mainint main(int argc, char *argv[]){ char **av, *surf_name, *out_prefix, *fname; int nargs, ac, i, nsubjects, total, index; double scalar, std, tmp, maxV, minV, meanV; MRI *SrcVals[2], *AvgVals; MRI_SURFACE *BaseSurf; /* rkt: check for and handle version tag */ nargs = handle_version_option (argc, argv, "$Id: mris_diff_on_surface.c,v 1.3 2011/03/02 00:04:55 nicks Exp $", "$Name: $"); if (nargs && argc - nargs == 1) exit (0); argc -= nargs; Progname = argv[0] ; ErrorInit(NULL, NULL, NULL) ; DiagInit(NULL, NULL, NULL) ; ac = argc ; av = argv ; for ( ; argc > 1 && ISOPTION(*argv[1]) ; argc--, argv++) { nargs = get_option(argc, argv) ; argc -= nargs ; argv += nargs ; } /* command line: <surf> <datafile 1> <datafile 2> <output prefix> */ if (argc != 5) usage_exit(); surf_name = argv[1]; out_prefix = argv[argc - 1]; if (srctypestring == NULL || trgtypestring == NULL) { printf("Please specify both input and output data type!/n"); usage_exit(); } printf("Reading underlying surface file/n"); BaseSurf = MRISread(surf_name); if (!BaseSurf) ErrorExit(ERROR_NOFILE, "%s:could not read surface %s", Progname, surf_name); printf("Base surface has %d vertices/n", BaseSurf->nvertices); /* Read in the first data file */ fname = argv[2]; /* only two data types are supported */ if (!strcmp(srctypestring,"curv")) { /* curvature file */ if (MRISreadCurvatureFile(BaseSurf, fname) != 0) { printf("ERROR: reading curvature file/n"); exit(1); } SrcVals[0] = MRIcopyMRIS(NULL, BaseSurf, 0, "curv"); } else if (!strcmp(srctypestring,"paint") || !strcmp(srctypestring,"w")) { MRISreadValues(BaseSurf,fname); SrcVals[0] = MRIcopyMRIS(NULL, BaseSurf, 0, "val"); } else { printf("ERROR: unknown data file format/n"); exit(1); } if (SrcVals[0] == NULL) { fprintf(stderr, "ERROR loading data values from %s/n", fname); } /* Read in the second data file */ fname = argv[3]; /* only two data types are supported */ if (!strcmp(srctypestring,"curv")) { /* curvature file */ if (MRISreadCurvatureFile(BaseSurf, fname) != 0) { printf("ERROR: reading curvature file/n"); exit(1); } SrcVals[1] = MRIcopyMRIS(NULL, BaseSurf, 0, "curv"); } else if (!strcmp(srctypestring,"paint") || !strcmp(srctypestring,"w")) { MRISreadValues(BaseSurf,fname); SrcVals[1] = MRIcopyMRIS(NULL, BaseSurf, 0, "val"); } else {//.........这里部分代码省略.........
开发者ID:ewong718,项目名称:freesurfer,代码行数:101,
示例28: mainintmain(int argc, char *argv[]) { TRANSFORM *transform = NULL ; char **av, fname[STRLEN], *gca_fname, *subject_name, *cp ; int ac, nargs, i, n ; int msec, minutes, seconds, nsubjects ; struct timeb start ; GCA *gca ; MRI *mri_parc, *mri_T1, *mri_PD ; FILE *fp ; /* rkt: check for and handle version tag */ nargs = handle_version_option (argc, argv, "$Id: mri_ca_tissue_parms.c,v 1.8 2011/03/02 00:04:14 nicks Exp $", "$Name: stable5 $"); if (nargs && argc - nargs == 1) exit (0); argc -= nargs; Progname = argv[0] ; ErrorInit(NULL, NULL, NULL) ; DiagInit(NULL, NULL, NULL) ; TimerStart(&start) ; ac = argc ; av = argv ; for ( ; argc > 1 && ISOPTION(*argv[1]) ; argc--, argv++) { nargs = get_option(argc, argv) ; argc -= nargs ; argv += nargs ; } if (!strlen(subjects_dir)) /* hasn't been set on command line */ { cp = getenv("SUBJECTS_DIR") ; if (!cp) ErrorExit(ERROR_BADPARM, "%s: SUBJECTS_DIR not defined in environment", Progname); strcpy(subjects_dir, cp) ; if (argc < 3) usage_exit(1) ; } gca_fname = argv[1] ; nsubjects = argc-2 ; printf("computing average tissue parameters on %d subject/n", nsubjects) ; n = 0 ; printf("reading GCA from %s.../n", gca_fname) ; gca = GCAread(gca_fname) ; for (i = 0 ; i < nsubjects ; i++) { subject_name = argv[i+2] ; printf("processing subject %s, %d of %d.../n", subject_name,i+1, nsubjects); sprintf(fname, "%s/%s/mri/%s", subjects_dir, subject_name, parc_dir) ; if (DIAG_VERBOSE_ON) printf("reading parcellation from %s.../n", fname) ; mri_parc = MRIread(fname) ; if (!mri_parc) ErrorExit(ERROR_NOFILE, "%s: could not read parcellation file %s", Progname, fname) ; sprintf(fname, "%s/%s/mri/%s", subjects_dir, subject_name, T1_name) ; if (DIAG_VERBOSE_ON) printf("reading co-registered T1 from %s.../n", fname) ; mri_T1 = MRIread(fname) ; if (!mri_T1) ErrorExit(ERROR_NOFILE, "%s: could not read T1 data from file %s", Progname, fname) ; sprintf(fname, "%s/%s/mri/%s", subjects_dir, subject_name, PD_name) ; if (DIAG_VERBOSE_ON) printf("reading co-registered T1 from %s.../n", fname) ; mri_PD = MRIread(fname) ; if (!mri_PD) ErrorExit(ERROR_NOFILE, "%s: could not read PD data from file %s", Progname, fname) ; if (xform_name) { /* VECTOR *v_tmp, *v_tmp2 ;*/ sprintf(fname, "%s/%s/mri/%s", subjects_dir, subject_name, xform_name) ; printf("reading xform from %s.../n", fname) ; transform = TransformRead(fname) ; if (!transform) ErrorExit(ERROR_NOFILE, "%s: could not read xform from %s", Progname, fname) ;#if 0 v_tmp = VectorAlloc(4,MATRIX_REAL) ; *MATRIX_RELT(v_tmp,4,1)=1.0 ; v_tmp2 = MatrixMultiply(lta->xforms[0].m_L, v_tmp, NULL) ; printf("RAS (0,0,0) -->/n") ; MatrixPrint(stdout, v_tmp2) ;#endif if (transform->type == LINEAR_RAS_TO_RAS) {//.........这里部分代码省略.........
开发者ID:guo2004131,项目名称:freesurfer,代码行数:101,
示例29: mainintmain (int argc, char **argv){ STATE state ; SF_INFO sfinfo ; char pathname [512], ext [32], *cptr ; int ch, double_split ; if (argc != 2) { if (argc != 1) puts ("/nError : need a single input file./n") ; usage_exit () ; } ; memset (&state, 0, sizeof (state)) ; memset (&sfinfo, 0, sizeof (sfinfo)) ; if ((state.infile = sf_open (argv [1], SFM_READ, &sfinfo)) == NULL) { printf ("/nError : Not able to open input file '%s'/n%s/n", argv [1], sf_strerror (NULL)) ; exit (1) ; } ; if (sfinfo.channels < 2) { printf ("/nError : Input file '%s' only has one channel./n", argv [1]) ; exit (1) ; } ; state.channels = sfinfo.channels ; sfinfo.channels = 1 ; snprintf (pathname, sizeof (pathname), "%s", argv [1]) ; if ((cptr = strrchr (pathname, '.')) == NULL) ext [0] = 0 ; else { snprintf (ext, sizeof (ext), "%s", cptr) ; cptr [0] = 0 ; } ; printf ("Input file : %s/n", pathname) ; puts ("Output files :") ; for (ch = 0 ; ch < state.channels ; ch++) { char filename [520] ; snprintf (filename, sizeof (filename), "%s_%02d%s", pathname, ch, ext) ; if ((state.outfile [ch] = sf_open (filename, SFM_WRITE, &sfinfo)) == NULL) { printf ("Not able to open output file '%s'/n%s/n", filename, sf_strerror (NULL)) ; exit (1) ; } ; printf (" %s/n", filename) ; } ; switch (sfinfo.format & SF_FORMAT_SUBMASK) { case SF_FORMAT_FLOAT : case SF_FORMAT_DOUBLE : case SF_FORMAT_VORBIS : double_split = 1 ; break ; default : double_split = 0 ; break ; } ; if (double_split) deinterleave_double (&state) ; else deinterleave_int (&state) ; sf_close (state.infile) ; for (ch = 0 ; ch < MAX_CHANNELS ; ch++) if (state.outfile [ch] != NULL) sf_close (state.outfile [ch]) ; return 0 ;} /* main */
开发者ID:74Labs,项目名称:libsndfile,代码行数:77,
注:本文中的usage_exit函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ usage_with_options函数代码示例 C++ usage_error函数代码示例 |