Axial Swap

Part 2: Performing an Axis Reorientation with SimVTK

Necessary Files

Your own files, or:

Optional Files (premade Model files use example files above)

The purpose of this tutorial is to teach you how to switch the axes of a volume using SimVTK in the event your two volumes are not in the same orientation. In this tutorial, the MR volume will be reoriented to match the axes of the CT volume. As an example, compare CroppedCT.vtk to CroppedMR.vtk from our downloads section (click to enlarge):

Here, it is clear that the axes need to be reoriented.

In Simulink, create a new model. Three blocks will be necessary:

  • a vtkDataSetReader block (found in the SimVTK IOLibrary)
  • a vtkDataSetWriter block (also in the SimVTK IOLibrary)
  • and an vtkImagePermute block (found in the SimVTK ImagingLibrary).

Connect the vtkDataSetReader block to the vtkImagePermute and the vtkImagePermute block to the vtkDataSetWriter block. Since we are still concerned with the use of .vtk files, we will continue to use vtkDataSetReader and vtkDataSetWriter blocks in this tutorial.

Exactly like the previous tutorials, we will read in the .vtk file, perform the specified swap, and write the swapped output as a .vtk file. This workflow should look identical to the Crop tutorial. Different parameters will be used, however, to give us our desired result.

Your workflow should look similar to this, disregarding the filename:

The vtkDataSetReader and vtkDataSetWriter blocks will not be discussed here
as they are used in the same manner as outlined in the Crop tutorial. For instructions
on proper configuration of the blocks, please see the Crop tutorial.

Using the Crop tutorial as a template (either created yourself by using the tutorial, or
downloaded from the downloads section under Spine Registration), we will alter the
vtkImagePermute block.

vtkImagePermute

Select the AutoCropOutput, OutputExtent, OutputOrigin, and OutputSpacing Parameters

and change them from the “As Parameter” setting to the “Use Default” setting. This will disable them from being used in this workflow. Instead, change the FilteredAxes Parameter (and not Axis) to “As Parameter”. Beneath it, a text entry field will appear: FilteredAxes Value. This entry field takes a three value vector as its input: [x y z]. X, Y, and Z are also given numerical values of 0, 1, and 2, respectively (X = 0, Y = 1, Z = 2). In this field, place the number corresponding to the current axis orientation in the volume in the desired vector location.

In our case, we wish to reorient the Z-axis to be the X-axis, X to be Y, and Y to be Z. Thus, the FilteredAxes Parameter will be [2,0,1]. Refer back to the image at the beginning of this tutorial if need be.

Once these parameters have been adjusted, click OK. The workflow is now ready to be run. Click play in the toolbar and wait for the noise indicating completion is heard.

Congratulations! You have completed the tutorial!

> Continue onto the Axial Mirroring tutorial.

Comments are closed.