casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SlicePlot.qo.h
Go to the documentation of this file.
1 //# Copyright (C) 1994,1995,1996,1997,1998,1999,2000
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 
26 #ifndef SLICEPLOT_H_
27 #define SLICEPLOT_H_
28 
29 #include <qwt_plot.h>
30 #include <QMap>
31 #include <casa/Arrays/Vector.h>
35 
36 class QwtPlotCurve;
37 
38 
39 namespace casa {
40 
41  class SlicePlot : public QwtPlot {
42 
43  Q_OBJECT
44 
45  public:
46  SlicePlot(QWidget *parent = NULL, bool fullVersion = false );
47 
48  //Data
49  void setImage( std::shared_ptr<casacore::ImageInterface<float> > img );
50  void updateChannel( int channel );
51  bool setRegionSelected( int regionId, bool selected );
52 
53  //Look and feel
55  QList<QColor> accumulateCurveColors);
56  void setViewerCurveColor( int regionId, const QString& colorName );
57  void setUseViewerColors( bool viewerColors );
58  void setPlotPreferences( int lineWidth, int markerSize );
59 
60  //Setting slice parameters.
61  void setSampleCount( int sampleCount );
62  void setInterpolationMethod( const casacore::String& method );
63  void setAccumulateSlices( bool accumulate );
64 
65  //Wipe out only the curves that shouldn't be displayed under
66  //the current settings.
67  void clearCurves();
68  //Wipe out all curves.
69  void clearCurvesAll();
70  bool toAscii( const QString& fileName );
71 
72  //Statistics
73  void addStatistic( int regionId );
74  void removeStatistics( );
75  void removeStatistic( int regionId);
76  void setStatisticsLayout( QLayout* layout );
77  void updatePositionInformation( int id, const QVector<casacore::String>& info );
78  void markPositionChanged(int regionId,int segmentIndex,float percentage);
79  void markVisibilityChanged(int regionId,bool showMarker);
80  bool isFullVersion() const;
81 
82  virtual ~SlicePlot();
83 
84  const static QString DISTANCE_AXIS;
85  const static QString POSITION_X_AXIS;
86  const static QString POSITION_Y_AXIS;
87  const static QString UNIT_X_PIXEL;
88  const static QString UNIT_X_ARCSEC;
89  const static QString UNIT_X_ARCMIN;
90  const static QString UNIT_X_ARCDEG;
91 
92  signals:
93  void markerPositionChanged(int regionId,int segmentIndex,float percentage);
94  void markerVisibilityChanged(int regionId,bool showMarker);
95 
96  public slots:
97  void updatePolyLine( int regionId,viewer::region::RegionChanges regionChanges,
98  const QList<double> & linearX, const QList<double> & linearY,
99  const QList<int> &pixelX, const QList<int> & pixelY);
100  void setXAxis( const QString& newAxis );
101  void xAxisUnitsChanged( const QString& units );
102  void segmentMarkerVisibilityChanged( bool visible );
103 
104  private:
105  SlicePlot( const SlicePlot& other );
106  SlicePlot operator=(const SlicePlot& other );
107  ImageSlice* getSlicerFor( int regionId );
110  void initPlot();
111  void resetCurves();
112  void addPlotCurve( int regionId );
113  void initAxisFont( int axisId, const QString& axisTitle );
114  void sliceFinished( int regionId);
115  QString getAxisLabel() const;
116  void updateSelectedRegionId( int selectedRegionId );
117  void updatePolyLine( int regionId, const QList<double>& worldX,
118  const QList<double>& worldY, const QList<int>& pixelX,
119  const QList<int>& pixelY);
120  void deletePolyLine( int regionId );
121 
122  int getColorIndex( int regionId ) const;
123  int assignCurveColors( int initialColorIndex, int regionId );
125 
126  QList<QColor> curveColors;
127  std::shared_ptr<casacore::ImageInterface<float> > image;
128 
129  QMap<int, ImageSlice*> sliceMap;
130 
141  const int AXIS_FONT_SIZE;
143  QString xAxis;
144  QString xAxisUnits;
146  QLayout* statLayout;
148  };
149 
150 } // end namespace casa
151 
152 #endif /* SLICEPLOT_H_ */
void clearCurves()
Wipe out only the curves that shouldn&#39;t be displayed under the current settings.
void setViewerCurveColor(int regionId, const QString &colorName)
void setStatisticsLayout(QLayout *layout)
const int AXIS_FONT_SIZE
Definition: SlicePlot.qo.h:141
static const QString DISTANCE_AXIS
Definition: SlicePlot.qo.h:84
void updatePolyLine(int regionId, viewer::region::RegionChanges regionChanges, const QList< double > &linearX, const QList< double > &linearY, const QList< int > &pixelX, const QList< int > &pixelY)
void setInterpolationMethod(const casacore::String &method)
void xAxisUnitsChanged(const QString &units)
SliceStatisticsFactory * factory
Definition: SlicePlot.qo.h:147
void markPositionChanged(int regionId, int segmentIndex, float percentage)
QString getAxisLabel() const
static const QString UNIT_X_ARCSEC
Definition: SlicePlot.qo.h:88
static const QString UNIT_X_ARCDEG
Definition: SlicePlot.qo.h:90
static const QString UNIT_X_PIXEL
Definition: SlicePlot.qo.h:87
void resetExistingCurveColors()
static const QString UNIT_X_ARCMIN
Definition: SlicePlot.qo.h:89
QList< QColor > curveColors
Definition: SlicePlot.qo.h:126
QMap< int, ImageSlice * > sliceMap
Definition: SlicePlot.qo.h:129
virtual ~SlicePlot()
void setSampleCount(int sampleCount)
Setting slice parameters.
void setImage(std::shared_ptr< casacore::ImageInterface< float > > img)
Data.
void updateSelectedRegionId(int selectedRegionId)
static const QString POSITION_X_AXIS
Definition: SlicePlot.qo.h:85
void addPlotCurve(int regionId)
void setPlotPreferences(int lineWidth, int markerSize)
casacore::Vector< int > axes
Definition: SlicePlot.qo.h:145
Specialization for Quantum&lt;Vector&lt;T&gt; &gt;
Definition: QVector.h:37
QLayout * statLayout
Definition: SlicePlot.qo.h:146
void removeStatistics()
void clearCurvesAll()
Wipe out all curves.
int getColorIndex(int regionId) const
void sliceFinished(int regionId)
void markerVisibilityChanged(int regionId, bool showMarker)
casacore::String interpolationMethod
Definition: SlicePlot.qo.h:142
QString xAxisUnits
Definition: SlicePlot.qo.h:144
SlicePlot(QWidget *parent=NULL, bool fullVersion=false)
void deletePolyLine(int regionId)
std::shared_ptr< casacore::ImageInterface< float > > image
Definition: SlicePlot.qo.h:127
void resetCurveColors(bool viewerColors, bool polylineColorUnit, QList< QColor > accumulateCurveColors)
Look and feel.
Represents a slice cut of an image.
Definition: ImageSlice.qo.h:57
bool toAscii(const QString &fileName)
ImageSlice * getSlicerFor(int regionId)
SlicePlot operator=(const SlicePlot &other)
void markVisibilityChanged(int regionId, bool showMarker)
void addStatistic(int regionId)
Statistics.
void updateChannel(int channel)
void segmentMarkerVisibilityChanged(bool visible)
void setXAxis(const QString &newAxis)
void removeStatistic(int regionId)
bool setRegionSelected(int regionId, bool selected)
void setAccumulateSlices(bool accumulate)
void updatePositionInformation(int id, const QVector< casacore::String > &info)
void initAxisFont(int axisId, const QString &axisTitle)
void markerPositionChanged(int regionId, int segmentIndex, float percentage)
SliceStatisticsFactory::AxisXUnits getUnitMode() const
int assignCurveColors(int initialColorIndex, int regionId)
void setUseViewerColors(bool viewerColors)
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::Vector< int > coords
Definition: SlicePlot.qo.h:131
GRID LAYOUT CLASSES casacore::Coordinate for a grid layout
static const QString POSITION_Y_AXIS
Definition: SlicePlot.qo.h:86
SliceStatisticsFactory::AxisXChoice getXAxis() const
Returns SliceStatistics appropriate to what is displayed on the x-axis and the units being used...
bool isFullVersion() const