mrroigroup__define.pro


Name:
mrRoiGroup
Methods:
Constructor
mrRoiGroup::init              : constructor

Public variables (get/set)
mrRoiGroup::id                : get the object id
mrRoiGroup::setId             : set the object id

Copy methods
mrRoiGroup::duplicate         : returns an exact copy of the group
I/O methods
mrRoiGroup::save              : saves the object to file
mrRoiGroup_openxml            : open xml file for writing
mrRoiGroup::write             : write one roigroup to xml file
mrRoiGroup_closexml           : close the xml file
mrRoiGroup_load               : parse an mrRoiGroups xml file

XML Parser
mrroixml__define             : constructor, part I
mrroixml::init               : constructor, part II
mrroixml::startElement       : only start element,
mrroixml::endElement         : end element,
mrroixml::characters         : and data values are parsed

Private
mrRoiGroup__define            : constructor 1st part
mrRoiGroup::cleanup           : destructor
Description:
Class to store mrRoi objects, subclass to IDL_Container.
The class provides loading and saving functionality for
roigroups - file format is XML. In addition, a mrRoiGroup object
has an 'id' which is stored with the roi group and might be used
as a user value.
There's two ways of storing/retrieving roigroups to/from file.
If just a single roi group is to be loaded or saved, use the
classes load and save methods.
If the file shall contain an arbitrary number of roigroups,
Open the file via the mrRoiGroup_openxml static method.
Via the write method, any number of roigroups may be written
to the file. Then close the file via mrRoiGroup__closexml.
When reading from a file which potentially contains more than
one roigroup, use the static mrRoiGroup_read method. The
method returns an IDL_Container holding all roigroups from the
file.
See also code examples.
Example code:
; rg1 and rg2 shall be two roigroups with arbitrary number of
; rois.
; To write just one roigroup to file, use the save method:
res = rg1->save('C:\roigroup1.xml')
; To write both roigroups to the same file:
unit = mrRoiGroup_openxml, 'C:\roigroups.xml'
rg1->write, unit
rg2->write, unit
res  = mrRoiGroup_closexml, unit
; To read this file:
roigroup_container = mrRoiGroup_read, 'C:\roigroups.xml'

Name:
mrRoiGroup::init
Syntax:
x = obj_new('mrRoiGroup', id )
Arguments:
id
Optional argument of type integer - sets a user chosen id.
Description:
The constructor.

Name:
mrRoiGroup::cleanup
Syntax:
obj_destroy, obj
Description:
Since mrRoiGroup is a subclass of IDL_Container, destroying a
roiGroup will automatically destroy all contained objects.

Name:
mrRoiGroup::setId
Syntax:
obj->setId, id
Arguments:
id
An integer id
Description:
Allows to set a user defined integer id

Name:
mrRoiGroup::id
Syntax:
id = obj->id()
Return value:
Returns the user id

Name:
mrRoiGroup::duplicate
Syntax:
obj_copy = obj->duplicate()
Return value:
Returns an exact copy of the roigroup

Name:
mrRoiGroup_openxml
Syntax:
res = mrRoiGroup_openxml, filename
Arguments:
filename
The file to open
Return value:
The unit number in case of success, 0 otherwise
Description:
Opens an mrRoiGroups XML file for writing

Name:
mrRoiGroup_closexml
Syntax:
mrRoiGroup_closexml, unit
Arguments:
unit
The unit to close
Description:
Closes a file opened via mrRoiGroup_openxml

Name:
mrRoiGroup::write
Syntax:
obj->write, unit
Arguments:
unit
The unit, returned from the mrRoiGroup_openxml call
Description:
Writes the roigroup to file

Name:
mrRoiGroup_load
Syntax:
res = mrRoiGroup_load, filename
Return value:
obj_new() in case of error, otherwise an IDL_Container object that
holds all roigroups
Description:
Instanciates an XML parser and parses the given filename. All
mrRoiGroup objects found in the file are stored in a container which
is returned to the caller.
TODO  : catch error if parsing of file fails

Name:
mrRoiGroup::save
Syntax:
res = obj->save( filename )
Return value:
1 in case of success, 0 for failure
Description:
Creates a new mrRoiGroups xml file and writes the mrRoiGroup object
to the file.

Name:
mrroixml::init
Description:
Initialized the parser - need the parameter set and the 'doubles'
keyword as arguments.
XML file layout:
                           main element
                            one roigroup consists of...
           ... one or more Rois
11                        corner coordinates
....
128128                the mask size
                         any number of rois per roigroup
....           any number of roigroups per file
                          closing tag

Name:
mrroixml::startElement

Name:
mrroixml::endElement

Name:
mrroixml::characters
Description:
Collect data

Name:
mrroixml__define
Description:
The XML parser

Name:
mrRoiGroup__define
Description:
The class definition

Last modified: Mon Nov 29 13:30:07 2004