Skip to content

Commit adb11e9

Browse files
committed
gcsa.cpp - bug fix
- The 5th parameter double *pprob to GCSANclassify() expects a pointer to double array of len 3. - It is fixed in both GCSArelabelWithAseg() and GCSAreclassifyMarked(). - This should fix the mris_ca_label crash on Mac.
1 parent 891089f commit adb11e9

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

utils/gcsa.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2248,9 +2248,7 @@ int GCSArelabelWithAseg(GCSA *gcsa, MRI_SURFACE *mris, MRI *mri_aseg)
22482248
{
22492249
int old_index, vno, vno_classifier, vno_prior, label, index, changed, cc_annotation;
22502250
VERTEX *v, *v_classifier, *v_prior;
2251-
GCSA_NODE *gcsan;
2252-
CP_NODE *cpn;
2253-
double v_inputs[100], p;
2251+
double v_inputs[100], p[3];
22542252
double x, y, z;
22552253

22562254
for (changed = vno = 0; vno < mris->nvertices; vno++) {
@@ -2267,11 +2265,11 @@ int GCSArelabelWithAseg(GCSA *gcsa, MRI_SURFACE *mris, MRI *mri_aseg)
22672265
v_classifier = GCSAsourceToClassifierVertex(gcsa, v_prior);
22682266
vno_classifier = v_classifier - gcsa->mris_classifiers->vertices;
22692267
if (vno_classifier == Gdiag_no) DiagBreak();
2270-
gcsan = &gcsa->gc_nodes[vno_classifier];
2268+
GCSA_NODE *gcsan = &gcsa->gc_nodes[vno_classifier];
22712269

22722270
CTABfindAnnotation(mris->ct, v->annotation, &old_index);
22732271

2274-
cpn = &gcsa->cp_nodes[vno_prior];
2272+
CP_NODE *cpn = &gcsa->cp_nodes[vno_prior];
22752273
if (IS_CC(label)) {
22762274
CTABfindName(mris->ct, "corpuscallosum", &index);
22772275
if (index < 0) CTABfindName(mris->ct, "Medial_wall", &index);
@@ -2291,7 +2289,7 @@ int GCSArelabelWithAseg(GCSA *gcsa, MRI_SURFACE *mris, MRI *mri_aseg)
22912289
else if (old_index >= 0 && mris->ct && !stricmp(mris->ct->entries[old_index]->name, "corpuscallosum")) {
22922290
// find 2nd most likely label that isn't callosum
22932291
CTABannotationAtIndex(mris->ct, old_index, &cc_annotation);
2294-
label = GCSANclassify(gcsan, cpn, v_inputs, gcsa->ninputs, &p, &cc_annotation, 1, vno);
2292+
label = GCSANclassify(gcsan, cpn, v_inputs, gcsa->ninputs, p, &cc_annotation, 1, vno);
22952293
if (label != v->annotation) {
22962294
changed++;
22972295
v->annotation = label;
@@ -2305,9 +2303,7 @@ int GCSAreclassifyMarked(GCSA *gcsa, MRI_SURFACE *mris, int mark, int *exclude_l
23052303
{
23062304
int old_index, vno, vno_classifier, vno_prior, label, index, changed, num, n;
23072305
VERTEX *v, *v_classifier, *v_prior, *vn;
2308-
GCSA_NODE *gcsan;
2309-
CP_NODE *cpn;
2310-
double v_inputs[100], p;
2306+
double v_inputs[100], p[3];
23112307

23122308
for (changed = vno = 0; vno < mris->nvertices; vno++) {
23132309
v = &mris->vertices[vno];
@@ -2321,12 +2317,12 @@ int GCSAreclassifyMarked(GCSA *gcsa, MRI_SURFACE *mris, int mark, int *exclude_l
23212317
v_classifier = GCSAsourceToClassifierVertex(gcsa, v_prior);
23222318
vno_classifier = v_classifier - gcsa->mris_classifiers->vertices;
23232319
if (vno_classifier == Gdiag_no) DiagBreak();
2324-
gcsan = &gcsa->gc_nodes[vno_classifier];
2320+
GCSA_NODE *gcsan = &gcsa->gc_nodes[vno_classifier];
23252321

23262322
CTABfindAnnotation(mris->ct, v->annotation, &old_index);
23272323

2328-
cpn = &gcsa->cp_nodes[vno_prior];
2329-
label = GCSANclassify(gcsan, cpn, v_inputs, gcsa->ninputs, &p, exclude_list, nexcluded, vno);
2324+
CP_NODE *cpn = &gcsa->cp_nodes[vno_prior];
2325+
label = GCSANclassify(gcsan, cpn, v_inputs, gcsa->ninputs, p, exclude_list, nexcluded, vno);
23302326
if (label >= 0 && label != v->annotation) {
23312327
changed++;
23322328
v->annotation = label;
@@ -2337,9 +2333,13 @@ int GCSAreclassifyMarked(GCSA *gcsa, MRI_SURFACE *mris, int mark, int *exclude_l
23372333
that had nonzero priors and reclassify them based on nbrs. */
23382334
do {
23392335
for (num = vno = 0; vno < mris->nvertices; vno++) {
2340-
VERTEX_TOPOLOGY const * const vt = &mris->vertices_topology[vno];
23412336
v = &mris->vertices[vno];
23422337
if (v->ripflag || v->marked != mark) continue;
2338+
VERTEX_TOPOLOGY const * const vt = &mris->vertices_topology[vno];
2339+
/* moved to before assigning VERTEX_TOPOLOGY const * const vt
2340+
* v = &mris->vertices[vno];
2341+
* if (v->ripflag || v->marked != mark) continue;
2342+
*/
23432343
if (vno == Gdiag_no) DiagBreak();
23442344
for (n = 0; n < vt->vnum; n++) {
23452345
vn = &mris->vertices[vt->v[n]];

0 commit comments

Comments
 (0)