Voxels and mm

Questions about BrainVisa usage and installation

Moderators: denghien, riviere

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

Voxels and mm

Post by Manik »

Hi,

I would like to know if I can retrieve the voxel coordinates of a point clicked on in Anatomist from BrainVisa, using a Point3D() parameter (instead of mm coordinates).
I need to do this to extract a box-shaped ROI from a T1 MRI, and AimsSubVolume does only work with voxel coordinates.
I see only two other solutions to this : parsing the output of AimsFileInfo to get the voxel size (which is somewhat painful), or adding an option ( --mm for example) to AimsSubVolume to allow the use of mm coordinates.
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:

Post by riviere »

Hi Manik,

Be careful... you're gonna make a mistake...
Going from the 3D position in mm to voxel coordinates is not so trivial: coordinates transformations between the (mm) space of the window where the click occured and the volume object must be taken into account.
The Point3D parameter type of BrainVisa can handle it if parameters links are correctly done: the point parameter must be linked to the volume parameter. Look at the PrepareSubject code for an example (this example is even a bit more complex than what you neeed).
After coordinates transformation, you still get mm coordinates, and then (and only then) you can divide by the voxel sizes.
Obtaining the voxel size of a volume in BrainVisa can be obtained from the DiskItem attributes:

Code: Select all

voxel_size = self.input_image.attributes().get( 'voxel_size' )
(here I assume 'input_image' is the volume parameter of your BrainVisa process).

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

Post by Manik »

Ok, everything works now.
I had already done "linkParameters", so I just needed the voxel size.
Thank you for the explanation.
Manik Bhattacharjee
INSERM U836
Post Reply