casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MakeRegion.qo.h
Go to the documentation of this file.
1 //# MakeRegion.qo.h: Qt implementation of viewer region maker window.
2 //# (This is the gui part only; it connects to region functions within
3 //# QtDisplayPanel).
4 //# Copyright (C) 2005
5 //# Associated Universities, Inc. Washington DC, USA.
6 //#
7 //# This library is free software; you can redistribute it and/or modify it
8 //# under the terms of the GNU Library General Public License as published by
9 //# the Free Software Foundation; either version 2 of the License, or (at your
10 //# option) any later version.
11 //#
12 //# This library 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 Library General Public
15 //# License for more details.
16 //#
17 //# You should have received a copy of the GNU Library General Public License
18 //# along with this library; if not, write to the Free Software Foundation,
19 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
20 //#
21 //# Correspondence concerning AIPS++ should be addressed as follows:
22 //# Internet email: aips2-request@nrao.edu.
23 //# Postal address: AIPS++ Project Office
24 //# National Radio Astronomy Observatory
25 //# 520 Edgemont Road
26 //# Charlottesville, VA 22903-2475 USA
27 //#
28 //# $Id$
29 
30 #ifndef MAKEREGION_H
31 #define MAKEREGION_H
32 
33 #include <casa/aips.h>
34 #include <casa/Containers/Record.h>
37 
38 #include <graphics/X11/X_enter.h>
39 #include <QtCore>
40 #include <QtGui>
41 #include <QList>
42 #include <QPushButton>
43 #include <QComboBox>
44 #include <graphics/X11/X_exit.h>
45 
46 namespace casacore{
47 
48  class WCUnion;
49 }
50 
51 namespace casa {
52 
53  class RSComposite;
54 
55  class MakeRegion : public QWidget {
56 
57  Q_OBJECT
58 
59  public:
60 
63 
64  public slots:
65 
66  //handle double click that announces a box is ready
67  void drawRegion(casacore::Record mousereg, WorldCanvasHolder *wch);
68 
69  //React to new region creation in display panel.
70  void newRegion_(casacore::String imgFilename);
71 
72  //handle switch display axis
74 
75  //handle single click to select a box
77 
78  //this is not used, it emits for any wc change, too often
79  void wcChanged(const casacore::String,
81 
82  virtual void closeEvent(QCloseEvent* event);
83 
84  signals:
85  void hideRegionInImage();
86 
87  protected slots:
88 
89  //load masks from the image
90  void loadRegionFromImage();
91 
92  //save masks to the image
93  void saveRegionToImage();
94 
95  //delete region from the image
96  void deleteRegionFromImage();
97 
98  //delete all masks
99  void deleteAll();
100 
101  //toggle show or hide, but does not delete any
102  void showHideAll();
103 
104  //toggle show or hide, but does not delete any
105  void showHideGroup();
106 
107  //use a different color
108  void colorAll(const QString&);
109 
110  //the work horse for all the edit commands
111  void doIt();
112 
113  //show help text
114  void showHelp();
115 
116  //create new box of this shape
117  void reShape(const QString&);
118 
119  void zPlaneChanged();
120  void pPlaneChanged();
121  protected:
122 
123  void rotateBox(int cb);
124  void addBox(RegionShape*);
125  void deleteBox(RegionShape*);
126  void reDraw();
127 
128  void addRegionsToShape(RSComposite*& theShapes,
129  const casacore::WCRegion*& wcreg);
130 
133  const casacore::WCRegion*& wcreg);
134 
135  //convert region to shape
137  QtDisplayData* qdd, const casacore::ImageRegion* wcreg);
138 
140 
141  private:
142 
144 
147 
149 
150  QTimer* timer;
151  bool flash;
152 
153  int cb;
154  int zIndex;
155  int pIndex;
157 
158  QGroupBox* tGroup;
159  QPushButton* removeAll;
160  QMenu *showHideMenu;
161  QPushButton* showHide;
162  QComboBox* color;
163 
164  QLineEdit* chan;
165  QLineEdit* corr;
166  QLineEdit* name;
167  QPushButton* load;
168  QPushButton* save;
169 
170  /*
171  QGroupBox* eGroup;
172  QComboBox* shape;
173  QPushButton* remove;
174  QPushButton* rotateL;
175  QPushButton* rotateR;
176  QPushButton* left;
177  QPushButton* right;
178  QPushButton* up;
179  QPushButton* down;
180  QPushButton* wider;
181  QPushButton* narrower;
182  QPushButton* taller;
183  QPushButton* shorter;
184  */
185 
186  };
187 
188 
189 }
190 
191 #endif
void reShape(const QString &)
create new box of this shape
void wcChanged(const casacore::String, const casacore::Vector< double >, const casacore::Vector< double >)
this is not used, it emits for any wc change, too often
QPushButton * load
QPushButton * removeAll
void hideRegionInImage()
bool planeAllowed(casacore::String, casacore::String)
void changeAxis(casacore::String, casacore::String, casacore::String, int)
handle switch display axis
void doIt()
the work horse for all the edit commands
QLineEdit * chan
void activate(casacore::Record)
handle single click to select a box
RegionShape * activeShape
DisplayData * regData
QtDisplayPanel * qdp_
Subclass of RegionShape used for drawing composite regions.
void showHideAll()
toggle show or hide, but does not delete any
void saveRegionToImage()
save masks to the image
void showHelp()
show help text
void addBox(RegionShape *)
void unfoldIntoSimpleRegionPtrs(casacore::PtrBlock< const casacore::WCRegion * > &outRegPtrs, const casacore::WCRegion *&wcreg)
QComboBox * color
QPushButton * save
casacore::PtrBlock< const casacore::ImageRegion * > unionRegions_p
QLineEdit * corr
void deleteAll()
delete all masks
void drawRegion(casacore::Record mousereg, WorldCanvasHolder *wch)
handle double click that announces a box is ready
QGroupBox * tGroup
void deleteRegionFromImage()
delete region from the image
void addRegionsToShape(RSComposite *&theShapes, const casacore::WCRegion *&wcreg)
void colorAll(const QString &)
use a different color
A hierarchical collection of named fields of various types.
Definition: Record.h:180
void rotateBox(int cb)
casacore::String zAxis
Parent class for all RegionShapes.
Definition: RegionShape.h:223
MakeRegion(QtDisplayPanel *qdp)
casacore::WCUnion * unfoldCompositeRegionToSimpleUnion(const casacore::WCRegion *&wcreg)
void showHideGroup()
toggle show or hide, but does not delete any
QLineEdit * name
Class to hold a region of interest in an image.
Definition: ImageRegion.h:86
virtual void closeEvent(QCloseEvent *event)
void newRegion_(casacore::String imgFilename)
React to new region creation in display panel.
RSComposite * regionToShape(QtDisplayData *qdd, const casacore::ImageRegion *wcreg)
convert region to shape
A holder to interface between DisplayDatas and a WorldCanvas.
Base class to define world coordinate regions of interest in an image.
Definition: WCRegion.h:95
String: the storage and methods of handling collections of characters.
Definition: String.h:223
QPushButton * showHide
Base class for display objects.
Definition: DisplayData.h:317
void loadRegionFromImage()
load masks from the image
Make the union of 2 or more image regions.
Definition: WCUnion.h:85
void deleteBox(RegionShape *)
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42