We show all the different ways in which we can import and export images and masks into and from Rhino3DMedical.

Open image and save to .3dm file

The first step to import an image is with Open Image button, or command RMOpenImage. If the image is valid (any of those among DICOM, MHD/MHA, NII, NRRD, TIFF), the tabs Image Analysis (RMImageAnalysis), Segmentation (RMSegmentation) and Image Filters (RMImageFilter) will be unlocked and available.

We can save the Rhino session as a .3dm file and open it later (beware that to open .3dm files we must call Rhino Open command instead): the image will be properly saved and reopened. Though, note that what is actually saved is the path to the image. Hence, if you remove or move your image elsewhere in your directory, upon opening the .3dm file Rhino3DMedical will complain that the image is not found. However, you can then relocate the file by using the command RMResetImagePath and saving the file again.

If you create a mask (Segmentation tab, Manual Segmentation area) and save the .3dm file, upon opening it Rhino3DMedical will properly retrieve it. No other settings are saved apart from the image path and the manual mask (e.g. no threshold settings, analysis, etc.).

Open Image

Import mask from threshold or object

Recall that a mask is a binary image, e.g. an image whose intensity values are either 0 or 1. In Rhino3DMedical, we see it as a set of colored voxels superposed with the currently active image.

The easiest way to create a mask is with the button Mask from Threshold in Segmentation tab. Before, you must define a threshold in Image Analysis tab, Set Threshold section. The mask takes all voxels of the image lying in the threshold range.

Mask from threshold

We can use any object in Rhino defining a volume to create a mask. It can be a surface (brep), a mesh or a closed curve. In the left side panel in the Rhino interface there are many tools we can use, for example commands MeshSphere and MeshBox for closed meshes, Sphere and Box for closed surfaces, or InterpCrv for closed curves (with command line option PersistentClose=Yes to close it).
Once we create such an object, we place it in the part of the image we want and press Mask from Object in Segmentation tab Manual Segmentation field. If the object is already selected its enclosed volume will be automatically added to the current mask, if not you will be prompted to select it as well as a mask operation in the command line (Add it to mask, Subtract it from the mask or Intersect it). In case the object is a curve, an additional step will be prompted in the command line to select the slice to which the curve should be projected to import its enclosed volume as mask.

Mask from Object (a Rhino sphere)

Mask from Object (a Rhino InterpCrv closed curve)

Import/export mask from/to file

The third option for creating a mask is to import it from file, with button Import Mask from File in Segmentation tab Manual Segmentation field. We will be prompted to select an image file (any of the image formats is correct though the most convenient one for pure masks is TIFF). A normal image can also be imported as mask (hence setting any non-zero voxel intensity as 1 and all zero voxel intensities as 0).

On the other hand, the most typical way of creating a mask file to be later imported is to export a manually created mask at a previous session. For that, we just press button Export Mask and a navigation window will let us save it in a directory (in this case, only as TIFF). We can always open a mask itself as an active image in a new session with RMOpenImage, although it makes little sense because its dimensions will be normalized in the lack of its parent image.

Example of mask being opened as main active image

Export masked image

The last significant export we can do is the superposition of the currently active image with the current mask. We extract and create a new image which keeps the image voxel intensities where the mask values are 1, and uniform background intensities elsewhere.
We create it by clicking on Export Masked Image, in Segmentation tab, Manual Segmentation section. Once clicked, check the command line, as there is the option to export it as DICOM. Click over the option only if you want to toggle it, then press Enter (sometimes the command line loses focus so you may still need to click over it in order to identify the Enter key). If ExportToDICOM is No, you will be prompted to select a new file with a format (among those supported). If ExportToDICOM is Yes, you will be prompted to select a directory that will contain the DICOM files; in this case, if the original image came from DICOM the exported masked image DICOM header will keep the original one.

Masked Image from a mask representing a sphere

Once the masked image is exported, it can be later opened as a new image for further analysis and segmentation.

Surface extracted after segmenting a masked image

Live session video

Watch here the live session explaining this post with a broader overview of Rhino3DMedical: