casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ImageManagerDialog.qo.h
Go to the documentation of this file.
1 //# Copyright (C) 2005
2 //# Associated Universities, Inc. Washington DC, USA.
3 //#
4 //# This library is free software; you can redistribute it and/or modify it
5 //# under the terms of the GNU Library General Public License as published by
6 //# the Free Software Foundation; either version 2 of the License, or (at your
7 //# option) any later version.
8 //#
9 //# This library is distributed in the hope that it will be useful, but WITHOUT
10 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 //# License for more details.
13 //#
14 //# You should have received a copy of the GNU Library General Public License
15 //# along with this library; if not, write to the Free Software Foundation,
16 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
17 //#
18 //# Correspondence concerning AIPS++ should be addressed as follows:
19 //# Internet email: aips2-request@nrao.edu.
20 //# Postal address: AIPS++ Project Office
21 //# National Radio Astronomy Observatory
22 //# 520 Edgemont Road
23 //# Charlottesville, VA 22903-2475 USA
24 //#
25 #ifndef IMAGEMANAGERDIALOG_QO_H
26 #define IMAGEMANAGERDIALOG_QO_H
27 
28 #include <QDialog>
29 #include <display/QtViewer/ImageManager/ImageManagerDialog.ui.h>
32 #include <casa/BasicSL/String.h>
33 
34 namespace casacore{
35 
36  template <class T> class ImageInterface;
37 }
38 
39 namespace casa {
40 
41  class DisplayOptionsDialog;
42  class QtDisplayData;
43  //class ImageView;
44  class ImageScroll;
45  class DisplayDataHolder;
46  class ColormapDefinition;
47  class Colormap;
48 
54  class ImageManagerDialog : public QDialog, public ImageTracker {
55  Q_OBJECT
56 
57  public:
58  ImageManagerDialog(QWidget *parent = 0);
59  //Sets the containers which are the sources for display data, both registered and
60  //open.
61  void setImageHolders( std::shared_ptr<ImageManagerDialog> holder,
62  std::shared_ptr<DisplayDataHolder> displayed,
63  std::shared_ptr<DisplayDataHolder> allImages );
64 
65  //Sets the image that is currently being viewed (on the Animator). Allows the image
66  //manager to indicate the current image on the display.
67  void setViewedImage( int registrationIndex );
68  void closeImageView( QtDisplayData* image );
69 
71 
72  //-----------------------------------------------------------------------
73  // Image Tracker Interface
74  //-----------------------------------------------------------------------
75  //Internally, a new master image has been selected.
76  void masterImageSelected( QtDisplayData* image );
77  //Adds an image to the manager when a new one is opened.
78  void imageAdded( QtDisplayData* image, int position,
79  bool autoRegister, bool masterCoordinate,
80  bool masterSaturation, bool masterHue );
81 
82  signals:
83  void ddClosed( QtDisplayData*& dd );
84  void ddOpened( const casacore::String& path, const casacore::String& dataType,
85  const casacore::String& displayType,/*, const QColor singleColor*/
86  int insertionIndex, bool registered,
87  bool masterCoordinate, bool masterSaturation,
88  bool masterHue);
89  void registerAll();
90  void unregisterAll();
91  void registerDD( QtDisplayData* dd, int position );
92  void unregisterDD( QtDisplayData* dd );
93  //Emitted when a new master image for setting the coordinate system has been
94  //selected.
95  void masterCoordinateChanged( QtDisplayData* oldMaster, QtDisplayData* newMaster );
96  void animateToImage( int index );
97  void createRGBImage( QtDisplayData* coordinateMaster, QtDisplayData* redImage, QtDisplayData* greenImage, QtDisplayData* blueImage );
98 
99  public slots:
100  //The ImageView has changed types (raster, contour, vector, etc)
101  void displayTypeChanged( ImageView* changedView );
102 
103 
104  private slots:
105  //Opens the display data options panel for the specific display data.
107 
108  //Apply the color changes the user has specified.
109  void applyColorChanges();
110  //User has changed the color method for combining multiple images (RGB,Hue/Saturation,etc)
112 
113  //Close/register/unregister
114  void closeAll();
115  void registerImages();
116  void unregisterImages();
117  void registrationChange( ImageView* imageView );
118  void closeImage( QtDisplayData* image, bool coordinateMaster );
119 
120  //A new image has been designated as the master image for setting the
121  //coordinate system.
122  void masterImageChanged( QtDisplayData* newMaster );
123 
124  //The user has reordered the images in the display.
125  void reorderDisplayImages( QtDisplayData* displayData, int dropIndex, bool registered,
126  bool masterCoordinate/*, bool masterSaturation, bool masterHue, QColor rgbColor*/ );
127 
128 
129  private:
130  ImageManagerDialog( const ImageManagerDialog& other );
132 
133  //Initialization
134  void initializeScrollArea();
135 
136  //Coloring
137  //Returns the transparency to use when combining images.
138  //float getTransparency() const;
139  //Get the min and max intensity of the image.
140  bool getIntensityMinMax( std::shared_ptr<casacore::ImageInterface<float> > img,
141  double* intensityMin, double* intensityMax );
142  //Generate a color map based on a single base color (RGB mode).
143  Colormap* generateColorMap( QColor baseColor);
144  //Helper method which generates a color definition based on a single color.
145  ColormapDefinition* generateSaturationMap( QColor baseColor );
146  //Attempts to set a master hue color map into all of the images. Used in
147  //hue/saturation mode.
148  bool applyMasterColor( QString& errorMessage );
149  //Worker method that remaps a baseMap with a baseIntensityMin and baseIntensityMap
150  //to a new color map definition with intensityMin and intensityMax. Used in
151  //hue/saturation mode.
153  double colorMin, double colorMax, double intensityMin, double intensityMax );
154  float getColorFraction( float value, double minValue, double maxValue );
156 
157  //Enable/disable the "all" buttons based on how many images are
158  //registered, unregistered, open.
159  void updateAllButtons();
160 
161  //Dialog containing display options for a particular display data.
163  //Holds the open images
164  std::shared_ptr<DisplayDataHolder> allImages;
165 
166  //Holds the registered images
167  std::shared_ptr<DisplayDataHolder> displayedImages;
168  Ui::ImageManagerDialogClass ui;
172  const int COLOR_MAP_SIZE;
173  };
174 
175 }
176 
177 #endif // IMAGEMANAGERDIALOG_QO_H
std::shared_ptr< DisplayDataHolder > displayedImages
Holds the registered images.
void updateAllButtons()
Enable/disable the &quot;all&quot; buttons based on how many images are registered, unregistered, open.
void ddOpened(const casacore::String &path, const casacore::String &dataType, const casacore::String &displayType, int insertionIndex, bool registered, bool masterCoordinate, bool masterSaturation, bool masterHue)
const casacore::String SINGLE_COLOR_MAP
Displays properties of an image for manipulation such as color and display type.
Definition: ImageView.qo.h:48
ImageView::ColorCombinationMode getColorCombinationMode() const
void masterImageSelected(QtDisplayData *image)
Image Tracker Interface Internally, a new master image has been selected.
Colormap * generateColorMap(QColor baseColor)
Generate a color map based on a single base color (RGB mode).
ImageManagerDialog operator=(const ImageManagerDialog &other)
Colormap * generateMasterDefinition(ColormapDefinition *baseMap, double colorMin, double colorMax, double intensityMin, double intensityMax)
Worker method that remaps a baseMap with a baseIntensityMin and baseIntensityMap to a new color map d...
ImageManagerDialog(QWidget *parent=0)
void unregisterDD(QtDisplayData *dd)
void displayTypeChanged(ImageView *changedView)
The ImageView has changed types (raster, contour, vector, etc)
void ddClosed(QtDisplayData *&dd)
void masterImageChanged(QtDisplayData *newMaster)
A new image has been designated as the master image for setting the coordinate system.
Allows users to manipulate the images loaded in the viewer.
ColormapDefinition * generateSaturationMap(QColor baseColor)
Helper method which generates a color definition based on a single color.
bool getIntensityMinMax(std::shared_ptr< casacore::ImageInterface< float > > img, double *intensityMin, double *intensityMax)
Coloring Returns the transparency to use when combining images.
void setImageHolders(std::shared_ptr< ImageManagerDialog > holder, std::shared_ptr< DisplayDataHolder > displayed, std::shared_ptr< DisplayDataHolder > allImages)
Sets the containers which are the sources for display data, both registered and open.
void registerDD(QtDisplayData *dd, int position)
void masterCoordinateChanged(QtDisplayData *oldMaster, QtDisplayData *newMaster)
Emitted when a new master image for setting the coordinate system has been selected.
void createRGBImage(QtDisplayData *coordinateMaster, QtDisplayData *redImage, QtDisplayData *greenImage, QtDisplayData *blueImage)
void closeImageView(QtDisplayData *image)
const casacore::String MASTER_COLOR_MAP
std::string path(const std::string &name)
void closeAll()
Close/register/unregister.
void setViewedImage(int registrationIndex)
Sets the image that is currently being viewed (on the Animator).
void closeImage(QtDisplayData *image, bool coordinateMaster)
Interface class designed to reduce the coupling between the GUI class, ImageManager and the DisplayDa...
Definition: ImageTracker.h:39
void animateToImage(int index)
Ui::ImageManagerDialogClass ui
void colorRestrictionsChanged()
User has changed the color method for combining multiple images (RGB,Hue/Saturation,etc)
void reorderDisplayImages(QtDisplayData *displayData, int dropIndex, bool registered, bool masterCoordinate)
The user has reordered the images in the display.
Opens up a dialog showing the display options that can be tweaked for a particular images...
std::shared_ptr< DisplayDataHolder > allImages
Holds the open images.
Describes a method of generating a table of colors.
Definition: Colormap.h:104
DisplayOptionsDialog * displayOptionsDialog
Dialog containing display options for a particular display data.
bool applyMasterColor(QString &errorMessage)
Attempts to set a master hue color map into all of the images.
void applyColorChanges()
Apply the color changes the user has specified.
float getColorFraction(float value, double minValue, double maxValue)
String: the storage and methods of handling collections of characters.
Definition: String.h:223
void registrationChange(ImageView *imageView)
void showDataDisplayOptions(QtDisplayData *)
Opens the display data options panel for the specific display data.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
Displays a list of images, allowing the user to reorder them.
void initializeScrollArea()
Initialization.
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42
void imageAdded(QtDisplayData *image, int position, bool autoRegister, bool masterCoordinate, bool masterSaturation, bool masterHue)
Adds an image to the manager when a new one is opened.