ECG Terrain

From UBC Wiki

Introduction

  • Summary of the project
  • Why is it important
  • What was the problem you were trying to solve?
  • What story do you want to tell?

If you have a case study video, include it here.

Primary Features

Provide an overview of the key features of the project and what they do.

Methods

Discussion

Findings

Provide a top level overview of the major challenges encountered and how they were addressed.

Challenges

Provide enough information for a first time user to get up and running.

Code

Code Background

To build this project, Unity Version 2019.4.19f1 was used as the primary platform. The code for this project can be found at https://github.com/ubcemergingmedialab/ECGTerrain.

The ECG Terrain

In creating this terrain, a dataset of 1D ECG signals which were converted to a 2D images and further imported into Unity to create the 3D Terrain. The peaks and valleys of the ECG data can be seen as part of the terrain. The images are then processed to eliminate and reduce the noise that is usually displayed in an ECG dataset. Here, we can create an interactive platform for cardiologists to visualize this data in an VR environment. The 3D image has over 3000 rows and each row has 6 cycles, allowing it to display over 30 minutes of ECG data on one single screen.

ECG data lined up to create a 3D model

The two main scripts used to create our prototype included:

  • ListenToMouse.cs - with Physics.Raycast and parameters RaycastHit returning an image for each range area clicked; and no image otherwise. (see https://docs.unity3d.com/ScriptReference/Physics.Raycast.html and https://docs.unity3d.com/ScriptReference/RaycastHit.html) In our prototype, three images were set for three separate range sections of the terrain, with each image rendering on the screen upon Input.GetMouseButtonDown(0), no image if clicked outside the three ranges or if Input.GetMouseButtonDown(1).
  • ThirdPersonMovement.cs - displaying navigation with a third person camera.

Preliminary Prototype

We created a prototype of the UX design for the project with the following goals:

UML State Diagram of ECG Terrain prototype functionalities.

1. Have the terrain separated into distinct ranges, and have a separate ECG image associated with each section.

We started by separating the terrain into 3 ranges along the x-axis in Unity: "front 1/3", "middle 2/3" and "back 2/3" as seen on the state diagram.

We then assigned a different ECG image to each of the 3 sections: "picture 1" for the first third, "picture 2" for the second, and "picture 3" for the last third.

2. Able to click on a section of the terrain, and have the corresponding ECG image show up on the screen.

With the "ListToMouse" script listed above, we were able to have the chosen ECG image render on the screen above the terrain when the user left-clicks down on the matching terrain section.

3. Able to exit the ECG image and return to the terrain.

To return to the "no picture" state, we added 2 functionalities:

  • Clicking anywhere outside of the displayed ECG image
  • Right-clicking anywhere on the screen. This was added to account for the possibility of the displayed ECG trace image encompassing the user's entire screen in future alterations to the project. This would allow the user to return to the terrain without having to click on an area outside of the displayed image.
(1) Mouse hovering over section 1 of the terrain; region outlined with an orange highlight.

Future Implementations

Some future additions we plan to add to our prototype are as follows:

General

  • To be able to split up the terrain into over thousands of sections.
  • To have each ECG image directly related to its section of the terrain - have an image that matches the terrain shape show up.
(3) Simple outline of the selected ECG trace is raised above the terrain on the XY view on Unity.

Mouse functionalities

(2) ECG Terrain with mouse hovering over single trace. Zoomed at 100%

When hovering the mouse over a the desired section of the terrain:

  • To have the outline of the trace highlighted, to create a more precise and clear selection (1), (2).
  • To have a simple outline raised above the terrain, for better visualization, particularly for sections embedded in the middle of the 3D object (3).
  • To have the highlighted section follow the mouse as mouse position changes (4).


(5) ECG Terrain with mouse hovering over single trace. Zoomed at 200%.
(4) As mouse moves from right (lighter colour - before) to left (darker colour - after), the position of the highlight changes to indicate the other ECG trace.

On screen information

  • To have more information available on-screen past a certain zoomed in percentage.
    • Eg. Zoomed at 100% - cursor, terrain outline, outlined point (2).
    • Eg. Zoomed at 200% - cursor, terrain outline, outlined point, coordinates on outlined text box (5).
  • To have the coordinate value in the text box updated as the mouse position changes (6).


(6) Mouse moves from the right (light colour - before) to the left (darker colour - after).

Other

Viewing the terrain from the XY view on Unity is difficult, as we are only able to see the height of the electrical signal at t=1. Thus, a possible way to improve on this interaction would be to pan the camera over to the ZY view whenever a trace is clicked on in the XY view, while still highlighting the same selected trace.

ECG Terrain XY view panning to ZY view after being clicked on.


Colour elements

  • Cursor: regular.
  • Point: white, outlined with terrain highlight colour.
  • Coordinates text box: white, outlined with terrain highlight colour.



Art Assets

Provide information on any artwork developed for the project. This could includes scenes, controllers or assets.

Libraries

What third party assets and plugins were used in the development of this project? Please thoroughly list all of them.

A section regarding Unity Engine components and art related elements pertaining to that Prefab or Gameobject

  • What components need to be present in the Prefab or Gameobject for the feature to work properly (eg. Rigidbody and Colliders)
  • Why the components are needed
  • What tags or layers the Prefab or Gameobject needs to be set as and why
  • Any additional special notes or quirks about the GameObject or Prefab

First Time Setup Guide

  • Provide enough information for a first time user to get up and running
  • Known Issues affecting functionality or stability of the program

Poster

Upload a pdf link of your poster to the wiki. An editable version of the document is preferred.

Development Team

Include everyone who worked on the project and their role.

FAQ

As the title suggests

Bibliography

Provide enough information for a first time user to get up and running.

License

Last edit: May 6, 2019 by Jin Li