Your own files, or:
Optional Files (premade Model files use example files above)
- Complete Model
- VolumeandSurfaceSlice.mdl.zip (11 KB)
- Separate Models to Combine
The purpose of this tutorial is to teach you how to combine two of the previous workflows: volume rendering and surface modelling. In this tutorial, we will be using the previously created workflows to perform these taks (supplied above) to create a new workflow that uses all previously used blocks. This workflow is extremely complex, moreso than the registration workflow, so it is strongly suggested that the screenshot provided be followed to ensure proper connection.
Below is a list of the required blocks and the libraries in which they reside.
- Volume Rendering Workflow:
- All Blocks
- Surface Model Workflow:
- All Blocks
- Simulink Math Operations Library:
- 1 x Sine Wave
- SimvtkCommonLibrary.mdl Library:
- 1 x vtkPlane
- SimvtkRenderingLibrary.mdl Library:
- 1 x vtkInteractorStyleTrackballCamera
- 1 x vtkProperty
Click on the workflow below to get an enlarged version. Note that the Surface Model is primarily found in the top half of the total workflow, making the bottom half the volume rendering. The vtkRenderer block will be the point at which the two workflows come together.
Some of the pre-existing blocks will need to be altered. Also, one set of vtkRenderer, vtkRenderWindow, and vtkRenderWindowInteractor will need to be removed as we wish to have both in one window, and not two. Choose one of the two sets and remove them from the total workflow before starting.
Few alterations will be needed to accomodate the new blocks and allow the two workflows to work together. First, we will modify the necessary blocks to accomodate the two workflows and the new blocks, and then the newly added blocks will be integrated to the workflow.
Surface Model: vtkDataSetMapper
In order to view both the surface model and the volume rendering, the entire model needs to be sliced so the inside of the spinal phantom can be seen. The vtkDataSetMapper block needs to be modified to accomodate for the vtkPlane block that will perform this slicing.
Double-click the block and change the ClippingPlane Inputs parameter from 0 to 1. Click OK and this block has been modified for this workflow.
Surface Model: vtkActor
By default, SimVTK assigns a blue colour to the surface model. In the event one desires a proper bone-colour for the surface model, the vtkProperty block has this capability.
Double-click the vtkActor block and check the Property as Input checkbox. This will allow for the vtkProperty block to be connected to the vtkActor block to change the colour of the surface model.
Both vtkActor blocks need to be accounted for in this block. Double-click the block and change the value of the Actor Inputs to 2 and connect the two vtkActor blocks ensuring the 1 Volume Input is still present. Reconnections may need to occur so the proper block is connected to the proper input.
Double-click the block and check the InteractorStyle as Input checkbox to facilitate the vtkInteractorStyleTrackballCamera to connect to this block. This allows for a different way of interacting with the window that will feel more intuitive than the default interaction method SimVTK assigns.
Simply connect the output of this block to the InteractorStyle input on the vtkRenderWindowInteractor to use its InteractorStyle in the RenderWindow.
Volume Rendering: vtkVolumeRayCastMapper
Just as the vtkDataSetMapper acted on the SurfaceModel, the vtkVolumeRayCastMapper block needs to be modified to accomodate for the vtkPlane block that will perform this slicing on the VolumeRendering. In order to view both the surface model and the volume rendering, the entire model needs to be sliced at the same plane so the inside of the spinal phantom can be seen.
Double-click to edit the block parameters and change the ClippingPlane Inputs from 0 to 1 to allow for such an input. Click OK to save the changes.
Now that all the existing blocks have been modified, we will connect the newly added blocks and configure them accordingly. vtkPlane will need to have its outputs split to the vtkDataSetMapper and vtkVolumeRayCastMapper (the two blocks ClippingPlane Inputs were created for). After connecting the blocks, double-click the vtkPlane block to edit the parameters.
Change the Origin Parameter to “Use as Input”. We will now configure the Sine Wave function to cause the Origin to change with relation to the simulation time to create a dynamic view into the spine.
Connect the Sine Wave to the input on the vtkPlane. Double-click to configure the block and set the parameters as desired to oscillate through the volume.
In the included example, the following values were found to be optimal for viewing of
- Sine type: Time based
- Time (t): Use Simulation Time
- Amplitude: [0 0 65]
- Bias: 73
- Frequency: 1
- Phase: 0
- Sample time: 0
The final block that needs to be configured is the vtkProperty block. Connect it to the newly opened Property Input of the vtkActor in the Surface Model area of the workflow. Double-click the vtkProperty block so the values of the colour of the Surface Model can be changed.
Change the Color Parameter to the “As Parameter” setting, and notice that a Color Value text-entry field appears with a 3-valued vector as an initial input. These correspond to the percentage of [R G B] in the desired surface colour. Change this to [.89412 .81961 .75294] in order to give the surface a bone-like colour.
Once these are all connected with the proper outputs, change the runtime from “10.0″
to “inf” to allow for endless playback, press run and you should see something similar to this:
Congratulations! You have completed the tutorial!