@@ -47,6 +47,7 @@ static int use_thickness = 0 ;
47
47
static int nsurfaces = 1 ;
48
48
static const char *thickness_name = " thickness" ;
49
49
static const char *pial_name = " pial" ;
50
+ static const char *tmap_fname = NULL ;
50
51
static int nbrs = 2 ;
51
52
52
53
static char *orig_name = NULL ;
@@ -119,9 +120,16 @@ main(int argc, char *argv[])
119
120
ErrorExit (ERROR_BADPARM, " %s: could not open log file %s" , Progname, log_fname) ;
120
121
}
121
122
if (use_thickness)
122
- printf (" expanding surface %s by %2.1f%% of thickness "
123
- " and writing it to %s\n " ,
124
- in_fname, 100.0 *mm_out, out_fname) ;
123
+ {
124
+ if (use_thickness > 0 )
125
+ printf (" expanding surface %s by %2.1f%% of thickness "
126
+ " and writing it to %s\n " ,
127
+ in_fname, 100.0 *mm_out, out_fname) ;
128
+ else
129
+ printf (" expanding surface %s by percentages in %s "
130
+ " and writing it to %s\n " ,
131
+ in_fname, tmap_fname, out_fname) ;
132
+ }
125
133
else
126
134
printf (" expanding surface %s by %2.1f mm and writing it to %s\n " ,
127
135
in_fname, mm_out, out_fname) ;
@@ -138,7 +146,7 @@ main(int argc, char *argv[])
138
146
}
139
147
if (use_thickness)
140
148
{
141
- printf (" reading thickness...\n " ) ;
149
+ printf (" reading thickness %s ...\n " , thickness_name ) ;
142
150
if (MRISreadCurvatureFile (mris, thickness_name) != NO_ERROR)
143
151
ErrorExit (ERROR_NOFILE, " %s: could not load thickness file" , Progname) ;
144
152
MRISsaveVertexPositions (mris, WHITE_VERTICES) ;
@@ -160,6 +168,20 @@ main(int argc, char *argv[])
160
168
161
169
if (parms.mri_brain && FZERO (mris->vg .xsize ))
162
170
MRIScopyVolGeomFromMRI (mris, parms.mri_brain ) ;
171
+ if (tmap_fname != NULL )
172
+ {
173
+ parms.mri_dtrans = MRIread (tmap_fname);
174
+ if (parms.mri_dtrans == NULL )
175
+ ErrorExit (ERROR_NOFILE,
176
+ " %s: could not tmap vertex percentages from %s\n " , Progname, tmap_fname) ;
177
+ if (parms.mri_dtrans ->width != mris->nvertices )
178
+ ErrorExit (ERROR_NOFILE,
179
+ " %s: could not tmap width %d != mris->nvertices %d in %s\n " ,
180
+ Progname, parms.mri_dtrans ->width , mris->nvertices , tmap_fname) ;
181
+ printf (" setting vno distance to %f\n " , MRIgetVoxVal (parms.mri_dtrans , 0 , 0 , 0 , 0 ));
182
+ }
183
+ else
184
+ parms.mri_dtrans = NULL ;
163
185
MRISexpandSurface (mris, mm_out, &parms, use_thickness, nsurfaces);
164
186
#if 0
165
187
if (navgs > 0)
@@ -313,6 +335,13 @@ get_option(int argc, char *argv[])
313
335
printf (" reading pial surface from %s\n " , pial_name) ;
314
336
nargs = 1 ;
315
337
}
338
+ else if (!stricmp (option, " tmap" ))
339
+ {
340
+ use_thickness = -1 ;
341
+ tmap_fname = argv[2 ] ;
342
+ printf (" reading thickness target percent map from %s\n " , tmap_fname) ;
343
+ nargs = 1 ;
344
+ }
316
345
else switch (toupper (*option))
317
346
{
318
347
case ' O' :
@@ -384,5 +413,6 @@ usage_exit(int code)
384
413
Progname) ;
385
414
printf (" Example: mris_expand -thickness lh.white 0.5 lh.graymid\n " );
386
415
printf (" Example: mris_expand -label labelfile lh.white 0.5 lh.graymid\n " );
416
+ printf (" Example: mris_expand -tmap thickness_pct_target.mgz lh.white 0.5 lh.graymid\n " );
387
417
exit (code) ;
388
418
}
0 commit comments