surface
tit.stats.surface ¶
fsaverage surface backend for cluster-based permutation stats.
The volumetric engine (:mod:tit.stats.engine) clusters voxels with
scipy.ndimage.label on a 3-D grid -- which has no meaning for surface
vertices. This module is the surface counterpart: it stacks the per-subject
fsaverage field caches written by :func:tit.source.project_fields_to_fsaverage
into a (n_vertices, n_subjects) matrix and runs the same statistics with
the same cluster conventions, swapping the grid clustering for graph
connected-components over the fsaverage triangle adjacency.
It deliberately reuses the engine's space-agnostic kernels
(:func:~tit.stats.engine.correlation, :func:~tit.stats.engine.ttest_ind,
:func:~tit.stats.engine.ttest_rel, :func:~tit.stats.engine.pval_from_histogram)
so the surface and volume paths give identical numbers on identical inputs; only
the spatial layer differs. The volumetric engine is left untouched --
:mod:tit.stats.permutation dispatches here when config.space == "fsaverage".
Cluster conventions mirror the engine exactly: a cluster is a connected set of
vertices with p < cluster_threshold (sign-restricted for one-sided tests);
singletons (size 1) are ignored; cluster mass is the signed sum of t over its
vertices; the null is the per-permutation max cluster stat; per-cluster p-values
come from :func:~tit.stats.engine.pval_from_histogram.
load_group_surface_data ¶
load_group_surface_data(subjects: list[tuple[str, str]], field: str, spacing: int) -> tuple[ndarray, list[str]]
Stack per-subject fsaverage field caches into (n_vertices, n_subjects).
Parameters¶
subjects : list of (str, str)
(subject_id, simulation_name) pairs (bare ids, no sub- prefix).
field : str
Which cached field to load -- one of :data:VALID_FSAVG_FIELDS.
spacing : int
fsaverage subdivision factor (5, 6, or 7).
Returns¶
(numpy.ndarray, list of str)
The (n_vertices, n_subjects) data matrix and the subject ids in
column order.
Source code in tit/stats/surface.py
build_fsaverage_adjacency ¶
build_fsaverage_adjacency(spacing: int)
Block-diagonal lh+rh fsaverage vertex adjacency (cached per spacing).
No edges cross the hemisphere boundary, so a slow-wave cluster can never
bridge the two hemispheres through a spurious midline edge -- matching the
[lh; rh] node ordering the field caches are written in.
Source code in tit/stats/surface.py
run_surface_correlation ¶
run_surface_correlation(config, callback_handler=None, stop_callback=None) -> CorrelationResult
Vertexwise field-vs-response correlation on the fsaverage surface.
Source code in tit/stats/surface.py
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 | |
run_surface_group_comparison ¶
run_surface_group_comparison(config, callback_handler=None, stop_callback=None) -> GroupComparisonResult
Responder-vs-non-responder t-test on the fsaverage surface.
Source code in tit/stats/surface.py
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 | |