Skip to content

Commit

Permalink
mri_surf2volseg. #NF. Added WM in the input segmentation with surface…
Browse files Browse the repository at this point in the history
… annotation</explanation>
  • Loading branch information
Douglas Greve committed Feb 6, 2022
1 parent 11696c6 commit 9236c86
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
12 changes: 10 additions & 2 deletions mri_aparc2aseg/mri_surf2volseg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class Surf2VolSeg {
std::string lhcortexlabelpath, rhcortexlabelpath;
std::string lhannotname="lh.aparc.annot", lhannotpath, rhannotname="rh.aparc.annot", rhannotpath;
int lhbaseoffset = 1000, rhbaseoffset = 2000;
int lhwmunlabeled = 5001,rhwmunlabeled = 5002;
int nHopsMax = 5;
int RipUnknown = 0;
int LabelHypoAsWM = 0;
Expand Down Expand Up @@ -227,6 +228,13 @@ static int parse_commandline(int argc, char **argv)
s2vseg.RipUnknown = 1;
s2vseg.LabelHypoAsWM = 1;
}
else if (!strcmp(option, "--label-wm-unknown")){
// Set values for the unknown label in labeling WM, default is 5001 and 5002
if(nargc < 2) CMDargNErr(option,2);
sscanf(pargv[0],"%d",&s2vseg.lhwmunlabeled);
sscanf(pargv[1],"%d",&s2vseg.rhwmunlabeled);
nargsused = 2;
}
else if (!strcmp(option, "--lh-white")){
if (nargc < 1) CMDargNErr(option,1);
s2vseg.lhwhitepath = pargv[0];
Expand Down Expand Up @@ -478,11 +486,11 @@ int Surf2VolSeg::RelabelSegVox(int c, int r, int s, int *ndotcheck, int *hemi, i
if(*dmin > wmparc_dist_thresh) newsegid = 0;
if(*hemi == 1) {
if(newsegid > 0) newsegid += lhbaseoffset;
else newsegid = 5001;
else newsegid = lhwmunlabeled;
}
if(*hemi == 2){
if(newsegid > 0) newsegid += rhbaseoffset;
else newsegid = 5002;
else newsegid = rhwmunlabeled;
}
}
if(debug) printf("RelabelSegVox(): %d %d %d %d %d %d %d %d %g\n",c,r,s,volsegid,newsegid,*ndotcheck,*hemi,*surftype,*dmin);
Expand Down
6 changes: 4 additions & 2 deletions mri_aparc2aseg/mri_surf2volseg.help.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
]>

<help>
<name>mri_surf2segvol</name>
<synopsis>mri_surf2segvol [options]</synopsis>
<name>mri_surf2volseg</name>
<synopsis>mri_surf2volseg [options]</synopsis>
<description> Performs three functions: (1) cleans up presurf aseg cortex and WM. (2) maps cortical labels from an annotation into a volume, and (3) labels cerebral WM with closest cortical label. This is a replacement for mri_aparc2aseg.
</description>

Expand Down Expand Up @@ -62,6 +62,8 @@
<explanation>Relabel cortex in the input segmentation with surface annotation</explanation>
<argument>--label-wm</argument>
<explanation>Relabel cerebral WM in the input segmentation with surface annotation</explanation>
<argument>--label-wm-unknown lhval rhval</argument>
<explanation>Relabel unknown WM as lhval and rhval (default is 5001 and 5002)</explanation>

<argument>--lh-annot lhannotation lhbaseoffset</argument>
<explanation>lh annotation for --label-cortex and --label-wm</explanation>
Expand Down

0 comments on commit 9236c86

Please sign in to comment.