Profile2dDD.h

Classes

Profile2dDD -- A DisplayData to draw Profiles (full description)

class Profile2dDD : public ActiveCaching2dDD, public WCMotionEH, public WCPositionEH

Interface

Public Members
Profile2dDD()
Profile2dDD(LatticePADisplayData<Float>* dd)
virtual ~Profile2dDD()
virtual Bool attachDD(LatticePADisplayData<Float>* dd)
virtual void detachDD()
virtual Bool sizeControl(WorldCanvasHolder &wcHolder, AttributeBuffer &holderBuf)
virtual void getDrawData(Matrix<Double> &data, const Bool world=False)
virtual void getMaskData(Vector<Bool> &mask)
virtual void getProfileAsRecord(Record &rec)
virtual const Unit dataUnit()
virtual String showValue(const Vector<Double> &world)
virtual void operator()(const WCMotionEvent &ev)
virtual void operator()(const WCPositionEvent &ev)
virtual void handleEvent(DisplayEvent &ev)
virtual void sendDDModEvent()
virtual Bool labelAxes(const WCRefreshEvent &ev)
virtual void setDefaultOptions()
virtual Bool setOptions(Record &rec, Record &recOut)
virtual Record getOptions()
virtual Display::DisplayDataType classType()
virtual CachingDisplayMethod *newDisplayMethod(WorldCanvas *worldCanvas, AttributeBuffer *wchAttributes, AttributeBuffer *ddAttributes, CachingDisplayData *dd)
virtual AttributeBuffer optionsAsAttributes()
virtual void notifyUnregister(WorldCanvasHolder& wcHolder, Bool ignoreRefresh = False)
virtual const String profileColor() const
virtual const Float profileLineWidth() const
virtual const Display::LineStyle profileLineStyle()
virtual const Bool isRegionProfile() const
virtual void regionDimensions(Vector<Double> &regionBlc, Vector<Double> &regionTrc)
virtual const Double profileYMin() const
virtual const Double profileYMax() const
virtual const Double profileXMin() const
virtual const Double profileXMax() const
virtual const Bool profileAutoscale() const
virtual const Bool showRestFrequency() const
virtual const Double restFrequency() const
virtual const LatticeStatsBase::StatisticsTypes regionStatType() const
virtual const Int regionXRadius() const
virtual const Int regionYRadius() const
virtual const Int profileAxis()
Protected Members
Profile2dDD(const Profile2dDD &other)
void operator=(const Profile2dDD &other)
Private Members
Bool createCoordinateSystem()
Bool updateCoordinateSys(CoordinateSystem &cs)
Bool getRegionProfile(Vector<Double> &fpixelBlc, Vector<Double> &fpixelTrc)
Bool getPointProfile(const Vector<Double> &world)
Bool cropRegion(Vector<Double> &fpixelBlc, Vector<Double> &fpixelTrc)
virtual void constructParameters()
virtual void destructParameters()

Description

Review Status

Date Reviewed:
yyyy/mm/dd

Prerequisite

Etymology

Synopsis

This Display Data attaches to itself, another Display Data whos profile (at a point) is to be extracted and drawn. The Display Data attached to Profile2dDD must have atleast 3 world Axes and atleast 2 pixels on it's profile axis (3rd axis). An axis from a Linear Coordinate or Stokes Coordinate presently can not be on the profile axis. All other AIPS++ coordinate types are supported.

Profile2dDD is an implements WCMotionEH and WCPositionEH and listens to motion and position events generated by the attached Display Data. A motion event comes with a new world position on the attached Display Data. Profile2dDD uses this world position to extract and draw a profile on its world canvas. A Position event (key press) switches the profiling on and off. The default switch is the space bar.

Profile2dDD is a DisplayEH (all DisplayDatas are) and listens to DisplayEvents sent out by the attached DisplayData. This is so it can listen for Tool events such as Crosshair event.

Each time the profile is refreshed (with new data), Profile2dDD sends out a DDModEvent to all listening DisplayEHs, to indicate that the data has been modified.

Since Profile2dDD inherit's from ActiveCaching2dDD and uses WCCSNLAxisLabeller, all the options such as position tracking and axis labelling are available. Options specific to Profilng, such as profile color, line width, line style and autoscaling are also available.

Example

Motivation

Existing Glish implementation is too slow and limited.

To Do

Member Description

Profile2dDD()

(Required) default constructor.

Profile2dDD(LatticePADisplayData<Float>* dd)

Constructor taking a pointer to an already constructed ImageInterface.The Display Data dd must have atleast 3 World Axes and atleast 2 elements in the profile (3rd) world axis.

virtual ~Profile2dDD()

Destructor.

virtual void detachDD()

Detach the currently attached Display Data.

virtual Bool attachDD(LatticePADisplayData<Float>* dd)

virtual Bool sizeControl(WorldCanvasHolder &wcHolder, AttributeBuffer &holderBuf)

Overloading ActiveCaching2dDD::sizeControl. Zooming is modified for autoscaling feature.

virtual void getDrawData(Matrix<Double> &data, const Bool world=False)

Store the data to be drawn in the data Matrix. If world is false, pixel coordinates are used. If world is true, then world coordinates are used.

virtual void getMaskData(Vector<Bool> &mask)

Store the mask in mask vector

virtual void getProfileAsRecord(Record &rec)

Store the details of the current profile in rec Record structure similar to position event structure.

virtual const Unit dataUnit()

Return the data unit.

virtual String showValue(const Vector<Double> &world)

Returns an empty string.

virtual void operator()(const WCMotionEvent &ev)

Motion Event Handler

virtual void operator()(const WCPositionEvent &ev)

Position Event Handler

virtual void handleEvent(DisplayEvent &ev)

Display Event Handler

virtual void sendDDModEvent()

Send out DDModEvents to all DisplayEHs listening

virtual Bool labelAxes(const WCRefreshEvent &ev)

Draws and labels the axes based on the refresh event

virtual void setDefaultOptions()

Install the default options for this DisplayData.

virtual Bool setOptions(Record &rec, Record &recOut)

Apply options stored in rec to the DisplayData. A return value of True means a refresh is needed. recOut contains any fields which were implicitly changed as a result of the call to this function.

virtual Record getOptions()

Retrieve the current and default options and parameter types.

virtual Display::DisplayDataType classType()

Return the type of this DisplayData.

virtual CachingDisplayMethod *newDisplayMethod(WorldCanvas *worldCanvas, AttributeBuffer *wchAttributes, AttributeBuffer *ddAttributes, CachingDisplayData *dd)

Create a new CachingDisplayMethod for drawing on the given WorldCanvas when the AttributeBuffers are suitably matched to the current state of this DisplayData and of the WorldCanvas/Holder. The tag is a unique number used to identify the age of the newly constructed CachingDisplayMethod.

virtual AttributeBuffer optionsAsAttributes()

Return the current options of this DisplayData as an AttributeBuffer.

virtual void notifyUnregister(WorldCanvasHolder& wcHolder, Bool ignoreRefresh = False)

Take actions on removal from WC[H] (notably, deletion of drawlists).

virtual const String profileColor() const

Return Profile Color

virtual const Float profileLineWidth() const

Return Profile Line Width

virtual const Display::LineStyle profileLineStyle()

Return Profile LineStyle

virtual const Bool isRegionProfile() const

Return True if the last requested profile was for a region. Return False if the last requested profile was for a single point

virtual void regionDimensions(Vector<Double> &regionBlc, Vector<Double> &regionTrc)

get the region dimensions, in pixels, of the last region submitted to Profile2dDD.

virtual const Double profileYMin() const

Return Minimum Y value

virtual const Double profileYMax() const

Return Maximum Y value

virtual const Double profileXMin() const

Return Minimum X value

virtual const Double profileXMax() const

Return Maximum X value

virtual const Bool profileAutoscale() const

Return the autoscale status (On or Off)

virtual const Bool showRestFrequency() const

Return the rest frequency display status (to draw or not to draw)

virtual const Double restFrequency() const

Return rest frequency.

virtual const LatticeStatsBase::StatisticsTypes regionStatType() const

Return the statistics used for region calculations.

virtual const Int regionXRadius() const

Return the x value added to the pixel at a pixel position to create a region

virtual const Int regionYRadius() const

Return the y value added to the pixel at a pixel position to create a region

virtual const Int profileAxis()

Return the profile axis number (from the original image)

Profile2dDD(const Profile2dDD &other)

(Required) copy constructor.

void operator=(const Profile2dDD &other)

(Required) copy assignment.

Bool createCoordinateSystem()

Helper function. Initialise Profile2dDD with a CoordinateSystem put together from the parent DD

Bool updateCoordinateSys(CoordinateSystem &cs)

Update the coordinate system of this Display Data and the axis labeller. Set new minimum and maximum Y values if necessary

Bool getRegionProfile(Vector<Double> &fpixelBlc, Vector<Double> &fpixelTrc)

Extract the profile data from the provided pixel region and place it into itsData. The statistics used is determined by the options. Return True if new profile data has been extracted (i.e. a refresh is needed) otherwise return False

Bool getPointProfile(const Vector<Double> &world)

Extract the profile data from the provided world position and place it into itsData. Also extract the Mask data (if it exists) and place it into itsMask. Return True if new profile data has been extracted (i.e. a refresh is needed) otherwise return False

Bool cropRegion(Vector<Double> &fpixelBlc, Vector<Double> &fpixelTrc)

Crop the region so that it does not define areas outside the data. Returns False if the entire region is outside image data

virtual void constructParameters()

Construct the parameters for getOptions and setOptions

virtual void destructParameters()

Delete the parameters for getOptions() and setOptions()