Reader for propriatory formats

Will Schroeder will.schroeder at kitware.com
Mon Oct 11 13:29:37 EDT 1999


Hi Nils-

At 05:56 PM 10/11/99 +0200, Nils Holger Busch wrote:
>are there any guidelines/hints for coding data object readers for
>propriatory data file formats other than the provided classes?
>Is there anything special to keep in mind when designing one?

Here are some hints:
* Follow the vtk style guidelines see http://www.kitware.com/vtkhtml/vtkdata/CodeStyle.html

* Find the proper class to subclass from (what kind of data is output?) For example, if you're reading vtkPolyData, you probably would subclass from vtkPolyDataSource (see vtkSTLReader for an example). If you're reading image data, you most likely will subclass from vtkImageReader (refer to vtkTIFFReader for an example). Single inheritance, please.

* Make sure that you define and implement the following methods:
         - ::New() - use the brand new object factory approach that Bill Hoffman checked in today 
                 (he'll send an email later today describing the approach)
         - protected constructor, destructor, operator=, copy constructor
         - documentation

* Ivars should be protected if it all possible, with Set/Get and or Boolean methods to access them.

* No static variables; use ivars or automatic variables

* Reuse existing functionality whenever possible, whether by inheritance or object delegation.

* If you're reading multiple output datasets, or rendering information such as lights, cameras, etc., it might actually be an importer. Look at vtk3DSImporter for an example.

* Create a regression test or two. If it ain't tested, it's probably broken

* If possible, contribute your code back to the community so it can grow and change along with VTK

Will





--------------------------------
Dr. William J. Schroeder
Kitware Visualization Solutions / vtk Commercial Support
469 Clifton Corporate Parkway
Clifton Park, NY 12065
will.schroeder at kitware.com
1-518-371-3971 (Phone & Fax)


-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------




More information about the vtkusers mailing list