adding vertex to a AGraph

Questions about Anatomist manipulation

Moderators: denghien, riviere

Post Reply
User avatar
Olivier Coulon
Posts: 176
Joined: Fri Feb 27, 2004 11:48 am
Location: MeCA research group, Institut de Neurosciences de La Timone, Marseille, France
Contact:

adding vertex to a AGraph

Post by Olivier Coulon »

Hello,
I would like to add a vertex to an object

Code: Select all

AGraph *ag
I thought I could use

Code: Select all

ag->attributed()
but it does not have an addVertex() method. Maybe I have to cast it to a Graph type to apply the addVertex() method. Or can I use

Code: Select all

ag->Graph()
directly ? In this case I am not sure the vertex will be registered properly... Is this equivalent ? Can anybody (Denis !) help ?
Thanks in advance.

Olivier
Olivier Coulon
Institut de Neurosciences de La Timone,
Aix-Marseille Université,
Marseille, france
https://meca-brain.org
User avatar
riviere
Site Admin
Posts: 1361
Joined: Tue Jan 06, 2004 12:21 pm
Location: CEA NeuroSpin, Saint Aubin, France
Contact:

Post by riviere »

Hi Olivier,

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.

Denis
User avatar
Olivier Coulon
Posts: 176
Joined: Fri Feb 27, 2004 11:48 am
Location: MeCA research group, Institut de Neurosciences de La Timone, Marseille, France
Contact:

Post by Olivier Coulon »

Salut Denis,
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.
I will need to get the buckets from all the sulci selected to remesh them, so yes please, the AddNodeCommand command sounds like what I need.


Olivier
Olivier Coulon
Institut de Neurosciences de La Timone,
Aix-Marseille Université,
Marseille, france
https://meca-brain.org
User avatar
Olivier Coulon
Posts: 176
Joined: Fri Feb 27, 2004 11:48 am
Location: MeCA research group, Institut de Neurosciences de La Timone, Marseille, France
Contact:

Post by Olivier Coulon »

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
User avatar
riviere
Site Admin
Posts: 1361
Joined: Tue Jan 06, 2004 12:21 pm
Location: CEA NeuroSpin, Saint Aubin, France
Contact:

Post by riviere »

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
User avatar
Olivier Coulon
Posts: 176
Joined: Fri Feb 27, 2004 11:48 am
Location: MeCA research group, Institut de Neurosciences de La Timone, Marseille, France
Contact:

Post by Olivier Coulon »

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
User avatar
Jean-Francois Mangin
Posts: 337
Joined: Mon Mar 01, 2004 10:24 am
Location: Neurospin, CEA, France
Contact:

Post by Jean-Francois Mangin »

Why not using anatomy/morphometry/Create Sulcus Label volume?
User avatar
Olivier Coulon
Posts: 176
Joined: Fri Feb 27, 2004 11:48 am
Location: MeCA research group, Institut de Neurosciences de La Timone, Marseille, France
Contact:

Post by Olivier Coulon »

Hi Jeff,
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 :wink: ). 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
User avatar
riviere
Site Admin
Posts: 1361
Joined: Tue Jan 06, 2004 12:21 pm
Location: CEA NeuroSpin, Saint Aubin, France
Contact:

Post by riviere »

Hi Olivier,

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.

Denis
User avatar
Jean-Francois Mangin
Posts: 337
Joined: Mon Mar 01, 2004 10:24 am
Location: Neurospin, CEA, France
Contact:

Post by Jean-Francois Mangin »

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?
User avatar
Olivier Coulon
Posts: 176
Joined: Fri Feb 27, 2004 11:48 am
Location: MeCA research group, Institut de Neurosciences de La Timone, Marseille, France
Contact:

Post by Olivier Coulon »

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. :wink:

Thanks a lot both of you.

Olivier
Olivier Coulon
Institut de Neurosciences de La Timone,
Aix-Marseille Université,
Marseille, france
https://meca-brain.org
User avatar
riviere
Site Admin
Posts: 1361
Joined: Tue Jan 06, 2004 12:21 pm
Location: CEA NeuroSpin, Saint Aubin, France
Contact:

Post by riviere »

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... :lol:
Denis
Post Reply