3D - labels and measurements

Questions about Anatomist manipulation

Moderators: denghien, riviere

Post Reply
Manik
Posts: 99
Joined: Fri Mar 05, 2004 1:00 pm
Location: INSERM U836, Grenoble

3D - labels and measurements

Post by Manik »

Hi,

is there a way to have labels displayed in Anatomist in a 3D window ?
The sulcus tooltip that displays the name of a graph element is ok, but it is linked to the mouse cursor and only one is displayed at any one time.
I would like to display a label linked to a fixed point of a mesh.
For example : there are 100 EEG electrodes on a scalp, I would like to get small labels with their names, all displayed at the same time near each electrode, even if the volume moves or rotates in the window (except when the anchor point is hidden).
Is there any way to do this ?

Another function that users ask is a way to make measurements (length mostly and trace straight lines). I suppose this could be done with a new control mode in anatomist windows (such as ROI edition icon) by adding 2D meshes for the lines and displaying a label with the length attached to theses meshes.
Could you remind me how such a control can be added to anatomist (through pyanatomist ? plugins ?)

Thanks !
Manik Bhattacharjee
INSERM U836
User avatar
riviere
Site Admin
Posts: 1361
Joined: Tue Jan 06, 2004 12:21 pm
Location: CEA NeuroSpin, Saint Aubin, France
Contact:

Re: 3D - labels and measurements

Post by riviere »

Hi Manilk,

For the first quesion, look at http://brainvisa.info/doc/pyanatomist/s ... on-a-graph. This mode has been integrated in the next version (the trunk svn branch if you build from sources), and will be available in the selection control under the "A" keyboard key (and faster than the example here because it is coded in C++).

For the second question, yes, it could be done quite easily in a new control but does not exist right now.
There are examples of creating new controls in pyanatomist: http://brainvisa.info/doc/pyanatomist/s ... ls-example, and also look at the existing python plugins (in the share/anatomist-4.2/python_plugins dir of the packages).
I have perhaps a better example of a control allowing to set temporary control points, also in the current trunk svn branch, used for sulcal fold splitting.

Denis
Manik
Posts: 99
Joined: Fri Mar 05, 2004 1:00 pm
Location: INSERM U836, Grenoble

Re: 3D - labels and measurements

Post by Manik »

Thanks.
For the first question, I am wondering how I can specify the referential of the TextObject, as I found little documentation about it :
- there is text label with a position
- there is a line "polygon" to link the label to the position of interest.

The object that I want to label will move (in fact, it is its own referential that moves compared to the central referential).
How can I specify that the TextObject and the polygon belong to a specific referential ? I am not used to deal with the anatomist.cpp objects.

In anagraphannotate.py, should I do TObj.setReferential(rf) ? Or is it the texto object ?
Manik Bhattacharjee
INSERM U836
User avatar
riviere
Site Admin
Posts: 1361
Joined: Tue Jan 06, 2004 12:21 pm
Location: CEA NeuroSpin, Saint Aubin, France
Contact:

Re: 3D - labels and measurements

Post by riviere »

Hi Manik,
Right, there's no doc...
- TextObject is an Anatomist object containing a textured rectangle with some text in the texture. It can be displayed at any position in any orientation (so, not readable in most cases)
- TransformedObject allows to display an object with some features of the camera orientation: either in a constant orientation in regard to the camera (ie text always facing the eye), or at a fixed position on the view (to display something in a corner...), or both.
Both are regular anatomist objects, so can be assigned a referential, or better, a referential inheritance (take the ref of another object, even if the other object changes ref). In the example, referentials are not taken into account. In my new C++ implementation, I set the referential of the graph as inheritance for both "to" and "tobj":

Code: Select all

to.setReferentialInheritance( agraph )
tobj.setReferentialInheritance( agraph )
This will make the text move with the object it is next to (here, the graph but you can use any object).
For the line, it is the same: the line is a regular mesh, which should inherit the referential of the object it is drawn from. However if the object is moving, maybe a line moving also in 3D is not the best (because then it could go behind the object if you rotate it), so you may have to setup a more complex transformations system between your objects.

Denis
Manik
Posts: 99
Joined: Fri Mar 05, 2004 1:00 pm
Location: INSERM U836, Grenoble

Re: 3D - labels and measurements

Post by Manik »

Hi,

trying to use anatomist.cpp results in a segfault, using a new brainvisa-4.2.1 package and a simple test file :

Code: Select all

# -*- coding: utf-8 -*-
import anatomist.direct.api as anatomist

class TObj ( anatomist.cpp.TextObject ):
  def __init__( self, message='', pos=[0,0,0] ):
    anatomist.cpp.TextObject.__init__( self, message, pos )

print "TEST TextObject"
to = TObj( "Hello" )
print "Ok"

Code: Select all

[manik@localhost epilepsie]$ python test.py 
TEST TextObject                                                                                                                             
Erreur de segmentation 
It might be related to an error I saw the first time I tried to use it :

Code: Select all

Starting Anatomist.....
config file : /home/manik/.anatomist/config/settings.cfg
PyAnatomist Module present
global modules: /home/manik/software/brainvisa-Mandriva-2008.0-x86_64-4.2.0-2012_02_03/share/anatomist-4.2/python_plugins
home   modules: /home/manik/.anatomist/python_plugins
loading module bsa_proba

loading of module bsa_proba failed:
AttributeError : 'module' object has no attribute 'cpp'
traceback:
/home/manik/software/brainvisa-Mandriva-2008.0-x86_64-4.2.0-2012_02_03/python/anatomist/cpp/__init__.py ( 336 ) in __init__ :
exec( 'import ' + x )
<string> ( 1 ) in <module> :
?
/home/manik/software/brainvisa-Mandriva-2008.0-x86_64-4.2.0-2012_02_03/share/anatomist-4.2/python_plugins/bsa_proba.py ( 147 ) in <module> :
class BSAWindow( ana.cpp.QAWindow ):

loading module histogram
Manik Bhattacharjee
INSERM U836
Manik
Posts: 99
Joined: Fri Mar 05, 2004 1:00 pm
Location: INSERM U836, Grenoble

Re: 3D - labels and measurements

Post by Manik »

Sorry, the test file was too simple, not creating Anatomist nor a Qt App...
Manik Bhattacharjee
INSERM U836
Post Reply