Superimposition of a graphic (jpeg) onto an anatomical image

Questions about Anatomist manipulation

Moderators: denghien, riviere

Post Reply
su3686
Posts: 2
Joined: Tue Sep 28, 2004 7:22 pm

Superimposition of a graphic (jpeg) onto an anatomical image

Post by su3686 »

Hi,
i was very impressed by the "Mona-Lisa" on an anatomical brain (brainvisa.info/ museum.html). So i tried hard to achieve a comparable result with brainvisa/anatomist. I got an anatomical T1-Scan of my brain and made a mesh out of it. But now I fail to put a texture on this mesh. I really have no idea how to extract a texture out of a graphic (e.g. a jpeg). Maybe i got a wrong idea about this procedure. My questions are:

1) is it possible to extract a texture out of a graphic (e.g. jpeg)?;
2) how was it possible to put the "Mona-Lisa" onto an anatomical brain?;
3) if i got t-values in a datafile (eeg-data) and want to superimpose them on an anatomical brain - what headerfile do i need? What has to be declared in this headerfile (it looks so easy on the brainvisa homepage - but i guess there is no information on the page, how a header should look like or how "erp"-data should be structured).

I guess that my questions are maybe naive or trivial for expert users but be sure: i tried hard and getting crazy... :shock:
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,

Texturing actually needs 2 different things: the texture image (or colormap (or palette) for 1D texture) which can be a jpeg image, and the texture coordinates which map for each vertex of a mesh a location on the texture image/palette.

- To use a jpeg image as a palette, you can place it in the $HOME/.anatomist/rgb/ directory (create it if it doesn't exist). Then when you run anatomist again (or use the "settings/reload palettes" menu from a running anatomist), the image should appear in the palettes list of the palette properties of volumes or textures.

- Now you need to provide the texture coordinates. This is the aim of the texture object, which is read from a texture file.
In anatomist 1.30 there are no texture generation functions so you need to create them by your own means. To map a 2D image, you need to provide a 2D texture: a texture providing, for each vertex of the mesh, 2 coordinates in the image. What has been used for the Mona-Lisa example is simply project the mesh coordinates to a plane, ie provide as texture coordinates, for each vertex, (x,y) from the (x,y,z) coord of the vertex.

- This leads to point 3 of your questions: the texture file. The format we use (.tex like LaTeX files but it's different!) is documented on our website: see http://brainvisa.info/doc/html/en/index.html, or directly http://brainvisa.info/doc/formats/tex.pdf.
For 2D texturing the data type used is POINT2DF, which means (x,y) couple. For 1D textures, you can use FLOAT.

- EEG data can be regarded as a time-texture corresponding to the mesh of the electrodes. So you need to get or build a mesh of the electrodes net with one vertex for each electrode (if you have only coordinates for the electrodes, you can use AimsConvexHull to make the mesh). Then there is an interpolation module in anatomist which can map a texture on another mesh (head mesh for instance), which is a little bit documented in the french HTML documentation of anatomist, but I admit this is quite a poor doc for non french-speaking people... look at http://brainvisa.info/doc/html/anatomis ... index.html anyway.

- In the next version of anatomist (1.31) in development, there will be possibilities to use OpenGL built-in texture coordinates generation functions so you may not need to make a .tex file by your own to project an image on a mesh.

- Once you have both the texture and the mesh, you can assign the palette (image) on the texture (palette properties) and make a fusion between the mesh and the texture to get a textured mesh.

Does this help you ?
Denis
su3686
Posts: 2
Joined: Tue Sep 28, 2004 7:22 pm

Post by su3686 »

Thank you riviere! So nice that you give such a quick answer to my questions!
My progress: i simply copied my jpeg into the rgb - directory. I loaded the example-texture from the "definition of texture" and the example-mesh of "definition of 3D mesh" and took my new created palette (my jpeg) and...voila! there it was - a 4 vertices object with my jpeg on it. :P .

But i really do not understand how to project the 3D mesh coordinates of my brain to a plane. You said: "simply project the mesh coordinates" - i hope that i get it right: the mesh coordinates of an anatomical brain should be projected to a plane. Have I to do this in BrainVisa? Oh, oh I feel that I get something wrong.... :roll:

Again, thank you for your quick reply
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 »

Well, the projection I was talking about is just one way (amongst many others) to easily generate texture cordinates that will lead to a nice representation of an image onto a mesh.
Imagine you have the mesh in one hand and the image in the other hand: what you want to do is to glue the image on the mesh, that is to say: project the image onto the mesh.
The texture coordinates tell how the mesh and the image are mapped together: which point of the image will be sticked to which point of the mesh.
A simple projection is a "planar" projection: point (x, y, z) of the mesh will be mapped to point (x, y) of the image, or to point (y, z), or... well this is to say: apply a planar projection to the 3D coordinates to get 2D coordinates. These 2D coordinates should be written in a texture file (2D texture).

There is nothing in BrainVisa to do this, because it's a specific application which has no real utility for brain imaging... So you'll have to do it yourself... It's not a difficult operation, but it assumes you can read mesh files and write texture files, this is the most complex part. Or alternately, you can use the development version of Anatomist: in this version several texture generation modes are available, but their usage is still not very user-friendly and it lacks some projection parameters.

Denis
Post Reply