Archive pour 6 octobre 2009

matlab and amira; how to integrate complex calculus into Amira using MATLAB

2.14 Using MATLAB Scripts

In this tutorial you will learn how to integrate complex calculus into Amira using MATLAB (The MathWorks, Inc) by the means of the CalculusMatlab module.

In order to use the CalculusMatlab module, MATLAB 7 must be correctly installed on your computer. The CalculusMatlab module establishes a connection to the MATLAB computational engine that was registered during installation. If you did not register during installation, on the Windows command line you can enter the command:

  • matlab /regserver

The limitations of the CalculusMatlab module are listed in its documentation.

This tutorial covers the following topics:

  1. Loading and executing a MATLAB script.
  2. Lowpass filtering on images.
  3. Controlling the script with a time slider.
  4. Thresholding on a volume.

2.14.1 Lowpass Filtering on Images

In this section we will learn how to apply a lowpass filter on an Amira image using the MATLAB Fourier transformation. This example shows how to pass data and control variables from Amira to MATLAB, execute a MATLAB script, and import the data back into Amira


  • Load the lena.png image file located in subdirectory data/tutorials/matlab.
  • Choose Luminance in the Channel Conversion field as shown in Figure 34.
  • Right click on the green icon and choose CalculusMatlab from the Compute section.

A new red icon appears, the CalculusMatlab module that will try to connect to the MATLAB engine. This may take a while.

Figure 34: Loading the image
  • Load the script lowpass.m located in subdirectory data/tutorials/matlab by clicking the Read button of the File port.
  • Execute the script by clicking on the buffer button of the Execute port.
  • Connect an OrthoSlice to the filtered image result.

The module uses the MATLAB computation engine which has its own user interface.

You can easily show or hide the MATLAB console using the checkbox in the options field. The MATLAB console is very useful for debugging purposes because it allows you to access variables of the MATLAB workspace. Any variable not cleared by the MATLAB « clear » command in the script is accessible in the MATLAB workspace, even after finishing the current CalculusMatlab computation (see the CalculusMatlab documentation).

Figure 35: The CalculusMatlab module

In addition you can control scalar parameters of the script using time sliders:

  • Create a time slider (File/Create/Data/Time).
  • Connect the CalculusMatlab module to the time slider.
  • Change the line cutoff=0.05 to cutoff=t in the script (see the CalculusMatlab documentation for more information about the keyword t).
  • Click on the time slider and adjust the value that will be assigned to w. Right mouse click in the text field of the time slider and select Configure to adjust the data range of the parameters.

Figure 36: Left: original Right: lowpass filtered

Note: To handle RGBA image filtering, you must load the image with Color Field Channel Conversion and treat each channel separately in the script.

2.14.2 Thresholding on a Volume

In this section we will learn how to apply a threshold to a volume. This is done by setting a value for a threshold. If the value for the voxel is less than the threshold, the voxel value is assigned the value of zero. If it is above the threshold, it is assigned a value of 255.

  • Load the file located in subdirectory data/tutorials.
  • Right click on the green icon and choose CalculusMatlab from the Compute section.
  • Load the script threshold.m located in subdirectory data/tutorials/matlab by clicking the Read button of the File port.
  • Execute the script by clicking on the buffer button of the Execute port.

A new green icon appears, the Lattice that will hold the threshold result. Connect an OrthoSlice or a Voltex to see the result.

Note: Any variable accessed by MATLAB and pushed back into the Amira workspace will lose its voxel size information. You will need to correct the voxel size manually using the Crop Editor.

U3D and matlab file exchange; Export triangulated mesh into a pdf with a 3D interactive object.


Export triangulated mesh into a pdf with a 3D object. The matlab mesh is converted to IDTF with matlab code. The IDTF file is converted to u3d with an external binary file. The u3d file can then be embedded into a pdf with pdflatex and the movie15 package. The user can then interact with the mesh (zoom, rotate etc.) from adobe reader. The package contains demo data and example of output.

The code of the IDTF to U3D converter can be obtained at :

The toolbox has been tested on mac intel, linux and windows.

To test run the script : demo_mesh2pdf.m

MATLAB release MATLAB 7 (R14)
Other requirements The windows version requires to install MeshLab :

prix nobel de physique 2009: l’optique remporte le prix!

L’optique a été à l’honneur cette année pour le prix Nobel de physique. Ce prix a été décerné à  Charles K. Kao du Standard Telecom Lab pour ces travaux sur la transmission optique sur fibre pour les télécom et pour W. S. Boyle et G. E. Smith du Bell Lab pour leurs travaux sur les systèmes imageurs CCD.


Blog Stats

  • 221 100 hits


Flickr Photos

octobre 2009
« Sep