Damseh / VascularGraph

MIT License
18 stars 3 forks source link

node keys do not include 'pos' #3

Open liorgolgher opened 4 years ago

liorgolgher commented 4 years ago

Hi Rafat,

I hope this issue finds you well (:

The demo you provided works smoothly on one of our servers, both with the default dataset and with one of our datasets. When trying to run the very same code on two other servers, I've got some odd errors:

  1. Both two servers have complained that AttributeError: 'Graph' object has no attribute 'node'. Seemingly node is deprecated in networkx 2.4 and should be replaced with nodes.
  2. Replacing all node instances with nodes in GenerateGraph, BaseGraph, RefineGraph, ContractGraph and ReadPajek has left me with the following key error on one server:

File "/Users/Niva/VascularGraph/VascGraph/GraphIO/ReadPajek.py", line 64, in ReadFile pos=node['pos'] KeyError: 'pos'

Printing the keys of pos just before this error yielded ['id', 'x', 'y', 'shape'].

  1. The other server has failed earlier, already in GenerateGraph, as follows:

Traceback (most recent call last): File "demo.py", line 75, in graph=generate.GetOutput() File "/pblab/pblab/Lior/VG/VascularGraph/VascGraph/Skeletonize/GenerateGraph.py", line 267, in GetOutput self.AssignDistMapToGraph() File "/pblab/pblab/Lior/VG/VascularGraph/VascGraph/Skeletonize/GenerateGraph.py", line 62, in AssignDistMapToGraph if Pos[0]<self.Shape[0] and Pos[1]<self.Shape[1] and Pos[2]<self.Shape[2]:
NameError: name 'Pos' is not defined

Can you please suggest how should I resolve this issue? Unfortunately the server that runs VascularGraph properly is slow and unstable ):

Thanks a lot! Lior

Damseh commented 4 years ago

Hi Lior, my code has been only tested with NetworkX==2.2 My guess is that all errors are generated due to the wrong versions used! Try to downgrade to the 2.2 version on the other two servers without changing the code, and update me with the output. Best, Rafat

liorgolgher commented 4 years ago

Thank you for your prompt, helpful reply!

With networkx set to 2.2, pos keys are now ['id', 'x', 'y', 'shape', 'pos', 'r'], resolving issue 2 for my macOS. VascularGraph now works on my mac, both with the demo dataset and with my own datasets (two datasets tested as yet).

On our university's Power cluster I still get the same error in line 62 of GenerateGraph, as pasted in my previous message. I have tried to resolve it by generating a new conda environment and by cloning an existing conda environment, both with networkx=2.2, to no avail.

On another server I've been experiencing a libGL rendering error, but it likely has to do with their old video card and has nothing to do with VascularGraph itself.

I'll open a separate issue or email about the key challenge we're facing: How to apply the same 3D skeletonization on 4D datasets (3D+time) where the volume of each vascular segment varies over time.

Thanks a lot! Lior

Damseh commented 4 years ago

Oh! I noticed 'z' key missing, did you try to skeletonize a 2D binary image?

liorgolgher commented 4 years ago

Nope, I've fed it with a 3D binary array.

liorgolgher commented 4 years ago

Here's the input dataset: https://drive.google.com/file/d/1_cXvGihvoWZue9JEWJYgaE6MoDAyjG11/view?usp=sharing

and here's a snapshot of its successful skeletonization on my mac: https://drive.google.com/file/d/1x8SF1dw6P_dFtlQOccJZZFwQW7sWj0G_/view?usp=sharing

Damseh commented 4 years ago

Can you print the keys for node 0 of the final graph: print(g.node[0])

liorgolgher commented 4 years ago

Regrettably I've missed the following messages:

No radii assigned to graph nodes!
No types assigned to graph nodes!
No branch labels assigned to graph nodes!
>>> objc[64859]: Class FIFinderSyncExtensionHost is implemented in both /System/Library/PrivateFrameworks/FinderKit.framework/Versions/A/FinderKit (0x7fffa7d013d8) and /System/Library/PrivateFrameworks/FileProvider.framework/OverrideBundles/FinderSyncCollaborationFileProviderOverride.bundle/Contents/MacOS/FinderSyncCollaborationFileProviderOverride (0x1a340f0f50). One of the two will be used. Which one is undefined.
libpng warning: iCCP: known incorrect sRGB profile

Accordingly, when I asked it to print the keys for node 0 I got the following response:

>>> print(g.node[0])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'g' is not defined
Damseh commented 4 years ago

Sorry! I meant to print it for your final graph generated after refinement, in the demo.py: print(gr.node[0])

liorgolgher commented 4 years ago
>>> print(gr.node[0])
{'pos': array([  3.08453024, 185.08351638,  19.99315261]), 'r': 1.7320508075688772}
Damseh commented 4 years ago

It seems that everything is ok! 'pos' key has three elements for x, y and z coordinates.

Damseh commented 4 years ago

Is the problem resolved on your university's Power cluster, or you still get an error in line 62 in GenerateGraph?

liorgolgher commented 4 years ago

The line62 error persists on our Power cluster. I can use my mac in the meantime thanks to your help.

ZDstandup commented 2 years ago

hi, @Damseh ,

This is a nice work.

Can this framework extract the graph from a 2D binary array?

Damseh commented 2 years ago

Hi @ZDstandup,

Yes it can! The trick is to augment your 2D mask into a 3D mask with 3 or more slices (each slice would be a copy of your 2D mask).