本文整理汇总了C++中ISOPTION函数的典型用法代码示例。如果您正苦于以下问题:C++ ISOPTION函数的具体用法?C++ ISOPTION怎么用?C++ ISOPTION使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ISOPTION函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int
main(int argc, char *argv[]) {
char **av, *in_fname, *out_fname ;
int ac, nargs ;
MRI_SURFACE *mris ;
float alpha, beta, gamma ;
/* rkt: check for and handle version tag */
nargs = handle_version_option (argc, argv, "$Id: mris_rotate.c,v 1.6 2011/03/02 00:04:33 nicks Exp $", "$Name: stable5 $");
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 < 6)
usage_exit() ;
in_fname = argv[1] ;
if (sscanf(argv[2], "%f", &alpha) != 1)
ErrorExit(ERROR_BADPARM, "%s: could not scan alpha from %s",
Progname, argv[2]) ;
if (sscanf(argv[3], "%f", &beta) != 1)
ErrorExit(ERROR_BADPARM, "%s: could not scan beta from %s",
Progname, argv[3]) ;
if (sscanf(argv[4], "%f", &gamma) != 1)
ErrorExit(ERROR_BADPARM, "%s: could not scan gamma from %s",
Progname, argv[4]) ;
out_fname = argv[5] ;
mris = MRISfastRead(in_fname) ;
if (!mris)
ErrorExit(ERROR_NOFILE, "%s: could not read surface file %s",
Progname, in_fname) ;
alpha = RADIANS(alpha) ;
beta = RADIANS(beta) ;
gamma = RADIANS(gamma) ;
MRIScenter(mris, mris) ;
MRISrotate(mris, mris, alpha, beta, gamma) ;
if (!mris)
ErrorExit(ERROR_NOFILE, "%s: could not rotate surface", Progname) ;
if (Gdiag & DIAG_SHOW)
fprintf(stderr, "writing rotated surface to %s\n", out_fname) ;
MRISwrite(mris, out_fname) ;
exit(0) ;
return(0) ; /* for ansi */
}
示例2: main
int
main(int argc, char *argv[]) {
char **av, *out_vol ;
int ac, nargs ;
MRI *mri_time1, *mri_time2, *mri_tmp, *mri_atrophy ;
TRANSFORM *transform1, *transform2 ;
/* rkt: check for and handle version tag */
nargs = handle_version_option (argc, argv, "$Id: mri_map_atrophy.c,v 1.4 2011/03/02 00:04:22 nicks Exp $", "$Name: stable5 $");
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 < 6)
usage_exit() ;
out_vol = argv[argc-1] ;
printf("reading volume from %s...\n", argv[1]) ;
mri_time1 = MRIread(argv[1]) ;
if (!mri_time1)
ErrorExit(ERROR_NOFILE, "%s: could not read MRI volume %s", Progname, argv[2]) ;
mri_time2 = MRIread(argv[2]) ;
if (!mri_time2)
ErrorExit(ERROR_NOFILE, "%s: could not read MRI volume %s", Progname, argv[2]) ;
transform1 = TransformRead(argv[3]) ;
if (!transform1)
ErrorExit(ERROR_NOFILE, "%s: could not read transform from %s", Progname, argv[3]) ;
transform2 = TransformRead(argv[4]) ;
if (!transform2)
ErrorExit(ERROR_NOFILE, "%s: could not read transform from %s", Progname, argv[4]) ;
mri_tmp = TransformApplyType(transform1, mri_time1, NULL, SAMPLE_NEAREST);
MRIfree(&mri_time1) ;
mri_time1 = mri_tmp ;
mri_tmp = TransformApplyType(transform2, mri_time2, NULL, SAMPLE_NEAREST);
MRIfree(&mri_time2) ;
mri_time2 = mri_tmp ;
mri_atrophy = make_atrophy_map(mri_time1, mri_time2, NULL, transform1, transform2, gray_labels, ngray, csf_labels, ncsf) ;
MRIwrite(mri_atrophy, out_vol) ;
exit(0) ;
return(0) ; /* for ansi */
}
示例3: main
int
main(int argc, char *argv[]) {
char **av ;
int ac, nargs ;
MRI *mri_src, *mri_dst = NULL ;
char *in_fname, *out_fname ;
/* rkt: check for and handle version tag */
nargs = handle_version_option (argc, argv, "$Id: mri_polv.c,v 1.6 2011/03/02 00:04:24 nicks Exp $", "$Name: stable5 $");
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 < 1)
argc = 1 ;
if (argc < 1)
ErrorExit(ERROR_BADPARM, "%s: no input name specified", Progname) ;
in_fname = argv[1] ;
if (argc < 2)
ErrorExit(ERROR_BADPARM, "%s: no output name specified", Progname) ;
out_fname = argv[2] ;
if (verbose)
fprintf(stderr, "reading from %s...", in_fname) ;
mri_src = MRIread(in_fname) ;
if (!mri_src)
ErrorExit(ERROR_NO_FILE, "%s: could not open source file %s",
Progname, in_fname) ;
if (verbose)
fprintf(stderr, "done.\ncalculating plane of least variance...") ;
mri_dst = MRIcentralPlaneOfLeastVarianceNormal(mri_src, NULL, window_size) ;
if (!mri_dst)
ErrorExit(ERROR_BADPARM, "%s: plane of least variance calculation failed",
Progname) ;
if (verbose)
fprintf(stderr, "\ndone. writing output to %s", out_fname) ;
MRIwrite(mri_dst, out_fname) ;
if (verbose)
fprintf(stderr, "\n") ;
exit(0) ;
return(0) ;
}
示例4: main
int
main(int argc, char *argv[]) {
char **av ;
int ac, nargs ;
MRI *mri_src, *mri_dst ;
char *in_fname, *out_fname ;
int label, nvox ;
/* rkt: check for and handle version tag */
nargs = handle_version_option (argc, argv, "$Id: mri_copy_values.c,v 1.5 2011/03/02 00:04:14 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 < 2)
ErrorExit(ERROR_BADPARM, "%s: no input name specified", Progname) ;
in_fname = argv[1] ;
if (argc < 3)
ErrorExit(ERROR_BADPARM, "%s: no value specified", Progname) ;
label = atoi(argv[2]) ;
if (argc < 4)
ErrorExit(ERROR_BADPARM, "%s: no output name specified", Progname) ;
out_fname = argv[3] ;
fprintf(stderr, "reading from %s...\n", in_fname) ;
mri_src = MRIread(in_fname) ;
if (!mri_src)
ErrorExit(ERROR_NOFILE, "%s: could not read input volume %s",
Progname, in_fname) ;
mri_dst = MRIread(out_fname) ;
if (!mri_dst)
ErrorExit(ERROR_NOFILE, "%s: could not read destination volume %s",
Progname, out_fname) ;
nvox = MRIcopyLabel(mri_src, mri_dst, label) ;
fprintf(stderr, "%d voxels copied from input to output volume...\n", nvox);
fprintf(stderr, "writing to %s...\n", out_fname) ;
MRIwrite(mri_dst, out_fname) ;
MRIfree(&mri_dst) ;
MRIfree(&mri_src) ;
exit(0) ;
return(0) ;
}
示例5: main
int
main(int argc, char *argv[]) {
char **av ;
int ac, nargs, i ;
MRI *mri_src, *mri_dst = NULL ;
char *in_fname, *out_fname ;
/* rkt: check for and handle version tag */
nargs = handle_version_option (argc, argv, "$Id: mri_reduce.c,v 1.7 2011/03/02 00:04:24 nicks Exp $", "$Name: stable5 $");
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 < 1)
argc = 1 ;
if (argc < 1)
ErrorExit(ERROR_BADPARM, "%s: no input name specified", Progname) ;
in_fname = argv[1] ;
if (argc < 2)
ErrorExit(ERROR_BADPARM, "%s: no output name specified", Progname) ;
out_fname = argv[2] ;
fprintf(stderr, "reading from %s...", in_fname) ;
mri_src = MRIread(in_fname) ;
i = 0 ;
do {
if (i)
mri_src = MRIcopy(mri_dst, NULL) ;
fprintf(stderr, "\nreducing by 2");
mri_dst = MRIallocSequence(mri_src->width/2, mri_src->height/2, mri_src->depth/2, MRI_FLOAT, mri_src->nframes);
MRIreduce(mri_src, mri_dst) ;
MRIfree(&mri_src) ;
} while (++i < reductions) ;
fprintf(stderr, "\nwriting to %s", out_fname) ;
MRIwrite(mri_dst, out_fname) ;
fprintf(stderr, "\n") ;
exit(0) ;
return(0) ;
}
示例6: main
int
main(int argc, char *argv[]) {
char **av ;
int ac, nargs ;
MRI *mri_src, *mri_ref, *mri_tmp ;
double accuracy ;
MRI_REGION box ;
/* rkt: check for and handle version tag */
nargs = handle_version_option (argc, argv, "$Id: mri_label_accuracy.c,v 1.2 2011/03/02 00:04:22 nicks Exp $", "$Name: stable5 $");
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(1) ;
mri_src = MRIread(argv[1]) ;
if (mri_src == NULL)
ErrorExit(ERROR_BADPARM, "%s: could not read input volume %s\n", Progname,argv[1]);
MRIboundingBox(mri_src, 0, &box) ;
mri_tmp = MRIextractRegionAndPad(mri_src, NULL, &box, PAD) ;
MRIfree(&mri_src) ; mri_src = mri_tmp ;
if (mri_src->type == MRI_SHORT)
{
mri_tmp = MRIchangeType(mri_src, MRI_FLOAT, 0, 0, 0) ;
MRIfree(&mri_src) ; mri_src = mri_tmp ;
}
mri_ref = MRIread(argv[2]) ;
if (mri_ref == NULL)
ErrorExit(ERROR_BADPARM, "%s: could not read reference volume %s\n", Progname,argv[1]);
MRIboundingBox(mri_ref, 0, &box) ;
mri_tmp = MRIextractRegionAndPad(mri_ref, NULL, &box, PAD) ;
MRIfree(&mri_ref) ; mri_ref = mri_tmp ;
accuracy = MRIcomputeLabelAccuracy(mri_src, mri_ref, MRI_MEAN_MIN_DISTANCE, stdout) ;
if (Gdiag_fp)
fclose(Gdiag_fp) ;
exit(0) ;
return(0) ;
}
示例7: main
int
main(int argc, char *argv[]) {
char **av ;
int ac, nargs, nsize ;
MRI_SURFACE *mris ;
MRI *mri ;
nargs = handle_version_option (argc, argv, "$Id: mris_nudge.c,v 1.2 2011/03/02 00:04:31 nicks Exp $", "$Name: stable5 $");
if (nargs && argc - nargs == 1)
exit (0);
argc -= nargs;
Gx = Gy = Gz = -1 ;
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 < 7)
usage_exit(1) ;
mris = MRISread(argv[1]) ;
if (mris == NULL)
ErrorExit(ERROR_NOFILE, "%s: could not read surface from %s", Progname, argv[1]) ;
MRIScomputeMetricProperties(mris) ;
MRISstoreMetricProperties(mris) ;
mri = MRIread(argv[2]) ;
if (mri == NULL)
ErrorExit(ERROR_NOFILE, "%s: could not read volume from %s", Progname, argv[2]) ;
target_vnos[nvertices] = atoi(argv[3]) ;
target_vals[nvertices] = atof(argv[4]) ;
nsize = atoi(argv[5]) ;
printf("nudging %d vertex region around vertex %d to target val %2.1f\n",
nsize, target_vnos[nvertices], target_vals[nvertices]) ;
nvertices++ ;
MRISerodeRipped(mris, nsize) ;
MRISrepositionSurface(mris, mri, target_vnos, target_vals, nvertices, nsize, sigma) ;
MRISunrip(mris) ;
printf("writing repositioned surface to %s\n", argv[6]) ;
MRISwrite(mris, argv[6]) ;
return(0) ;
}
示例8: main
/***-------------------------------------------------------****/
int main(int argc, char *argv[])
{
int nargs, index, ac, nvolumes;
char **av ;
MRI *mri_and = NULL, *mri ;
/* rkt: check for and handle version tag */
nargs = handle_version_option (argc, argv, vcid, "$Name: $");
if (nargs && argc - nargs == 1)
exit (0);
Progname = argv[0] ;
argc -= nargs;
ac = argc ;
av = argv ;
for ( ; argc > 1 && ISOPTION(*argv[1]) ; argc--, argv++)
{
nargs = get_option(argc, argv) ;
argc -= nargs ;
argv += nargs ;
}
nvolumes = argc-2 ;
if (nvolumes <= 0)
usage_exit() ;
printf("processing %d input files\n", nvolumes) ;
ErrorInit(NULL, NULL, NULL) ;
DiagInit(NULL, NULL, NULL) ;
for (index = 0 ; index < nvolumes ; index++)
{
char *fname = argv[index+1] ;
printf("processing input volume %d of %d: %s\n",
index+1, nvolumes, fname) ;
mri = MRIread(fname) ;
if (index == 0)
mri_and = MRIcopy(mri, NULL) ;
else
MRIand(mri, mri_and, mri_and, 0) ;
MRIfree(&mri) ;
}
printf("writing output to %s\n", argv[argc-1]) ;
MRIwrite(mri_and, argv[argc-1]) ;
exit(0);
} /* end main() */
示例9: main
int
main(int argc, char *argv[])
{
MRI_SURFACE *mris ;
char **av, *in_fname, *out_fname ;
int ac, nargs ;
MRI *mri_distance ;
/* rkt: check for and handle version tag */
nargs = handle_version_option
(argc, argv,
"$Id: mris_distance_map.c,v 1.2 2011/03/02 00:04:31 nicks Exp $",
"$Name: stable5 $");
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] ;
mris = MRISread(in_fname) ;
if (mris == NULL)
ErrorExit(ERROR_NOFILE, "%s: could not load surface %s", Progname, out_fname) ;
mri_distance = MRIScomputeDistanceMap(mris, NULL, ref_vertex_no) ;
MRIwrite(mri_distance, out_fname) ;
MRISfree(&mris) ;
exit(0) ;
return(0) ; /* for ansi */
}
示例10: main
int
main(int argc, char *argv[]) {
char **av, *in_fname, *out_fname ;
int ac, nargs ;
MRI_SURFACE *mris ;
float radius, scale ;
/* rkt: check for and handle version tag */
nargs = handle_version_option (argc, argv, "$Id: mris_rescale.c,v 1.5 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] ;
mris = MRISread(in_fname) ;
if (!mris)
ErrorExit(ERROR_NOFILE, "%s: could not read surface file %s",
Progname, in_fname) ;
radius = MRISaverageRadius(mris) ;
scale = DEFAULT_RADIUS / radius ;
MRISscaleBrain(mris, mris, scale) ;
MRISwrite(mris, out_fname) ;
exit(0) ;
return(0) ; /* for ansi */
}
示例11: main
int
main(int argc, char *argv[]) {
char **av, *out_fname, *in_fname ;
int ac, nargs ;
MRI_SURFACE *mris ;
MRI *mri_interior, *mri_template = NULL, *mri_buffer = NULL;
char cmdline[CMD_LINE_LEN] ;
make_cmd_version_string
(argc, argv,
"$Id: mris_fill.c,v 1.6 2011/03/02 00:04:32 nicks Exp $", "$Name: $",
cmdline);
/* rkt: check for and handle version tag */
nargs = handle_version_option (argc, argv, "$Id: mris_fill.c,v 1.6 2011/03/02 00:04:32 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] ;
fprintf(stderr, "reading surface from %s...\n", in_fname) ;
mris = MRISread(in_fname) ;
if (template)
示例12: main
int
main(int argc, char *argv[]) {
char **av, fname[STRLEN] ;
int ac, nargs, i ;
char *in_fname, *out_fname ;
int msec, minutes, seconds ;
struct timeb start ;
/* rkt: check for and handle version tag */
nargs = handle_version_option (argc, argv, "$Id: main_template.c,v 1.5 2011/03/02 00:04:40 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 < 3)
usage_exit(1) ;
msec = TimerStop(&start) ;
seconds = nint((float)msec/1000.0f) ;
minutes = seconds / 60 ;
seconds = seconds % 60 ;
fprintf(stderr, "inverse operator application took %d minutes"
" and %d seconds.\n", minutes, seconds) ;
exit(0) ;
return(0) ;
}
示例13: main
int
main(int argc, char *argv[])
{
char *in_fname, *out_fname, **av, *xform_fname, fname[STRLEN] ;
MRI *mri_in, *mri_tmp ;
int ac, nargs, msec, minutes, seconds;
int input, ninputs ;
struct timeb start ;
TRANSFORM *transform = NULL ;
char cmdline[CMD_LINE_LEN], line[STRLEN], *cp, subject[STRLEN], sdir[STRLEN], base_name[STRLEN] ;
FILE *fp ;
make_cmd_version_string
(argc, argv,
"$Id: mri_fuse_intensity_images.c,v 1.2 2011/06/02 14:05:10 fischl Exp $",
"$Name: $", cmdline);
/* rkt: check for and handle version tag */
nargs = handle_version_option
(argc, argv,
"$Id: mri_fuse_intensity_images.c,v 1.2 2011/06/02 14:05:10 fischl Exp $",
"$Name: $");
if (nargs && argc - nargs == 1)
exit (0);
argc -= nargs;
setRandomSeed(-1L) ;
Progname = argv[0] ;
DiagInit(NULL, NULL, NULL) ;
ErrorInit(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 < 5)
ErrorExit
(ERROR_BADPARM,
"usage: %s [<options>] <longitudinal time point file> <in vol> <transform file> <out vol> \n",
Progname) ;
in_fname = argv[2] ;
xform_fname = argv[3] ;
out_fname = argv[4] ;
transform = TransformRead(xform_fname) ;
if (transform == NULL)
ErrorExit(ERROR_NOFILE, "%s: could not read transform from %s", Progname, xform_fname) ;
TimerStart(&start) ;
FileNamePath(argv[1], sdir) ;
cp = strrchr(sdir, '/') ;
if (cp)
{
strcpy(base_name, cp+1) ;
*cp = 0 ; // remove last component of path, which is base subject name
}
ninputs = 0 ;
fp = fopen(argv[1], "r") ;
if (fp == NULL)
ErrorExit(ERROR_NOFILE, "%s: could not read time point file %s", Progname, argv[1]) ;
do
{
cp = fgetl(line, STRLEN-1, fp) ;
if (cp != NULL && strlen(cp) > 0)
{
subjects[ninputs] = (char *)calloc(strlen(cp)+1, sizeof(char)) ;
strcpy(subjects[ninputs], cp) ;
ninputs++ ;
}
} while (cp != NULL && strlen(cp) > 0) ;
fclose(fp) ;
printf("processing %d timepoints in SUBJECTS_DIR %s...\n", ninputs, sdir) ;
for (input = 0 ; input < ninputs ; input++)
{
sprintf(subject, "%s.long.%s", subjects[input], base_name) ;
printf("reading subject %s - %d of %d\n", subject, input+1, ninputs) ;
sprintf(fname, "%s/%s/mri/%s", sdir, subject, in_fname) ;
mri_tmp = MRIread(fname) ;
if (!mri_tmp)
ErrorExit(ERROR_NOFILE, "%s: could not read input MR volume from %s",
Progname, fname) ;
MRImakePositive(mri_tmp, mri_tmp) ;
if (input == 0)
{
mri_in =
MRIallocSequence(mri_tmp->width, mri_tmp->height, mri_tmp->depth,
mri_tmp->type, ninputs) ;
if (!mri_in)
ErrorExit(ERROR_NOMEMORY,
"%s: could not allocate input volume %dx%dx%dx%d",
mri_tmp->width,mri_tmp->height,mri_tmp->depth,ninputs) ;
MRIcopyHeader(mri_tmp, mri_in) ;
}
//.........这里部分代码省略.........
示例14: main
int
main(int argc, char *argv[])
{
char **av, *in_fname, *out_fname ;
int ac, nargs, i, label ;
MRI *mri_in, *mri_out, *mri_kernel, *mri_smoothed ;
/* rkt: check for and handle version tag */
nargs = handle_version_option
(argc, argv,
"$Id: mri_extract_label.c,v 1.13 2011/03/02 00:04:15 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 < 4)
usage_exit() ;
in_fname = argv[1] ;
out_fname = argv[argc-1] ;
printf("reading volume from %s...\n", in_fname) ;
mri_in = MRIread(in_fname) ;
if (!mri_in)
ErrorExit(ERROR_NOFILE, "%s: could not read MRI volume %s", Progname,
in_fname) ;
if (out_like_fname)
{
MRI *mri_tmp = MRIread(out_like_fname) ;
if (!mri_tmp)
ErrorExit
(ERROR_NOFILE,
"%s: could not read template volume from %s",
out_like_fname) ;
mri_out = MRIalloc(mri_tmp->width,
mri_tmp->height,
mri_tmp->depth,
mri_tmp->type) ;
/* MRIcopyHeader(mri_tmp, mri_out) ;*/
MRIfree(&mri_tmp) ;
}
else
mri_out = MRIclone(mri_in, NULL) ;
for (i = 2 ; i < argc-1 ; i++)
{
label = atoi(argv[i]) ;
printf("extracting label %d (%s)\n", label, cma_label_to_name(label)) ;
extract_labeled_image(mri_in, transform, label, mri_out) ;
}
if (!FZERO(sigma))
{
printf("smoothing extracted volume...\n") ;
mri_kernel = MRIgaussian1d(sigma, 10*sigma) ;
mri_smoothed = MRIconvolveGaussian(mri_out, NULL, mri_kernel) ;
MRIfree(&mri_out) ;
mri_out = mri_smoothed ;
}
/* removed for gcc3.3
* vsprintf(out_fname, out_fname, (va_list) &label) ;
*/
if (dilate > 0)
{
int i ;
printf("dilating output volume %d times...\n", dilate) ;
for (i = 0 ; i < dilate ; i++)
MRIdilate(mri_out, mri_out) ;
}
if (erode > 0)
{
int i ;
printf("eroding output volume %d times...\n", erode) ;
for (i = 0 ; i < erode ; i++)
MRIerode(mri_out, mri_out) ;
}
printf("writing output to %s.\n", out_fname) ;
MRIwrite(mri_out, out_fname) ;
if (exit_none_found && (nvoxels == 0))
{
printf("No voxels with specified label were found!\n");
exit(1);
}
exit(0) ;
return(0) ; /* for ansi */
//.........这里部分代码省略.........
示例15: main
int
main(int argc, char *argv[]) {
char **av, *hemi, *subject_name, *cp, fname[STRLEN];
char *parc_name, *annot_name ;
int ac, nargs, vno, i ;
MRI_SURFACE *mris ;
MRI *mri_parc ;
VERTEX *v ;
double d ;
Real x, y, z, xw, yw, zw ;
/* rkt: check for and handle version tag */
nargs = handle_version_option (argc, argv,
"$Id: mris_sample_parc.c,v 1.31 2016/12/11 14:33:38 fischl 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 < 4)
usage_exit() ;
subject_name = argv[1] ;
hemi = argv[2] ;
parc_name = argv[3] ;
annot_name = argv[4] ;
if (strlen(sdir) == 0) /* if not specified explicitly as option */
{
cp = getenv("SUBJECTS_DIR") ;
if (!cp)
ErrorExit(ERROR_BADPARM,
"%s: SUBJECTS_DIR not defined in environment.\n", Progname) ;
strcpy(sdir, cp) ;
}
if (parc_name[0] == '/') // full path specified
strcpy(fname, parc_name) ;
else
sprintf(fname, "%s/%s/mri/%s", sdir, subject_name, parc_name) ;
printf("reading parcellation volume from %s...\n", fname) ;
mri_parc = MRIread(fname) ;
if (!mri_parc)
ErrorExit(ERROR_NOFILE, "%s: could not read input volume %s",
Progname, fname) ;
if (mask_fname) {
MRI *mri_mask, *mri_tmp ;
mri_tmp = MRIread(mask_fname) ;
if (mri_tmp == NULL)
ErrorExit(ERROR_BADPARM, "%s: could not load mask volume %s", Progname, mask_fname) ;
mri_mask = MRIclone(mri_tmp, NULL) ;
MRIcopyLabel(mri_tmp, mri_mask, mask_val) ;
MRIdilate(mri_mask, mri_mask) ;
MRIdilate(mri_mask, mri_mask) ;
MRIdilate(mri_mask, mri_mask) ;
MRIdilate(mri_mask, mri_mask) ;
MRIfree(&mri_tmp) ;
mri_tmp = MRIclone(mri_parc, NULL) ;
MRIcopyLabeledVoxels(mri_parc, mri_mask, mri_tmp, mask_val) ;
MRIfree(&mri_parc) ;
mri_parc = mri_tmp ;
if (Gdiag & DIAG_WRITE && DIAG_VERBOSE_ON)
MRIwrite(mri_parc, "p.mgz") ;
MRIfree(&mri_mask) ;
}
for (i = 0 ; i < ntrans ; i++) {
MRIreplaceValues(mri_parc, mri_parc, trans_in[i], trans_out[i]) ;
}
sprintf(fname, "%s/%s/surf/%s.%s", sdir, subject_name, hemi, surf_name) ;
printf("reading input surface %s...\n", fname) ;
mris = MRISread(fname) ;
if (!mris)
ErrorExit(ERROR_NOFILE, "%s: could not read surface file %s",
Progname, fname) ;
MRISsaveVertexPositions(mris, ORIGINAL_VERTICES) ;
MRIScomputeMetricProperties(mris) ;
if (avgs > 0)
MRISaverageVertexPositions(mris, avgs) ;
if (FZERO(proj_mm)) {
if (MRISreadCurvatureFile(mris, thickness_name) != NO_ERROR)
ErrorExit(ERROR_NOFILE, "%s: could not read thickness file %s",
Progname, thickness_name) ;
}
if (color_table_fname) {
//.........这里部分代码省略.........