-
Notifications
You must be signed in to change notification settings - Fork 144
Blender flattening support #572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on blender and the UV flattening works and shows up!
Please rebase your branch to main as this should address the tests that are failing.
Thank you!
print("Adding python site directory to sys.path:", site_dir) | ||
sys.path.insert(0, site_dir) | ||
import mda_xdrlib as xdrlib |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#577
This import statement wasn't working for me given that mda_xdrlib does not have Packer or Unpacker which is called later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmitry-mli I think this should be from mda_xdrlib import xdrlib
. @sjshim fixed some other instances of this in #577. I'm surprised import mda_xdrlib as xdrlib
worked for you within blender...mysteries of blender!
overwritten without asking for confirmation. | ||
""" | ||
|
||
blender_path = blender_path or "/Applications/Blender.app/Contents/MacOS/Blender" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hard coded path throws errors on my Linux machine. Removing it correctly grabs path from config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, it should be better not to hard code this and instead honor the settings in the config.cfg
Lines 8 to 20 in c6b7de1
[dependency_paths] | |
# The following specify paths to the binary executable files | |
# for external dependencies of pycortex. The default values | |
# (just "inkscape" and "blender") should work on Linux, | |
# since the binaries should already be on the system path if | |
# blender and inkscape are installed. | |
# For MacOS, unless you have done some manual configuration on | |
# your own, these will need to be something like: | |
# blender = /Applications/Blender/blender.app/Contents/MacOS/blender | |
# inkscape = /Applications/Inkscape.app/Contents/MacOS/Inkscape | |
# Windows is not currently supported. | |
inkscape = inkscape | |
blender = blender |
but the issue here may be that these settings are not explained in the documentation...
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
freesurfer
mode 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_patch
and the old one, renamedsave_patch
intowrite_volume_patch
._get_pts_edges
into_get_geometry
for clarity. Added clarifying logging and elapsed time tracking. Extended docstring.mda_xdrlib
that was removed from Python 3.13.cortex.blender._call_blender to support non-code calls to Blender to reduces confusion and improves code clarity. Refactored
fs_cutinto
fs_cut_initand added a new
fs_cut_open` to improve clarity. Extended docstring.cut_surface
for clarity. Onboarded torecache
flag 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: