Skip to content

Commit

Permalink
mri_fill. #NF. Added new standalone option -pointset to fill in voxel…
Browse files Browse the repository at this point in the history
…s around a pointset (eg, with ento)
  • Loading branch information
Douglas Greve committed Dec 7, 2021
1 parent a9026cd commit f71e347
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
31 changes: 31 additions & 0 deletions mri_fill/mri_fill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include "talairachex.h"
#include "connectcomp.h"
#include "mrisegment.h"
#include "ctrpoints.h"


/*-------------------------------------------------------------------
Expand Down Expand Up @@ -3765,6 +3766,36 @@ get_option(int argc, char *argv[])
else if (!stricmp(option, "no-auto-man")) {
DoAutoMan = 0;
}
else if (!stricmp(option, "pointset")) {
/* Stand-alone option: takes one or more point sets and fills in
the all the voxels that intersect lines connecting any two
points within a given point set. Fill value determined by the
sign of the xcentroid of a point set. The orginal use case for
this was to help correct the surface in entorhinal cortex where
there would often be a "bite" out of the surface. See docs for
MRIreadControlPoints().
*/
if(argc < 4){
printf("-pointset invol outvol ps1 <ps2 ...>\n");
exit(1);
}
printf("Reading input %s\n",argv[2]);
MRI *invol = MRIread(argv[2]);
if(invol == NULL) exit(1);
char *outvolfile = argv[3];
int n;
for(n=0; n < argc-4; n++){
int count, useRealRAS;
printf("Reading control point file %s\n",argv[4+n]);
MPoint *mp = MRIreadControlPoints(argv[4+n], &count, &useRealRAS);
if(mp == NULL) exit(1);
MRIfillPoints(invol, 0, count, useRealRAS, mp);
free(mp);
}
printf("Writing output %s\n",outvolfile);
int err = MRIwrite(invol,outvolfile);
exit(err);
}
else switch (toupper(*option))
{
case 'P':
Expand Down
2 changes: 2 additions & 0 deletions mri_fill/mri_fill.help.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
<explanation>Get edits based on the difference between auto and man and apply to the output. Edit col,row,slice,autoval,manval will be written to the edits.txt file</explanation>
<argument>-no-auto-man </argument>
<explanation>Turns off -auto-man</explanation>
<argument>-pointset invol outvol ps {ps2 ...} </argument>
<explanation>Stand-alone option: takes one or more pointsets and fills in the all the voxels that intersect lines connecting any two points within a given point set.</explanation>
<argument>-ctab colortable </argument>
<explanation>Embed color table in the output </explanation>
</optional-flagged>
Expand Down

0 comments on commit f71e347

Please sign in to comment.