asims26

12-10-2007, 11:25 PM

Apologies for the late posting of summaries (original posting: 9 Nov 07).

Thanks to all who replied regarding my query about exporting the

displacement vector field from a reference surface to a deformed surface out

of AMIRA for use in Matlab or similar.

I have been able to successfully achieve this, and found these following

postings very helpful. There are a good number of useful tips in there.

The starting point for my query regarding exporting this data was as

follows:

1. Reference and deformed triangulated surfaces (formed the input to Surface

Distance module)

2. SurfaceDistance module

3. Output from SurfaceDistance module (vertex displacement vectors and

vertex displacement magnitudes)

Thanks and regards

Andrew Sims

---------------------------------------------

Ian Sigal replied: (please see my note at the bottom of this reply)

To export your data from Amira select the object with the vector data and

choose SaveAs, then some ASCII version of the file. You will then have to

manipulate that file outside to turn it into something usable elsewhere, say

with Matlab. It is possible to write modules in Amira that would export your

data already in the format needed, but you have to use AmiraDev. You can

also export the surfaces in this way. I know it is not the nicest response

and I wish I could tell you of a simple way to just save something readable

by Matlab. Amira 4 has some functionality that works with Matlab, I have

not used it, maybe it can do what you want better.

Also, be careful with SurfaceDistance. It is fast and efficient, but often

fails to compute distances for some parts, in which case it assigns the

maximum distance. Always make sure you check the distance vector and scalar

calculations to make sure they are what you need.

You can attach a vector display module to the vector field and scale the

vectors until you can see that they indeed go the way you want them. I have

seen several times when people have used the distance module and DID not get

what they wanted. It looked reasonable, but it was badly biased. We ended

up coding our own distance module but it is too specific for our uses that

it would be useless to you.

******************

NOTE: The vector data object in AMIRA 3.1 only saves as a binary *.am file.

Ian Sigal kindly provided me with a command line utility (aminfo.exe) that

reads the header and can be used to convert from binary to ascii files etc.

These are able to be easily imported in Matlab etc.

I plugged "aminfo amira" into a Google search, and the first entry returned

links to http://www.amira.com/resources/Ext23-04-aminfo/index.html, which

has aminfo.exe. Download and use at your risk... Syntax instructions are

included.

****************

----------------------------------------------------------

Michael Hardisty replied:

A couple of approaches come to mind:

You could use the "displace" compute module which should be accessable from

the menu from the surface vector field. Displace will create a displaced

version of the surface that you have (ie the surface nodes will be displaced

with the vector field). Amira will allow you to save surfaces in many ascii

formats which can be fairly easily imported into matlab. You can then

import both the original surface and the displaced surface into matlab and

find the displacement field by subtracting one position from the other.

Amira will not allow you to save surface vector fields in ascii format but

will allow you to save tetra vector fields in ascii formats, so you could

save the vector field by turning your surface into a volume mesh using

tetragen and then put the surface vector field onto a tetra vector field

using arithmetic. This approach involves the following steps.

- Generate a tetragrid by using tetragen, which should be accessable from

the surface's submenu.

- crate an arithmetic compute module from the tetragrid's submenu and then

connect inputB to the surface vector field that you are interested in and

change the result channels to "3 values (vector)" and change Expr

x: to "bx", Expr y: to "by", and Expr z: to "bz". When this arithmetic is

executed it will create a tetra vector scalar field, which can be saved in

ascii formats which again can be imported to matlab.

Another thought is that if you have access to Amira 4 you can directly use

matlab within Amira 4, however I am not familiar with this functionality.

----------------------------------------------------------

Karsten Engel replied:

I work with Amira 4.0 and I'm doing segmentation and meshes with Amira.

Normally, you can write every Mesh as an ASCII file, so that you can use the

data e.g. in MATLAB. You should try to save your field like this:

File: Save Data as. and then choose AmiraMesh ASCII in the field left of the

Cancel button. This should work.

I hope I could help you.

----------------------------------------------------------

Amanda Lin recommended the support provided by the AMIRA developers.

----------------------------------------------------------

Thanks to all who replied regarding my query about exporting the

displacement vector field from a reference surface to a deformed surface out

of AMIRA for use in Matlab or similar.

I have been able to successfully achieve this, and found these following

postings very helpful. There are a good number of useful tips in there.

The starting point for my query regarding exporting this data was as

follows:

1. Reference and deformed triangulated surfaces (formed the input to Surface

Distance module)

2. SurfaceDistance module

3. Output from SurfaceDistance module (vertex displacement vectors and

vertex displacement magnitudes)

Thanks and regards

Andrew Sims

---------------------------------------------

Ian Sigal replied: (please see my note at the bottom of this reply)

To export your data from Amira select the object with the vector data and

choose SaveAs, then some ASCII version of the file. You will then have to

manipulate that file outside to turn it into something usable elsewhere, say

with Matlab. It is possible to write modules in Amira that would export your

data already in the format needed, but you have to use AmiraDev. You can

also export the surfaces in this way. I know it is not the nicest response

and I wish I could tell you of a simple way to just save something readable

by Matlab. Amira 4 has some functionality that works with Matlab, I have

not used it, maybe it can do what you want better.

Also, be careful with SurfaceDistance. It is fast and efficient, but often

fails to compute distances for some parts, in which case it assigns the

maximum distance. Always make sure you check the distance vector and scalar

calculations to make sure they are what you need.

You can attach a vector display module to the vector field and scale the

vectors until you can see that they indeed go the way you want them. I have

seen several times when people have used the distance module and DID not get

what they wanted. It looked reasonable, but it was badly biased. We ended

up coding our own distance module but it is too specific for our uses that

it would be useless to you.

******************

NOTE: The vector data object in AMIRA 3.1 only saves as a binary *.am file.

Ian Sigal kindly provided me with a command line utility (aminfo.exe) that

reads the header and can be used to convert from binary to ascii files etc.

These are able to be easily imported in Matlab etc.

I plugged "aminfo amira" into a Google search, and the first entry returned

links to http://www.amira.com/resources/Ext23-04-aminfo/index.html, which

has aminfo.exe. Download and use at your risk... Syntax instructions are

included.

****************

----------------------------------------------------------

Michael Hardisty replied:

A couple of approaches come to mind:

You could use the "displace" compute module which should be accessable from

the menu from the surface vector field. Displace will create a displaced

version of the surface that you have (ie the surface nodes will be displaced

with the vector field). Amira will allow you to save surfaces in many ascii

formats which can be fairly easily imported into matlab. You can then

import both the original surface and the displaced surface into matlab and

find the displacement field by subtracting one position from the other.

Amira will not allow you to save surface vector fields in ascii format but

will allow you to save tetra vector fields in ascii formats, so you could

save the vector field by turning your surface into a volume mesh using

tetragen and then put the surface vector field onto a tetra vector field

using arithmetic. This approach involves the following steps.

- Generate a tetragrid by using tetragen, which should be accessable from

the surface's submenu.

- crate an arithmetic compute module from the tetragrid's submenu and then

connect inputB to the surface vector field that you are interested in and

change the result channels to "3 values (vector)" and change Expr

x: to "bx", Expr y: to "by", and Expr z: to "bz". When this arithmetic is

executed it will create a tetra vector scalar field, which can be saved in

ascii formats which again can be imported to matlab.

Another thought is that if you have access to Amira 4 you can directly use

matlab within Amira 4, however I am not familiar with this functionality.

----------------------------------------------------------

Karsten Engel replied:

I work with Amira 4.0 and I'm doing segmentation and meshes with Amira.

Normally, you can write every Mesh as an ASCII file, so that you can use the

data e.g. in MATLAB. You should try to save your field like this:

File: Save Data as. and then choose AmiraMesh ASCII in the field left of the

Cancel button. This should work.

I hope I could help you.

----------------------------------------------------------

Amanda Lin recommended the support provided by the AMIRA developers.

----------------------------------------------------------