Blender flattening support #572
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Thank you for maintaining pycortex—i found it to be an invaluable tool for visualization of cortical data.
Please consider this PR that offers an extension the the flattening modes (+notebook, +docs, +video). Please provide your feedback and I will be happy to adjust the modification. Thank you!
cc @cmcneil @tysonnsa.
Why
freesurfermode has been used for a long time, it lacks debuggability and may require a number of iterations and a degree of patience in order to get things working. The new mode is added to timebox the flattening process by making it faster and more predictable by leveraging UV unwrap preview in Blender. This PR adds a 3rd mode of flattening that is based on Blender's UV unwrap. This mode will reduce time to flatten while producing decent quality unwraps.What
cortex.blender.blendlib.py. It follows the same selection as for the volume mesh. This is accessible viawrite_flat_patch.write_flat_patchand the old one, renamedsave_patchintowrite_volume_patch._get_pts_edgesinto_get_geometryfor clarity. Added clarifying logging and elapsed time tracking. Extended docstring.mda_xdrlibthat was removed from Python 3.13.cortex.blender._call_blender to support non-code calls to Blender to reduces confusion and improves code clarity. Refactoredfs_cutintofs_cut_initand added a newfs_cut_open` to improve clarity. Extended docstring.cut_surfacefor clarity. Onboarded torecacheflag to support forced generation.”and"which may result into code examples not running properly.Tutorial video
As different labs may approach cuts slightly differently, created and edited a tutorial video instruction that follows the style of gallantlab.org. The used anatomy was taken from Horikawa, T., Cowen, A. S., Keltner, D., & Kamitani, Y. (2020). The neural representation of visually evoked emotion is high-dimensional, categorical, and distributed across transmodal brain regions..
Docs update
Added a new section on the cuts. When rendered looks as follows: