Skip to content

Downsampling Objects in Amira

Julie edited this page Feb 13, 2015 · 2 revisions

Often the object files you create in Display are too big (ie. have too many vertices/faces) to conveniently use in further applications (ex. MAGeT-Brain). This is a brief description of how to use the software Amira (http://www.fei.com/software/amira-3d-for-life-sciences/) (which is unfortunately not open-source) to downsample an object file. This description is specific to Amira version 6.0. Some command names/colours may differ for other versions.

  1. First, convert your .obj file into the Amira format .iv (the 'open inventor' format):

bicobj2iv in.obj > out.iv

This code is available through the bicInventor library. Download instructions for this library can be found at https://wiki.mouseimaging.ca/plugins/viewsource/viewpagesrc.action?pageId=2745 (see #8 under Installation).

  1. Load the .iv file into Amira. You will see it appear in the top left of the screen, in the "Project View" panel as a green rectangle. The "Project View" panel will document your pathway, aka. the steps you take to manipulate your data.

  2. Right-click on the loaded data, then select Convert -> Open Inventor Scene to Surface. Scroll to the bottom of the screen on the right, and click Create. This will add a red rectangle with the title Open Inventor Scene To Surface to your Project View panel. Click on this rectangle and click Apply (the green button on near the bottom of your screen). This will create a new data type, specifically another green rectangle entitled GeometrySurface. Right-click on GeometrySurface, click Display -> SurfaceView -> Create. A yellow rectangle entitled Surface View should appear. Click on this, and you should see your data as a 3D surface.

  3. Click on your GeometrySurface again. The bottom left box on your screen is called "Properties". In the top right corner of this box, there's a button with a red triangle called "Simplification Editor". Clicking this button will bring you to a screen which will show you, among other things, the number of faces on your surface. On the Simplify line, you can manually enter the number of faces. Depending on how much smaller you want your file to be, use this box to adjust the number of faces (I normally reduce to 10% of the original). Click Simplify now. The surface should be updated.

  4. In addition to downsampling, you probably want to smooth the surface a bit. To do this, right-click on GeometrySurface, and click Surface Transformations -> Smooth Surface -> Create. You should see another red rectangle with the label Smooth Surface appear. Click this rectangle, then click the green Apply button. You should now see another GeometrySurface. Click on this, then right-click, Display -> Surface View -> Create. You will get another Surface View yellow rectangle. At this point, you're viewing both your Surface Views overlayed on each other. Deselect the small red square on your first Surface View to view just the most recent one. So you've now applied one smooth iteration to the surface, which probably didn't make a huge difference to your file. You can apply further smooth iterations by clicking on the Smooth Surface executable (red rectangle) that should be in your Project View panel and clicking on Apply. Your surface should update in real time. Be aware that it's a fine balance between smoothing enough to make a nice-looking surface, and smoothing too much so that you just have an amorphous blob. I normally find ~6 smooth iterations does the trick.

  5. Now click on the downsampled, smoothed GeometrySurface (your most recently-created green rectangle). Go to File -> Export Data As and save in the Open Inventor ascii (*.iv) format.

  6. The latest Open Inventor versions (v8.0+, to which Amira will automatically save) are unfortunately different than the earlier version (v2.1), so you have to convert the .iv you just saved to the old .iv format. I use a handy piece of code to do this, but it's just a matter of changing the header. There's information about .iv headers available online.

  7. The reason you had to do that conversion is because the following command, which will convert your .iv file back into a .obj file, only accepts the old (v2.1) .iv format.

iv2bicobj in.iv out.obj

This command is also a part of the bicInventor library. You should now have a downsampled and smoothed object!

Clone this wiki locally