Cinema 4D - Importing models from IMOD

From NoskeWiki
Jump to navigation Jump to search


NOTE: This page is a daughter page of: Cinema 4D

IMOD is a free set of image processing, modeling and display programs used for tomographic reconstruction. After generating 3D model of cells using IMOD/3dmod, I like to render them nicely and make moving in a program called Cinema 4D - a commercial, cross-platform, high-end 3D graphics application.

Importing an IMOD model into Cinema 4D R12 or Later

Putting an IMOD model file (.mod) into Cinema 4D (.c4d) involves first exporting it to a VRML 2.0 file (.wrl). To export to VRML you will need the latest alpha version of IMOD, which you can download from: here. A few little problems you may have are:

  • The exported meshes are often too fine and/or contained jagged edges along Z - hence you may want to use the low res mesh, or use Cinema 4D to do a polygon reduction.
  • The "imodmesh" algorithm tends to produce some very irregularly shaped triangles and certain points may connect to numerous other points.

NOTE: If you have Cinema 4D R11 or earlier you can get away with using older versions of IMOD which only convert to VRML 1.0 form. Cinema R12 does not open VRML 1.0 files, only VRML 2.0, but earlier versions of C4D can load both - so if you want to use (inferior) VRML 1.0 format please visit my old instructions at: Cinema 4D - Importing models from IMOD to C4D R11.

Below is the sequence to use to import an IMOD model file and then correct these problem:

  • #1) Download an install the latest alpha version of IMOD:
    • Go to: - sign in as "Guest" - and download the version which matches your operating system.
    • Go to the IMOD installation instructions, and use these instructions to install your downloaded .csh file. On most operating systems you can do this simply by opening a terminal window, then enter "sudo csh /full_path/imod_4.4.2_osx_intel64.csh" and follow the prompts.
      • NOTE: The command we need is imod2vrml2, so if you can type "imod2vrml2" into a Terminal window and it recognized this command you can skip this step. This command should be part of IMOD v 4.4.1 and later.
  • #2) Prepare mod file and convert to VRML:
    • Open your IMOD model file in 3dmod, press [v] to bring up the ModelView window.
    • Make sure all your desired objects are turned on (anything off is not included) and correctly meshed using the "Object ..." window.
      • NOTE: IMOD often produces meshes which are unnecessarily fine and/or contain jagged edges along Z. To reduce this problem consider running the "smoothsurf" command line or generate a low res mesh for certain object.
    • Save [s] and close 3dmod.
    • Open a terminal window and use the imod2vrml2 command: as demonstrated:
      • imod2vrml2 -r foo.mod foo.wrl
      • NOTE: The "-r" argument will rotate your model to a nice orientation for Cinema 4D. You can read about the other optional arguments here.
  • #3) Open your WRL file in Cinema 4D:
    • Open or drag foo.wrl into Cinema 4D
    • Choose your "VRML 2 Import" options and click Okay.
    • WARNING: Depending on the size of the vrml and number of spheres, opening the vrml can take many minutes
    • NOTE: The "Optimize hierarchy" option will remove a lot of "null objects" which contain your IMOD object names and even contour numbers, so you may want untick this option.
    • NOTE: You may like to change the units to "nanometers", but keep in mind the actual units will be pixels at this stage.

  • #4) Save as a C4D File:
    • Save the file as foo.c4d (which should load faster) and don't forget to save regularly.
    • If you used the "-r" option, notice the whole imod model is organized under a single null object container called "imod_model" and its already been rotated by -90 degrees in pitch so that the Z axis is now up (in Y) and the Y direction is now Z. The reason for this is that it's just much easier for making movies at this orientation. Use the "Objects" window to expand and see each object.
    • If you want to import a slice from your image, first save this slice as a TIF. It's best if you place this TIF in a folder called "tex" in the same directory as your c4d file. Within the Materials manager go: File > New Material. Open this new material by double clicking it, call it "SLICE_1" and set the Color > Texture to point to your tif image. Now click menubar > Objects > Primitive > Plane to insert a big rectangle. In the attribute you'll want to set this plane's X and Z size to the width and height of your image and set its X and Y position to half these values to position it in the right spot. The imod2vrml2 conversion has already applied the appropriate z-scale to all point positions, so to lift the slice to the right position its Y position would be set to (slice number-1) * Z scale. Now drag your new texture onto the plane and click [Ctrl + r] to render your image in the selected window.

NOTE: "1 m" in C4D is equal to 1 pixel in IMOD (after importing). Although not important when working with single models, you can change Edit > Preferences > Units > Display Units from meters (m) to nanometers (nm), then scale "My Model" by your pixel size. If you want to convert to your model to match "nanometers" select "imod_model" and change the X,Y and Z scale to match your pixel size - for example if your pixel size is "5.4 nm" / pixel, then you must scale your whole model up by 5.4. All objects inherit properties to their relative to their parents, so if you have placed your plane as a child of "imod_object" before changing the scale of its parent, then it will move and scale the same as the meshes.

To render the scene within the viewing port click [Cmd+r]. The next thing you'll probably want to do is: (1) modify the textures to look nicer, (2) set up your scene with lights and then (3) create a movie. For these instructions you should return to the Cinema 4D page where each of these steps is explained. In particular you'll probably be interested in the Smoothing Meshes and Creating Animation sections.

Other Pages

  • Cinema 4D - more information about Cinema 4D.
  • IMOD - more information about IMOD.


Acknowledgements: Graham Johnson and David Mastronarde