SlicePlot.qo.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef SLICEPLOT_H_
00027 #define SLICEPLOT_H_
00028
00029 #include <qwt_plot.h>
00030 #include <QMap>
00031 #include <casa/Arrays/Vector.h>
00032 #include <display/region/RegionEnums.h>
00033 #include <display/Slicer/ImageSlice.qo.h>
00034
00035 class QwtPlotCurve;
00036
00037
00038 namespace casa {
00039
00040 template <class T> class ImageInterface;
00041 class ImageAnalysis;
00042
00043 class SlicePlot : public QwtPlot {
00044
00045 Q_OBJECT
00046
00047 public:
00048 SlicePlot(QWidget *parent = NULL, bool fullVersion = false );
00049
00050
00051 void setImage( SHARED_PTR<ImageInterface<float> > img );
00052 void updateChannel( int channel );
00053 bool setRegionSelected( int regionId, bool selected );
00054
00055
00056 void resetCurveColors( bool viewerColors, bool polylineColorUnit,
00057 QList<QColor> accumulateCurveColors);
00058 void setViewerCurveColor( int regionId, const QString& colorName );
00059 void setUseViewerColors( bool viewerColors );
00060 void setPlotPreferences( int lineWidth, int markerSize );
00061
00062
00063 void setSampleCount( int sampleCount );
00064 void setInterpolationMethod( const String& method );
00065 void setAccumulateSlices( bool accumulate );
00066
00067
00068
00069 void clearCurves();
00070
00071 void clearCurvesAll();
00072 bool toAscii( const QString& fileName );
00073
00074
00075 void addStatistic( int regionId );
00076 void removeStatistics( );
00077 void removeStatistic( int regionId);
00078 void setStatisticsLayout( QLayout* layout );
00079 void updatePositionInformation( int id, const QVector<String>& info );
00080 void markPositionChanged(int regionId,int segmentIndex,float percentage);
00081 void markVisibilityChanged(int regionId,bool showMarker);
00082 bool isFullVersion() const;
00083
00084 virtual ~SlicePlot();
00085
00086 const static QString DISTANCE_AXIS;
00087 const static QString POSITION_X_AXIS;
00088 const static QString POSITION_Y_AXIS;
00089 const static QString UNIT_X_PIXEL;
00090 const static QString UNIT_X_ARCSEC;
00091 const static QString UNIT_X_ARCMIN;
00092 const static QString UNIT_X_ARCDEG;
00093
00094 signals:
00095 void markerPositionChanged(int regionId,int segmentIndex,float percentage);
00096 void markerVisibilityChanged(int regionId,bool showMarker);
00097
00098 public slots:
00099 void updatePolyLine( int regionId,viewer::region::RegionChanges regionChanges,
00100 const QList<double> & linearX, const QList<double> & linearY,
00101 const QList<int> &pixelX, const QList<int> & pixelY);
00102 void setXAxis( const QString& newAxis );
00103 void xAxisUnitsChanged( const QString& units );
00104 void segmentMarkerVisibilityChanged( bool visible );
00105
00106 private:
00107 SlicePlot( const SlicePlot& other );
00108 SlicePlot operator=(const SlicePlot& other );
00109 ImageSlice* getSlicerFor( int regionId );
00110 SliceStatisticsFactory::AxisXUnits getUnitMode() const;
00111 SliceStatisticsFactory::AxisXChoice getXAxis() const;
00112 void initPlot();
00113 void resetCurves();
00114 void addPlotCurve( int regionId );
00115 void initAxisFont( int axisId, const QString& axisTitle );
00116 void sliceFinished( int regionId);
00117 QString getAxisLabel() const;
00118 void updateSelectedRegionId( int selectedRegionId );
00119 void updatePolyLine( int regionId, const QList<double>& worldX,
00120 const QList<double>& worldY, const QList<int>& pixelX,
00121 const QList<int>& pixelY);
00122 void deletePolyLine( int regionId );
00123
00124 int getColorIndex( int regionId ) const;
00125 int assignCurveColors( int initialColorIndex, int regionId );
00126 void resetExistingCurveColors();
00127
00128 QList<QColor> curveColors;
00129 SHARED_PTR<ImageInterface<float> > image;
00130 ImageAnalysis* imageAnalysis;
00131 QMap<int, ImageSlice*> sliceMap;
00132
00133 Vector<Int> coords;
00134 int curveWidth;
00135 int markerSize;
00136 bool accumulateSlices;
00137 bool fullVersion;
00138 bool viewerColors;
00139 bool polylineColorUnit;
00140 bool segmentMarkers;
00141 int sampleCount;
00142 int currentRegionId;
00143 const int AXIS_FONT_SIZE;
00144 String interpolationMethod;
00145 QString xAxis;
00146 QString xAxisUnits;
00147 Vector<Int> axes;
00148 QLayout* statLayout;
00149 SliceStatisticsFactory* factory;
00150 };
00151
00152 }
00153 #endif