Skip to content

Commit

Permalink
mri_surf2vol.cpp. #NF. Added --flat2mri to map a surface overlay into…
Browse files Browse the repository at this point in the history
… a 2D MRI based on a flat map
  • Loading branch information
Douglas Greve committed Apr 21, 2021
1 parent 39ac168 commit 199f13d
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion mri_surf2vol/mri_surf2vol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,26 @@ static int parse_commandline(int argc, char **argv) {
if (nargc < 1) argnerr(option,1);
precision = pargv[0];
nargsused = 1;
} else {
}
else if (!strcmp(option, "--flat2mri")) {
if(nargc < 6) argnerr(option,6);
// surf patch overlay res avg output
MRIS *surf = MRISread(pargv[0]);
if(surf==NULL) exit(1);
int err = MRISreadPatch(surf, pargv[1]);
if(err) exit(1);
MRI *overlay = MRIread(pargv[2]);
if(overlay == NULL) exit(1);
double res;
sscanf(pargv[3],"%lf",&res);
int DoAverage;
sscanf(pargv[4],"%d",&DoAverage);
MRI *mriflat = MRISflatMap2MRI(surf, overlay, res, DoAverage, NULL);
if(mriflat==NULL) exit(1);
err = MRIwrite(mriflat,pargv[5]);
exit(err);
}
else {
fprintf(stderr,"ERROR: Option %s unknown\n",option);
if (singledash(option))
fprintf(stderr," Did you really mean -%s ?\n",option);
Expand Down Expand Up @@ -669,6 +688,7 @@ static void print_usage(void) {
printf(" --merge vol : merge with this vol (becomes template)\n");
printf(" --o outfile : path to output volume\n");
printf(" --vtxvol vtxfile : vertex map volume path id\n");
printf(" --flat2mri surf patch overlay res avg output\n");
printf(" \n");
printf(" Applies to both methods\n");
printf(" --add const : add constant value to each non-zero output voxel\n");
Expand Down

0 comments on commit 199f13d

Please sign in to comment.