managing object size

Questions about Anatomist manipulation

Moderators: denghien, riviere

Post Reply
User avatar
François Leroy
Posts: 30
Joined: Wed Feb 22, 2006 5:22 pm

managing object size

Post by François Leroy »

Hi anatomist-ics,
I would like to see the real size of objects (mesh files) in order to visually check whether one is either smaller or larger. Each object is a ROI that belongs to a given subject. I would like to see these objects side by side. So I opened several windows and loaded one object in each of these windows. However, if all window sizes are not the same, the true size of objects is distorted, even if the zoom parameter is the same across windows. I believe the zoom parameter is attached to the window size and not to objects, so it cannot set the scaling of objects. Is there any other way to look and compare (true) object size than opening windows with exactly the same size?
Kind regards,
Francois
User avatar
Yann Cointepas
Posts: 316
Joined: Tue Jan 20, 2004 2:56 pm
Location: Neurospin, Saint Aubin, France
Contact:

Re: managing object size

Post by Yann Cointepas »

You can synchronise 3D Anatomist windows point of view (including zoom) by pressing the 's' key (don't forget to put all windows in 3D mode). You can set the same size to all window by using menu Window->resize (you will have to do this on each window). All of this can be easily scripted.

Depending on the number of objects you want to compare, it is possible to fusion them to see the difference with transparency.
User avatar
François Leroy
Posts: 30
Joined: Wed Feb 22, 2006 5:22 pm

Re: managing object size

Post by François Leroy »

Thank you Yann.
I used the pyanatomist documentation on the website and then was able to see all objects in windows of the same size. Dominique helped me a bit to start with the python procedures. Then, the documentation was helpful with lots of examples.
Once the python script done, the objects still do not have the same scale. As pointed out before, the zoom factor is related to window and not to objects. The same zoom factor and the same window size do not guarantee the object scaling. When I loaded the object in the window, it sets the object scale according to the window size. There is no way I know of to set the same scale to objects.
What I did then is to put all objects into the same window. All objects have the same scaling. Using opacity parameter, I was able to select the object I wanted to see, one after the other. It is not very convenient but it solved my problem.
Cheers.
Francois
User avatar
riviere
Site Admin
Posts: 1361
Joined: Tue Jan 06, 2004 12:21 pm
Location: CEA NeuroSpin, Saint Aubin, France
Contact:

Re: managing object size

Post by riviere »

Hi François,

Yes, the zoom parameter is a factor attached to the window camera. In practice, it is combined with the bounding box of the field of view, in the 3D objects world. So to ensure that several views show exactly the same space, these bounding boxes should be controlled. By default the bounding box of the objects in the window is used, which explains that two windows containing different objects don't have the same scaling.
But you can force the bounding box (for instance get it from one window and set in others) using the Camera command, see the "boundingbox_min" and "boundingbox_max" parameters.

Denis
User avatar
François Leroy
Posts: 30
Joined: Wed Feb 22, 2006 5:22 pm

Re: managing object size

Post by François Leroy »

Great Denis. It worked fine. I could see all objects with the same scaling. Thanks a lot.

For newcomers, I give an example below.

#
# How to have two objects in two distinct windows with the same scaling
#
import anatomist.api as ana
myana = ana.Anatomist()

# loading mesh files
mymesh1 = myana.loadObject("toto1.mesh")
mymesh2 = myana.loadObject("toto2.mesh")

# creating two windows
mywin1 = myana.createWindow(wintype = '3D')
mywin2 = myana.createWindow(wintype = '3D')

# binding mesh and window
myana.addObjects(mymesh1, mywin1)
myana.addObjects(mymesh2, mywin2)

# then I manually adjust the zoom in the window of the first mesh
# and get resulting window informations
mywin1.getInfos()
'ObjectInfo'
{ 63 : { 'boundingbox_max' : [ 11.6396, 37.4322, 25.6043 ], 'boundingbox_min' : [ -11.6396, -37.4322, -25.6043 ], 'geometry' : [ 795, 0, 260, 409 ], 'group' : 0, 'objects' : [ 58 ], 'observer_position' : [ 55.1998, 94.7577, 72.1664 ], 'position' : [ 0, 0, 0, 0 ], 'referential' : 9, 'slice_quaternion' : [ 0, 0, 0, 1 ], 'type' : 'AWindow', 'view_quaternion' : [ 0.00612608, -0.247194, 0.968862, 0.0127923 ], 'view_size' : [ 256, 403 ], 'windowType' : 'Axial', 'zoom' : 0.637628 } }

# then I apply it to the second mesh
myana.camera(mywin2,zoom=0.638,boundingbox_min=[-11.6396, -37.4322, -25.6043], boundingbox_max=[11.6396, 37.4322, 25.60423])

#
# the two mesh objects should have the same scale
#
User avatar
Yann Cointepas
Posts: 316
Joined: Tue Jan 20, 2004 2:56 pm
Location: Neurospin, Saint Aubin, France
Contact:

Re: managing object size

Post by Yann Cointepas »

Thank you for posting your code François.
Post Reply