Skip to content
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

Blender python module (willing to collaborate or work alone) #112

Open
caniko opened this issue Mar 12, 2019 · 5 comments
Open

Blender python module (willing to collaborate or work alone) #112

caniko opened this issue Mar 12, 2019 · 5 comments

Comments

@caniko
Copy link

caniko commented Mar 12, 2019

I am i need of automating the computation of the surface distance between multiple points on a 3d model of a cell. I believe that this repository is a step in the right direction for my project. I am in, therefore, need of this addon being available on python.

The addon would be like this:

b_obj = bcutmesh.select_obj(obj)
# Find distance between all points, return as list
b_obj.verteces(<list-like object containing all points>)

# Find distance between two specific points, return float
b_obj.vert(<list containing coords of point A>, <list containing coords of point B>)

Can you help me to get started? We can collaborate if you wouldl like!

@patmo141
Copy link
Owner

I do not have time to collaborate at this time, however the geodesic module does have the machinery to do what you want. It still has some bugs. What you want to do, is start at the 'target point" and then build the geodesic field out from the target point until you reach the seed point. Once you reach the seed point, you then walk back down the gradient field.

So the "geodesic_walk" "conitnue_geodesic_walk" and "gradient_descent" are the functions you want to look at in geodesic.py

And for an implementation, where the geodesic field calculation happens in chunks (allowing an operator to stay interactive)

https://github.com/patmo141/cut_mesh/blob/master/op_geopath/geopath_datastructure.py

@patmo141
Copy link
Owner

@caniko
Copy link
Author

caniko commented Mar 30, 2019

I think I understand your explanation on what I have to do.

I am not sure how I am going to use the framework you are mentioning. Where would I define the target point? Also, am I supposed to store the data using an instance of the GeoPath class for each path? When would I use "conitnue_geodesic_walk", and "gradient_descent".

Is "geodesic_walk" the initiator of the walk while "conitnue_geodesic_walk" takes additional steps. Not sure what gradient_descent returns. Do you take the negative of the gradient at the given point to get the point of fastest descent?

This certainly led me to having more questions, but I think this is doable. I just need some help understanding the extension. It has almost no documentation.

@caniko
Copy link
Author

caniko commented Apr 12, 2019

Could you please reply? I need some guidance to get started

@caniko
Copy link
Author

caniko commented Jul 18, 2019

I am getting an error when I try to run this:
image

Error:

AL lib: (EE) UpdateDeviceParams: Failed to set 44100hz, got 192000hz instead
Read blend: c:\users\can\projects\cinpla\myoa\myoa\MyoA\static/clean.blend
Nucleus number 0 out of 44
using all the verts
y is complex, setting to 0
-0.00010102792293764651
(2.4526150395862914e-19+0.004005424325273046j)
y is complex, setting to 0
-0.0005102740101392556
(5.512037837230767e-19+0.009001840924368499j)
y is complex, setting to 0
-0.00016410069929406745
(3.1258112106864995e-19+0.005104837105462262j)
y is complex, setting to 0
-0.0013903263652537134
(9.09831140481422e-19+0.014858670126192823j)
type(bme): <BMesh(0x0000021177CB2138), totvert=51910, totedge=155724, totface=103816, totloop=311448>
seed: <BMVert(0x000002110B334290), index=49442>
target: <BMVert(0x000002110B340050), index=50309>
Traceback (most recent call last):
  File ".\Myocyte_example.py", line 11, in <module>
    cell = Myocyte(WRL_PATH, NUCLEI_DATA_PATH, 'test')
  File "c:\users\can\projects\cinpla\myoa\myoa\MyoA\MyoA\myocyte.py", line 36, in __init__
    self.wrl_path, self.nuclei_surfrace_coords
  File "c:\users\can\projects\cinpla\myoa\myoa\MyoA\distance\distance.py", line 87, in relative_nuclei_distance
    bme, geos, target, epsilon=0.0000001
  File "c:\users\can\projects\cinpla\myoa\myoa\MyoA\distance\geopath_modules.py", line 514, in gradient_descent
    new_coord, new_ele, last_face = grad_v(path_elements[-1])
  File "c:\users\can\projects\cinpla\myoa\myoa\MyoA\distance\geopath_modules.py", line 339, in grad_v
    eds = [ed for ed in v.link_edges if geos[ed.other_vert(v)] <= geos[v]]
  File "c:\users\can\projects\cinpla\myoa\myoa\MyoA\distance\geopath_modules.py", line 339, in <listcomp>
    eds = [ed for ed in v.link_edges if geos[ed.other_vert(v)] <= geos[v]]
KeyError: <BMVert(0x000002110B3416B8), index=50411>
Exception ignored in: <bound method CyclesRender.__del__ of <bpy_struct, Struct("CYCLES")>>
Traceback (most recent call last):
  File "C:\Users\Can\Projects\CINPLA\MyoA\test\Scripts\2.79\scripts\addons\cycles\__init__.py", line 66, in __del__
TypeError: 'NoneType' object is not callable
Error: Not freed memory blocks: 8, total unfreed memory 0.008392 MB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants