hdf images hdf images

This web site is no longer maintained (but will remain online).
Please see The HDF Group's new Support Portal for the latest information.

How to Implement HDFView Modules

Table of Contents


1.Introduction

This document describes the modular HDFView interfaces, and provides user guidance on how to implement HDFView modules. This guide is not the HDFView User's Guide. The HDFView Users Guide is installed with HDFView or you can visit the website at HDFView User's Guide.

1.1 What is modular HDFView?

Modular HDFView is an improved HDFView with replaceable I/O and GUI modules. It consists of several interfaces that enable users to write and use alternative implementations of I/O and GUI components to replace default modules. The current replaceable modules include:

1.2 Why modular HDFView?

Early versions of HDFView (version 1.3 or earlier) were implemented with standard GUI components such as tree view, table, and image view. These components could be replaced. There was no optional tree view, table view, and etc for users to display the data in a different way. Supporting a new data format would also require major changes in the GUI and I/O source code. To solve this problem, modular HDFView was introduced. Modular HDFView has the following advantages:

1.3 Basic requirements

The modular HDFView should meet the following basic requirements:

2. Fundamental approach

The fundamental approach is to re-architect HDFView so that it separates API definition and implementation. HDFView only calls the abstract interfaces not the implementation. This allows users to write their own classes (or modules) which implement the interfaces to replace standard default implementation. The main goal is to make the modules easy to implement and flexible to meet user's needs.

HDFView consists of three basic components: the main view, the object package, and the GUI modules. The following figure explains the relationship of the three components.


HDFView Components

The main window is the first window frame you see when you start HDFView. It has access to only the common object package (abstract data object classes) and the GUI interfaces. It does not depend on any implementation of the I/O and GUI components. Therefore, adding new modules does not require any change in HDFView. This separates user's implementation from the HDFView development.

The layout of the main window is shown in the following figure. The main window has two major panels: the TreeView Panel and the Data Panel. The TreeView Panel is used to display the structure of the file in tree. The Data Panel is used to show other GUI components such as ImageView, TableView and TextView.


HDFView Main Window

The common object package, ncsa.hdf.object, consists of abstract classes for file access. The abstract classes only define abstract methods such as data input/output from/to file. Sub-classes have to implement these interfaces. HDFView only depends on the abstract classes. For example, when you open a file from HDFView, the main view calls the method, ncsa.hdf.object.FileFormat.open(filename) and retrieves the file structure. The details of how to open the file and how to retrieve the file structure are left for implementation classes.

GUI components, such as TreeView, ImageView, TableView, etc, are interfaces instead of implementing classes. The main view only has access to these interfaces. For instance, when you launch a command from HDFView to display a dataset in TableView, HDFView calls TreeView.showDataContent(dataObject) and returns the implementation of the TableView of a user's selection.

3. How to implement an I/O module

3.1 Classes to implement

The following diagram shows the class hierarchy of the object package. The class diagram uses the Unified Modeling Language (UML) notations: association (has), generalization (inherits), refinement (implements) and composition (belongs), to represent the relations of classes. HObject is the base class of all data objects, which implements DataFormat. HObject has two inherited classes: Group and Dataset to represent HDF groups and datasets. Dataset has two sub-classes, ScalarDS and CompoundDS. Each FileFormat contains one or more HObjects.


I/O Class Hierarchy

To add a new I/O module (file format), the following classes must be implemented:

3.2 Steps to implement an I/O module

To add an I/O module into HDFView, you must follow the steps below:

4. How to implement a GUI module

4.1 Replaceable GUI components

Modular HDFView provides several interfaces for GUI components along with a default implementation. Users can write their own implementation of these interfaces to replace the default modules. The HDFView GUI components are TreeView, TableView and ImageView to show the file content visually. The main HDFView window is a frame to host these components. The current replaceable GUI modules include Tree view, Table view, Image view, Text view, Metadata view, Palette view

4.2 Steps to implement a GUI module

To add and use a GUI module in HDFView, you must follow the steps below:
- - Last modified: 31 January 2017