Welcome to MOST’s Visualization Module documentation

The MOST project aims to achieve an open, modular and scalable solution for the creation, execution and management of remote clinical consultations with direct interaction between specialists.

The project consists of a set of frameworks that deal with different aspects and technologies useful for the creation of telemedicine applications.

Visualization Framework

The Visualization Framework allows you to include into your mobile applications visual and interactive widgets capable of rendering , inspecting and changing properties of IStream objects. This framework internally uses the Android Touch Gallery Library for rendering images and the MOST Streaming Library for managing audio/video streams.

TREE:

Android Most Visualization API

Contents:

Javadoc

org.crs4.most.visualization
IPtzCommandReceiver
public interface IPtzCommandReceiver

An activity must implement this interface to be able to receive notifications from the attached PTZ_ControllerFragment or PTZ_PopupWindow

Methods
onGoHome
public void onGoHome()

Called when the user clicks on the home button of the pan-tilt panel

onPTZstartMove
public void onPTZstartMove(PTZ_Direction dir)

Called when the user presses one button of the pan-tilt panel

Parameters:
  • dir – the required moving direction
onPTZstartZoom
public void onPTZstartZoom(PTZ_Zoom dir)

Called when the user presses one button of the zoom panel

Parameters:
  • dir – the required zooming direction
onPTZstopMove
public void onPTZstopMove(PTZ_Direction dir)

Called when the user releases one button of the pan-tilt panel

Parameters:
  • the – moving direction before this stop command
onPTZstopZoom
public void onPTZstopZoom(PTZ_Zoom dir)

Called when the user releases one button of the zoom panel

Parameters:
  • the – zooming direction before this stop command
onSnaphot
public void onSnaphot()

Called when the user clicks on the snapshot button

IStreamArrayAdapter
class IStreamArrayAdapter extends ArrayAdapter<IStream>

This adapter is internally used from the StreamInspectorFragment for representing IStream data.

Constructors
IStreamArrayAdapter
public IStreamArrayAdapter(Context context, int viewId, List<IStream> objects, List<StreamProperty> streamProperties)

This adapter provides a way of rendering informations about a list of IStream objects.

Parameters:
  • context
  • viewId – the view id where to render the informations about each stream
  • objects – the list of IStream objects.
  • streamProperties – the properties to render for each stream (a null value renders all the available properties)
Methods
getView
public View getView(int position, View convertView, ViewGroup parent)
IStreamFragmentCommandListener
public interface IStreamFragmentCommandListener

This interface must be implemented by activities attached to the StreamViewerFragment fragment

Methods
onPause
public void onPause(String streamId)

Callback triggered when the user clicks on the pause button

Parameters:
  • streamId – the id of the stream the StreamFragment refer to
onPlay
public void onPlay(String streamId)

Callback triggered after the user clicked on the play button

Parameters:
onSurfaceViewCreated
public void onSurfaceViewCreated(String streamId, SurfaceView surfaceView)

Callback triggered once the surfaceView of the fragment became available

Parameters:
  • streamId – the id of the stream the StreamViewerFragment refer to
  • surfaceView – the surfaceView where to render the stream
onSurfaceViewDestroyed
public void onSurfaceViewDestroyed(String streamId)

Callback triggered after the surfaceView of this fragment has been destroyed

Parameters:
PTZ_ControllerFragment
public class PTZ_ControllerFragment extends DialogFragment implements OnTouchListener

This fragment provides you a set of visual panels and buttons to be used as a GUI frontend for handling remote PTZ webcams. This fragment expects the attached activity implements the IPtzCommandReceiver interface, because it notifies to this interface all the GUI actions (e.g button clicks)

Methods
newInstance
public static PTZ_ControllerFragment newInstance()

Provides a new instance of this fragment, with all panels visible

Returns:the PTZ_ControllerFragment instance
newInstance
public static PTZ_ControllerFragment newInstance(boolean panTiltPanelVisible, boolean zoomPanelVisible, boolean snapShotVisible)

Provides a new instance of this fragment, with a selection of desired panels

Parameters:
  • panTiltPanelVisible – set the pan-tilt panel visible or not
  • zoomPanelVisible – set the zoom panel visible or not
  • snapShotVisible – set the snapshot button visible or not
onAttach
public void onAttach(Activity activity)
onCreateView
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
onTouch
public boolean onTouch(View v, MotionEvent event)
PTZ_ControllerPopupWindowFactory
public class PTZ_ControllerPopupWindowFactory implements OnTouchListener

This Factory class provides you an interactive visual panel containing a set of buttons to be used as a GUI frontend for handling remote PTZ webcams. You need to pass a IPtzCommandReceiver interface to the factory method of this class, because it notifies to this interface all the GUI actions (e.g button clicks) Note that the created window implements the android.view.View.OnTouchListener interface, so you can move it to the desired position on the screen.

Constructors
PTZ_ControllerPopupWindowFactory
public PTZ_ControllerPopupWindowFactory(Context context, IPtzCommandReceiver ptzReceiver, boolean panTiltPanelVisible, boolean zoomPanelVisible, boolean snapShotVisible, int xPos, int yPos)

Creates a new floating popupWindow, containing a set of optional panels to be viewed

Parameters:
  • context – the context where to render the popup Window
  • ptzReceiver – the remote object to use as the target of all user notifications
  • panTiltPanelVisible – set the pan-tilt panel visible or not
  • zoomPanelVisible – set the zoom panel visible or not
  • snapShotVisible – set the snapshot button visible or not
  • xPos – the initial X position of the popupWindow
  • yPos – the initial y position of the popupWindow
Methods
getPopupWindow
public PopupWindow getPopupWindow()
Returns:the created popup Window
onTouch
public boolean onTouch(View v, MotionEvent event)
show
public void show()

Show the popupWindow at the current location

StreamInspectorFragment
public class StreamInspectorFragment extends Fragment

This fragment provides a way for visually getting and/or updating the video properties of a list of IStream objects. Also, you can specify a filter for getting only a subset of stream properties you are interested in. You can attach this fragment to any activity, provided that it implements the StreamInspectorFragment.IStreamProvider interface.

Methods
newInstance
public static StreamInspectorFragment newInstance()

Provides a new istance of this fragment

Returns:the StreamInspectorFragment instance
onActivityCreated
public void onActivityCreated(Bundle bundle)
onAttach
public void onAttach(Activity activity)
onCreateView
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
refreshData
public void refreshData()

Force the reloading of the stream data of the underlying adapter

updateStreamStateInfo
public void updateStreamStateInfo(IStream stream)

This method would be called for notifying the StreamInspectorFragment that one or more properties of the IStream (specified as argument) has been changed,

Parameters:
  • stream – the modified IStream object
StreamInspectorFragment.IStreamProvider
public interface IStreamProvider

This interface is used by the StreamInspector for getting the streams to inspect along with their properties.

Methods
getStreamProperties
public List<StreamProperty> getStreamProperties()

Provide the list of properties to show for each stream (a null value shows all properties)

getStreams
public List<IStream> getStreams()

Provides the list of the streams to show in the inspector

Returns:the list of the streams to inspect
StreamViewerFragment
public class StreamViewerFragment extends Fragment

This fragment represents a visual container for an IStream. It can be attached to any Activity, provided that it implements the IStreamFragmentCommandListener interface. This fragment contains a surface where to render the stream along with two image buttons that you can optionally use for sending play or pause stream requests to the attached activity

Fields
FRAGMENT_STREAM_ID_KEY
public static final String FRAGMENT_STREAM_ID_KEY
Methods
newInstance
public static StreamViewerFragment newInstance(String streamId)

Intances a new StreamViewerFragment

Parameters:
  • streamId – the id of the stream to render
Returns:

a new StreamViewerFragment instance

onActivityCreated
public void onActivityCreated(Bundle bundle)
onAttach
public void onAttach(Activity activity)
onCreate
public void onCreate(Bundle savedInstanceState)
onCreateView
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
onDetach
public void onDetach()
setPlayerButtonsVisible
public void setPlayerButtonsVisible(boolean value)

Set the player buttons visible or not

Parameters:
  • valuetrue set buttons visible; false invisible.

Examples

Android

All the following examples are located into the folder examples/android.

  • StreamInspectorExample This example explains you:
  • how to play a stream on a StreamViewerFragment
  • how to get and/or update the properties of the stream by using a StreamInspectorFragment
  • how to change the Stream Rendering mode. You can choose among the following 3 modalities:
    • rstp streamning (the continous stream that the user can play or pause by clicking the player buttons provided by the StreamViewer fragment)
    • still-image (you load a snapshot from the renmote camera by clicking on a button)
    • timed still-images (the system loads a jpeg image from the remote camera every # seconds, as specified by the user)
  • PTZ_ControllerExample This example explains you:
  • how to play a stream on a StreamViewerFragment
  • how to get and/or update the properties of the stream by using a StreamInspectorFragment
  • how to remotely control pan, tilt and zoom values of an Axis PTZ Webcam by using a PTZ_ControllerFragment
  • how to make snapshots of the stream and save them into the internal storage
  • PTZ_ImageGalleryExample This example contains all the features of the PTZ_ControllerExample example, and in addition, explains you:
  • how to open an Image Gallery containing all the stream snaphots, by using a ImageGalleryFragment
  • how to select an image from the gallery, zoom in/out and move it by touch screen gestures
  • how to delete an image from the gallery (simply by a double tap on it)
For running the Android examples, open your preferred IDE (e.g Eclipse) and do the following changes:
  • Import the Most-Streaming project library
  • Edit the file jni/Android.mk and properly change the absolute path of the environment variables GSTREAMER_SDK_ROOT_ANDROID and GSTREAMER_ROOT
  • Import the Android project example located from the android/examples folder and add the Most-Streaming and the Most-Visualization projects both as Library and project references
  • Create your uri.properties.default property file and put it into the assets folder.(That folder already contains the uri.properties file that you can use as template for your own property file)
  • Build the projects (Note that the NDK must be installed and configurated on your system in order to build the project)
  • Deploy the application on an android device or emulator

License

/*!
 * Project MOST - Moving Outcomes to Standard Telemedicine Practice
 * http://most.crs4.it/
 *
 * Copyright 2014-15, CRS4 srl. (http://www.crs4.it/)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * See license-GPLv2.txt or license-MIT.txt
 */

GPL2: https://www.gnu.org/licenses/gpl-2.0.txt

MIT: http://opensource.org/licenses/MIT

Authors

Code author: Francesco Cabras <francesco.cabras@crs4.it>

Code author: Stefano Leone Monni <stefano.monni@crs4.it>

Indices and tables