It's not that simple... AGraph is a wrapper (in Anatomist) for a Graph. Each graph vertex also needs a wrapper in anatomist if it holds viewable objects (meshes for instance). So adding a vertex in the Graph structure is not enough for the Anatomist layer.
There is a command to add a vertex with the correct wrapper: AddNodeCommand (see the HTML doc) but it's in the ROI module, not in the core anatomist library. There's no good reason for it not to be in the core (I guess Renaud just dared not add it in the core), but we can move it if you need.
Otherwise, attributed() and Graph() functions should return the same object, but as a different pointer type: attributed() is more general, Graph is a subclass of the generic attributed object.
Hello Denis,
I am back on this post to ask you a few more questions.
The wrapper you are talking about for objects like vertices is, I assume, AGraphObject. Am I right ? As far as I understand (not much, so far), I can get a AObject selected with the mouse, then cast it to a AGraphObject. If the cast is OK, can I just add this AGraphObject to my AGraph ?
Thanks in advance !
Olivier
Olivier Coulon
Institut de Neurosciences de La Timone,
Aix-Marseille Université,
Marseille, france https://meca-brain.org
Yes, AGraphObject is the wrapper for Vertex (and Edge).
But I don't know what you want to do exactly: why add it to your AGraph ? As long as you can already see it and select it in anatomist, it is already in a AGraph, so what will you do next ? Find the buckets in it ? In this case, check its children AObjects using iterators in the MObject API. Or maybe you want to copy things from it ? Or create children objects in it ?
Denis
Hello Denis,
Thanks for your answer. I want to build a module that allows me to pick sulci in a graph (in a 3D window) and add them in a new graph. Ultimately I want to merge all the buckets from the selected sulci, if they are connected, and re-mesh the result. The aim is to be able to merge a sulcus defined by several pieces into one single piece. Does it make any sense to you ?
olivier
Olivier Coulon
Institut de Neurosciences de La Timone,
Aix-Marseille Université,
Marseille, france https://meca-brain.org
Why not using anatomy/morphometry/Create Sulcus Label volume?
well...first because I did not know about this process, there are too many Brainvisa process to know them all, now.
But anyway, as far as I understand, this process gives one image label per sulcus name/label. I want the user to be able to remove some bits of a sulcus (like little branches for instance) that have the same label/name. It seems to me that the only way is for the user to chose the bits he wants by hand (until Anatomist can label sulcal roots, of course ). Hence the module I am building. But if anybody has another (simpler) solution, I am willing to take any advice. I am sweating a lot on this Anatomist module ...
Olivier
Olivier Coulon
Institut de Neurosciences de La Timone,
Aix-Marseille Université,
Marseille, france https://meca-brain.org
There could be another way: even if Anatomist cannot automatically label sulcal roots, at least you can (and anyway you must manually edit something even in your approach). If you give a different name to branches, and use/edit/create a nomenclature (the new name for Anatomist hierarchies, we find it clearer) like what Cedric is doing, then you can make "Create Sulcus Label volume" to work as you like.
As you like... I personally quite prefer this solution because it better fits our "model" vision than making subgraphs.
Maybe the processing I was talking about can do the volume for all the sulci. At least I should have done that. Then you can use some Aims Command meshing each label.
But otherwise, I have the feeling to go back to a discussion we had with Cedric and Denis a couple of months ago. I was suggesting that you just need a new labelling to do what you have in mind, not a new graph. This would be much simpler in my opinion. For instance, if you wan to remove some branches, just put them to "unknow". Could it work that way?
Yes, you are both right, it seems much simpler to edit the names to then extract the pieces I want.
Well, it's good news because it's simpler, but bad news because I lost quite some time trying to have this module working. Anyway, I should have asked you first. That's the lesson of the day : always go and annoy Denis before you start something.
Thanks a lot both of you.
Olivier
Olivier Coulon
Institut de Neurosciences de La Timone,
Aix-Marseille Université,
Marseille, france https://meca-brain.org
But you've learned how to make an anatomist module: an invaluable knowledge that only 3 or 4 people on the planet could ever achieve up to now...
Denis