59 #include <QMainWindow>
60 #include <QMouseEvent>
61 #include <QToolButton>
70 #include <QHashIterator>
72 #include <display/QtPlotter/QtProfileGUI.ui.h>
75 Q_INIT_RESOURCE(QtPlotter);
82 class ColorSummaryWidget;
83 class LegendPreferences;
84 class SmoothPreferences;
126 QWidget *parent = 0, std::string rcstr=
"prf");
131 virtual std::string
rcid( )
const {
159 std::shared_ptr<const casacore::ImageInterface<float> >
getImage(
const QString& imageName=
"")
const;
160 virtual bool getBeamInfo(
const QString& curveName,
double& beamAngle,
double& beamArea )
const;
162 void persist(
const QString& key,
const QString&
value );
163 QString
read(
const QString & key )
const;
166 void setPosition(
const QList<double>& xValues,
const QList<double>& yValues );
170 typedef std::pair<QString, std::shared_ptr<casacore::ImageInterface<float> > >
OverplotInterface;
189 static QString result(
"frequency");
193 static QString result(
"channel");
212 void setPreferences(
bool stateAutoX,
bool stateAutoY,
int showGrid,
214 bool displayStepFunction,
bool opticalFitter,
215 bool showChannelLine,
bool singleChannelImage );
244 void overplot(QList<OverplotInterface>);
247 const QList<double> &world_x,
const QList<double> &world_y,
248 const QList<int> &pixel_x,
const QList<int> &pixel_y,
249 const QString &linecolor,
const QString &text,
const QString &font,
int fontsize,
int fontstyle );
252 const QList<double> &world_x,
const QList<double> &world_y,
253 const QList<int> &pixel_x,
const QList<int> &pixel_y );
268 void adjustPosition(
double tlcx,
double tlcy,
double brcx,
double brcy );
283 void outputCurve(
int k, QTextStream& ts,
float scaleFactor );
305 const QString& yUnitsOld,
const QString& yUnitsNew );
344 const QString& label,
double beamAngle,
double beamArea,
356 QString
getRaDec(
double x,
double y);
363 std::shared_ptr<casacore::ImageInterface<float> >
image;
372 void restrictTopAxisOptions(
bool restrictOptions,
const QString& bottomUnits,
bool allowFrequency =
true,
373 bool allowVelocity=
true );
393 QList<OverplotInterface> *
over;
449 static QString result(
"Flux Density");
453 static QString result(
"Mean");
457 static QString result(
"Median");
461 static QString result(
"Sum");
466 static QString result(
"velocity");
470 static QString result(
"optical");
473 static const QString &
AIR( ) {
474 static QString result(
"air");
478 static QString result(
"REST");
482 static QString result(
"Undefined");
486 static QString result(
".freqcoord.type");
490 static QString result(
".freqcoordTop.type");
494 static QString result(
"No profile available for the given data.");
498 static QString result(
"Assign a mouse button to\n"
499 "'crosshair' or 'rectangle' or 'polygon';\n"
500 "click/press+drag the assigned button on\n"
501 "the image to get a spectral profile.");
505 static QString result(
"No profile available for the "
506 "display axes orientation");
510 static QString result(
"Ellipse");
514 static QString result(
"Rectangle");
518 static QString result(
"Point");
522 static QString result(
"Polygon");
void getPixelBounds(casacore::Vector< double > &pixelX, casacore::Vector< double > &pixelY) const
void channelRangeSelect(float channelStart, float channelEnd)
void setPreferences(bool stateAutoX, bool stateAutoY, int showGrid, int stateMProf, int stateRel, bool showToolTips, bool showTopAxis, bool displayStepFunction, bool opticalFitter, bool showChannelLine, bool singleChannelImage)
bool exportASCIISpectrum(QString &fn)
void imageCollapsed(casacore::String path, casacore::String dataType, casacore::String displayType, bool autoRegister, bool tmpData, std::shared_ptr< casacore::ImageInterface< float > > img)
void setTitle(const QString &shape)
casacore::Vector< double > last_event_wx
void coordinateChange(const casacore::String &)
void setUnitsText(casacore::String unitStr)
void changeCoordinate(const QString &text)
spectra_info(const spectra_info &other)
void stringToPlotType(const QString &text, QtProfile::PlotType &pType)
the square root of the sum divided by the number of pixels per beam, sqrt(sum)/(beam_area/pixel_area)...
virtual std::string rcid() const
const spectra_info & operator=(const spectra_info &other)
void postConversionWarning(QString unitStr)
void resetXUnits(bool spectralAxis)
void changeAxis(casacore::String xa, casacore::String ya, casacore::String za, std::vector< int >)
QtProfilePrefs * profilePrefs
void initializeSolidAngle() const
void showCollapsedImg(casacore::String path, casacore::String dataType, casacore::String displayType, bool autoRegister, bool tmpData, std::shared_ptr< casacore::ImageInterface< float > > img)
casacore::Vector< float > getXValues() const
std::string rcid_
rc id for this panel type
QtProfile::ErrorType itsErrorType
void changeCoordinateType(const QString &text)
bool isSpectralAxis() const
casacore::Vector< float > z_yval
QString readTopAxis() const
void initializeSpectralProperties()
bool isFrequencyUnit(const QString &unit) const
casacore::Vector< double > lastPX
void restrictTopAxisOptions(bool restrictOptions, const QString &bottomUnits, bool allowFrequency=true, bool allowVelocity=true)
static const QString & PERSIST_FREQUENCY_TOP()
casacore::MFrequency::Types determineRefFrame(std::shared_ptr< casacore::ImageInterface< float > > img, bool check_native_frame=false)
void setPurpose(ProfileTaskMonitor::PURPOSE purpose)
Allows the profiler to come up specialized to do spectroscopy or another task.
casacore::String coordinateType_p
void setPlotType(int wcArraySize)
void persistTopAxis(const QString &units)
casacore::Vector< double > last_event_px
static const casacore::String & SHAPE_ELLIPSE()
std::shared_ptr< const casacore::ImageInterface< float > > getImage(const QString &imageName="") const
casacore::Vector< float > getYValues() const
void addOverplotToCanvas(std::shared_ptr< casacore::ImageInterface< float > > imagePtr, const casacore::Vector< float > &xVals, const casacore::Vector< float > &yVals, const QString &ky)
static const QString & NO_PROFILE_ERROR()
void togglePalette(int modeIndex)
static const QString & REGION_POINT()
QString read(const QString &key) const
QList< OverplotInterface > * over
spectra_info(const QString &s)
casacore::Vector< float > z_xval
SpectraInfoMap spectra_info_map
casacore::String coordinate
void setYUnitConversionVisibility(bool visible)
void showSmoothingPreferences()
std::map< int, spectra_info > SpectraInfoMap
static const casacore::String & SHAPE_RECTANGLE()
void updateXAxisLabel(const QString &text, QtPlotSettings::AxisIndex axisIndex)
ostream-like interface to creating log messages.
static const casacore::String & SHAPE_POLY()
casacore::Vector< double > lastWX
const casacore::String WORLD_COORDINATES
void updateSpectralReferenceFrame()
casacore::String getXAxisUnit() const
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the if a human readable name(i.e."black").In many places throughout the plotter
void messageFromProfile(QString &msg)
void channelSelect(int channelIndex)
static const QString & AIR()
void storeCoordinates(const casacore::Vector< double > pxv, const casacore::Vector< double > pyv, const casacore::Vector< double > wxv, const casacore::Vector< double > wyv)
void stringToErrorType(const QString &text, QtProfile::ErrorType &eType)
void setCollapseRange(double xmin, double xmax)
QStringList xUnitsList
Holds the available x-axis units.
void setPath(QString filePath)
void setDisplayYUnits(const QString &unitStr)
void postStatus(casacore::String status)
These methods are from the ProfileTaskMoniter interface.
static const casacore::String & SHAPE_POINT()
virtual bool getBeamInfo(const QString &curveName, double &beamAngle, double &beamArea) const
bool showSingleChannelImage
bool generateProfile(casacore::Vector< float > &resultXValues, casacore::Vector< float > &resultYValues, std::shared_ptr< casacore::ImageInterface< float > > imagePtr, const casacore::Vector< double > ®ionX, const casacore::Vector< double > ®ionY, casacore::String shape, QtProfile::ExtrType combineType, casacore::String &unit, const casacore::String &coordinateType, int qualityAxis, casacore::String restFreq="", const casacore::String &frame="")
casacore::Vector< double > lastWY
virtual void closeEvent(QCloseEvent *)
bool assignFrequencyProfile(const casacore::Vector< double > &wxv, const casacore::Vector< double > &wyv, const casacore::String &coordinateType, casacore::String &xAxisUnit, casacore::Vector< float > &z_xval, casacore::Vector< float > &z_yval, const casacore::String &shape)
static const QString & FREQUENCY()
void fillPlotTypes(const std::shared_ptr< casacore::ImageInterface< float > > img)
casacore::SpectralCoordinate resetTabularConversion(std::shared_ptr< const casacore::ImageInterface< float > > imagePtr, bool &valid)
void addCanvasMainCurve(const casacore::Vector< float > &xVals, const casacore::Vector< float > &yVals, const QString &label, double beamAngle, double beamArea, casacore::SpectralCoordinate coord)
bool customizeSpectralReferenceFrame(const QString &specialType)
Handle custom spectral reference frames such as REST and Undefined for which conversions are not poss...
void overplot(QList< OverplotInterface >)
static const QString & CHANNEL()
void updateAxisUnitCombo(const QString &textToMatch, QComboBox *axisUnitCombo)
casacore::Vector< double > last_event_py
static const QString & PLOT_TYPE_SUM()
casacore::Casarc & rc
connection to rc file
bool isAxisAscending(const casacore::Vector< float > &axisValues) const
Returns false if first vector value is greater than the last vector value; otherwise returns true...
bool adjustTopAxisSettings()
bool exportFITSSpectrum(QString &fn)
SQRTSUM and MEANSQRT are bizarre statistics, but ImageAnalysis::getFreqProfile() supported this for t...
void assignCoordinate(const casacore::String &c)
casacore::String cSysRval
Rest frequency quantity and unit.
static const QString & VELOCITY()
SmoothPreferences * smoothWidget
int getFreqProfileTabularIndex(std::shared_ptr< const casacore::ImageInterface< float > > img)
bool isVelocityUnit(const QString &unit) const
casacore::SpectralCoordinate getSpectralAxis(std::shared_ptr< const casacore::ImageInterface< float > > imagePtr, bool &valid)
casacore::Vector< double > lastPY
QString getYUnitPrefix() const
void pixelsChanged(int, int)
the square root of the sum divided by the number of pixels, sqrt(sum)/npix
void changeSpectrum(casacore::String spcTypeUnit, casacore::String spcRval, casacore::String spcSys)
casacore::String lastShape
std::string path(const std::string &name)
QString getRaDec(double x, double y)
Conversion.
casacore::String getRegionShape() const
void setPosition(const QList< double > &xValues, const QList< double > &yValues)
Specific to Spectrum Position setting.
double getUnitsPerChannel(std::shared_ptr< casacore::ImageInterface< float > > img, bool *ok, const QString &matchUnits)
void processTrackRecord(const casacore::String &dataName, const casacore::String &positionInfo)
bool isImageSupported(std::shared_ptr< casacore::ImageInterface< float > > img)
Returns whether or not the image can be profiled.
ColorSummaryWidget * colorSummaryWidget
pair< double, double > getMaximumTemperature()
static const QString & IMAGE_MISSING_ERROR()
bool isXUnitsMatch(const QString &matchUnits)
For deciding whether or not it makes sense to show the top axis when multiple images are loaded...
static const QString & PLOT_TYPE_MEAN()
void persist(const QString &key, const QString &value)
Specific to Moments.
void curveColorPreferences()
void initializeCoordinateVectors(const casacore::Vector< double > &px, const casacore::Vector< double > &py, const casacore::Vector< double > &wx, const casacore::Vector< double > &wy, casacore::Vector< double > &pxv, casacore::Vector< double > &pyv, casacore::Vector< double > &wxv, casacore::Vector< double > &wyv) const
static const QString & OPTICAL()
void resetProfile(std::shared_ptr< casacore::ImageInterface< float > > img, const char *name=0)
pair< casacore::Vector< float >, casacore::Vector< float > > convertIntensity(const casacore::Vector< float > &sourceXVals, const casacore::Vector< float > &sourceYVals, std::shared_ptr< casacore::ImageInterface< float > > imagePtr, const QString &xUnits, const QString &yUnitsOld, const QString &yUnitsNew)
casacore::Vector< double > getRegionYValues() const
Note: The purpose of the SpecFitMonitor interface is to provide a communications interface between th...
bool setErrorPlotting(const casacore::Vector< double > &wxv, const casacore::Vector< double > &wyv)
TableExprNode shape(const TableExprNode &array)
Function operating on any scalar or array resulting in a Double array containing the shape...
casacore::Vector< double > last_event_wy
void wcChanged(const casacore::String, const casacore::Vector< double >, const casacore::Vector< double >, const casacore::Vector< double >, const casacore::Vector< double >, const ProfileType)
int findNearestChannel(float xval) const
Finds the channel index closest to the passed in value.
bool _generateProfile(casacore::Vector< float > &resultXValues, casacore::Vector< float > &resultYValues, std::shared_ptr< const casacore::ImageInterface< float > > imagePtr, const casacore::Vector< double > ®ionX, const casacore::Vector< double > ®ionY, casacore::String shape, QtProfile::ExtrType combineType, casacore::String &unit, const casacore::String &coordinateType, casacore::String restFreq, const casacore::String &frame)
Interconvert pixel and frequency values.
void setPixelCanvasYUnits(const QString &yUnitPrefix, const QString &yUnit)
static const QString & FRAME_REST()
casacore::String last_event_cs
void changePlotType(const QString &text)
LegendPreferences * legendPreferencesDialog
static const QString & PLOT_TYPE_FLUX()
void initPlotterResource()
void outputCurve(int k, QTextStream &ts, float scaleFactor)
QString getImagePath() const
bool isProfileChanged(const casacore::String &c, const casacore::Vector< double > &px, const casacore::Vector< double > &py, const casacore::Vector< double > &wx, const casacore::Vector< double > &wy, const ProfileType pType)
static const QString & REGION_RECTANGLE()
static bool topAxisDefaultSet
static const QString & PLOT_TYPE_MEDIAN()
QString getFileName() const
void changeTopAxisCoordinateType(const QString &text)
casacore::Vector< float > getZValues() const
void setPositionStatus(const casacore::Vector< double > &pxv, const casacore::Vector< double > &pyv, const casacore::Vector< double > &wxv, const casacore::Vector< double > &wyv)
std::pair< QString, std::shared_ptr< casacore::ImageInterface< float > > > OverplotInterface
std::shared_ptr< casacore::ImageInterface< float > > image
const Double c
Fundamental physical constants (SI units):
casacore::Vector< float > z_eval
QString getBrightnessUnit(std::shared_ptr< casacore::ImageInterface< float > > img) const
String: the storage and methods of handling collections of characters.
void addImageAnalysisGraph(const casacore::Vector< double > &wxv, const casacore::Vector< double > &wyv, int ordersOfM)
void changeFrame(const QString &text)
void updateRegion(int, viewer::region::RegionChanges, const QList< double > &world_x, const QList< double > &world_y, const QList< int > &pixel_x, const QList< int > &pixel_y)
casacore::String spcRefFrame
void initializeXAxisUnits()
virtual casacore::MFrequency::Types getReferenceFrame() const
void saveAsPDF(const QString &fileName)
casacore::String ctypeUnit
void changeErrorType(const QString &text)
casacore::Vector< double > getRegionXValues() const
static const QString & PERSIST_FREQUENCY_BOTTOM()
Types
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
void assignProfileType(const casacore::String &shape, int regionPointCount)
int getChannelCount(std::shared_ptr< casacore::ImageInterface< float > > &img)
casacore::SpectralCoordinate getSpectralCoordinate(std::shared_ptr< const casacore::ImageInterface< float > > imagePtr, bool &valid)
bool isWavelengthUnit(const QString &unit) const
Allows the user to customize properties of the spectral profile legend.
void movieChannel(int startChannel, int endChannel)
QtProfile::PlotType itsPlotType
void adjustPosition(double tlcx, double tlcy, double brcx, double brcy)
void copyToLastEvent(const casacore::String &c, const casacore::Vector< double > &px, const casacore::Vector< double > &py, const casacore::Vector< double > &wx, const casacore::Vector< double > &wy)
void resetYUnits(const QString &units)
void toggleAction(QAction *action)
QtProfile(std::shared_ptr< casacore::ImageInterface< float > > img, const char *name=0, QWidget *parent=0, std::string rcstr="prf")
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
std::shared_ptr< casacore::ImageInterface< float > > findImageWithMaximumChannels()
static const QString & MISSING_REGION_ERROR()
casacore::String xaxisUnit
static const QString & REGION_POLY()
static const QString & FRAME_NONE()
void newRegion(int, const QString &shape, const QString &name, const QList< double > &world_x, const QList< double > &world_y, const QList< int > &pixel_x, const QList< int > &pixel_y, const QString &linecolor, const QString &text, const QString &font, int fontsize, int fontstyle)
int computeCB(const casacore::String &xa, const casacore::String &ya, const casacore::String &za)
bool parseRestFrequency(const casacore::String &restStr, casacore::Quantity &result) const
void getcoordTypeUnit(casacore::String &ctypeUnitStr, casacore::String &cTypeStr, casacore::String &unitStr)
static const QString & REGION_ELLIPSE()