Skip to content

A surface with χ ≠ 1 #64

Description

@XYWCQM

Hello, when I was using autoflatten to flatten the cortex, the projection function was working properly. However, when I tried to run the flattening process afterwards, I encountered the following issue:
autoflatten $SUBJECTS_DIR/S6 --output-dir ./flatten
Starting Autoflatten Pipeline...
FreeSurfer version: stable6
Subject: S6
Subject directory: /usr/local/freesurfer/subjects/S6
Output directory: ./flatten
Processing hemispheres: lh, rh

Processing lh hemisphere for subject S6
Patch file ./flatten/lh.autoflatten.patch.3d already exists, skipping (use --overwrite to force)
Using pyflatten backend for flattening
Running pyflatten backend
Input patch: ./flatten/lh.autoflatten.patch.3d
Base surface: /usr/local/freesurfer/subjects/S6/surf/lh.fiducial
Output: ./flatten/lh.autoflatten.flat.patch.3d
K-ring: 7, neighbors/ring: 12
Loading cortical surface patch...
Mesh: 141,323 vertices, 282,642 faces
Error processing lh hemisphere:
Traceback (most recent call last):
File "/home/monkey/anaconda3/lib/python3.10/site-packages/autoflatten/cli.py", line 656, in cmd_run_full_pipeline
results[hemi] = process_hemisphere(
File "/home/monkey/anaconda3/lib/python3.10/site-packages/autoflatten/cli.py", line 486, in process_hemisphere
flat_file = run_flatten_backend(
File "/home/monkey/anaconda3/lib/python3.10/site-packages/autoflatten/cli.py", line 373, in run_flatten_backend
return backend.flatten(
File "/home/monkey/anaconda3/lib/python3.10/site-packages/autoflatten/backends/pyflatten.py", line 166, in flatten
flattener.load_data(patch_path, surface_path)
File "/home/monkey/anaconda3/lib/python3.10/site-packages/autoflatten/flatten/algorithm.py", line 1657, in load_data
euler = validate_topology(
File "/home/monkey/anaconda3/lib/python3.10/site-packages/autoflatten/flatten/algorithm.py", line 245, in validate_topology
raise TopologyError(msg)
autoflatten.flatten.algorithm.TopologyError: Surface has Euler characteristic χ = 2 (expected 1 for disk topology).
Vertices: 141,323, Edges: 423,963, Faces: 282,642
This indicates the surface has topological defects (holes, handles, or disconnected components).
A surface with χ ≠ 1 cannot be flattened to a plane without self-intersections.
Consider using mris_cut to create a disk-like patch, or check the surface for defects.
Could you please tell me how to solve it? I'm looking forward to your reply, thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions