source: trunk/src/Outputs/AnnotationWriter.hh @ 1075

Last change on this file since 1075 was 1075, checked in by MatthewWhiting, 12 years ago

Improved parameter output for the annotation files. Tidying up the VOParam & VOField classes, and adding some documentation comments.

File size: 4.1 KB
Line 
1// -----------------------------------------------------------------------
2// AnnotationWriter.hh: Base class for writing results to annotation files,
3//                      annotating images in some FITS viewer.
4// -----------------------------------------------------------------------
5// Copyright (C) 2006, Matthew Whiting, ATNF
6//
7// This program is free software; you can redistribute it and/or modify it
8// under the terms of the GNU General Public License as published by the
9// Free Software Foundation; either version 2 of the License, or (at your
10// option) any later version.
11//
12// Duchamp is distributed in the hope that it will be useful, but WITHOUT
13// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15// for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with Duchamp; if not, write to the Free Software Foundation,
19// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
20//
21// Correspondence concerning Duchamp may be directed to:
22//    Internet email: Matthew.Whiting [at] atnf.csiro.au
23//    Postal address: Dr. Matthew Whiting
24//                    Australia Telescope National Facility, CSIRO
25//                    PO Box 76
26//                    Epping NSW 1710
27//                    AUSTRALIA
28// -----------------------------------------------------------------------
29#ifndef DUCHAMP_ANNOTATION_WRITER_H_
30#define DUCHAMP_ANNOTATION_WRITER_H_
31
32#include <duchamp/Outputs/CatalogueWriter.hh>
33#include <duchamp/Outputs/FileCatalogueWriter.hh>
34#include <duchamp/Detection/detection.hh>
35#include <ios>
36#include <iostream>
37#include <fstream>
38
39namespace duchamp {
40
41  /// @brief Base class for writing FITS annotation files
42  /// @details This class supports the creation of annotation files
43  /// that can be used to supplement the viewing of FITS files in
44  /// external viewers. Examples include kvis, ds9, casaviewer. The
45  /// class will support the I/O, writing of different types of
46  /// annotations (text, lines, circles, ellipses) and other basic
47  /// functionality. Classes to write to specific types of annotation
48  /// files should derive from this and implement their own header and
49  /// primitive methods.
50
51  class AnnotationWriter : public FileCatalogueWriter
52  {
53  public:
54    /// @brief Default constructor
55    AnnotationWriter();
56    /// @brief Constructor with given filename
57    AnnotationWriter(std::string name);
58    /// @brief Copy constructor
59    AnnotationWriter(const AnnotationWriter& other);
60    /// @brief Copy operator
61    AnnotationWriter& operator= (const AnnotationWriter& other);
62    /// @brief Default destructor
63    virtual ~AnnotationWriter(){};
64
65    /// @brief Define how comments are represented - this string will be placed at the start of a comment line
66    void setCommentString(std::string s){itsComment = s;};
67
68    /// @brief Write header text describing what the file is for
69    virtual void writeHeader();
70    /// @brief Write a summary of the input parameters
71    virtual void writeParameters();
72    /// @brief Write a summary of the statistics used for detection
73    virtual void writeStats();
74    /// @brief Write the global properties for the file (colour, WCS info, ...)
75    virtual void writeTableHeader()=0;
76    /// @brief Write information describing a detected object
77    virtual void writeEntry(Detection *object);
78
79    /// @brief Write any information to go at the end of the file
80    virtual void writeFooter(){};
81
82    /// @brief Annotate with a text string
83    virtual void text(double x, double y, std::string text)=0;
84    /// @brief Annotate with a single line
85    virtual void line(double x1, double x2, double y1, double y2)=0;
86    /// @brief Annotate with a circle
87    virtual void circle(double x, double y, double r)=0;
88    /// @brief Annotate with an ellipse
89    virtual void ellipse(double x, double y, double r1, double r2, double angle)=0;
90
91  protected:
92    std::string itsComment; ///< How comments are denoted in the annotation file (may be just a single char, eg. '#', but make it flexible)
93  };
94
95}
96
97#endif
Note: See TracBrowser for help on using the repository browser.