LineProfileTool Class Reference

Plot tool for calculating intensity profiles of image markers along a line. More...

`#include <LineProfileTool.h>`

Inheritance diagram for LineProfileTool:

## Signals

void | statusText (const QString &)

## Public Member Functions

void | calculateLineProfile (const QPoint &start, const QPoint &end)
| LineProfileTool (Graph *graph, ApplicationWindow *app, int average_pixels)
| Standard constructor. More...
virtual int | rtti () const
Public Member Functions inherited from PlotToolInterface
| PlotToolInterface (Graph *graph, const QObject *status_target=NULL, const char *status_slot="")
virtual | ~PlotToolInterface ()

## Protected Member Functions

double | averageImagePixel (const QImage &image, int px, int py, bool moreHorizontal)
virtual void | mouseMoveEvent (QMouseEvent *e)
| Mouse movements need to be monitored for updating the line during operation. More...
virtual void | mousePressEvent (QMouseEvent *e)
| Pressing the left mouse button starts line selection. More...
virtual void | mouseReleaseEvent (QMouseEvent *e)
| Mouse releases end line selection and cause the profile to be displayed. More...
virtual void | paintEvent (QPaintEvent *e)
| Draw line during operation. More...

## Private Attributes

ApplicationWindow * | d_app
int | d_average_pixels
| Number of image pixels over which to average. More...
QPoint | d_op_dp
| Difference between current and start position during operation. More...
QPoint | d_op_start
| Mouse position where an operation started. More...
ImageWidget * | d_target
| The image to operate on. More...

## Additional Inherited Members

Public Types inherited from PlotToolInterface
enum | RttiValues { Rtti_PlotTool = 0, Rtti_RangeSelector, Rtti_DataPicker, Rtti_TranslateCurveTool, Rtti_MultiPeakFitTool, Rtti_LineProfileTool, Rtti_AddWidgetTool, Rtti_DrawDataPoints, Rtti_ImageProfilesTool, Rtti_SubtractLineTool, Rtti_PlotUserTool = 1000 }
Protected Attributes inherited from PlotToolInterface
Graph * | d_graph
const char * | d_status_slot
const QObject * | d_status_target

## Detailed Description

Plot tool for calculating intensity profiles of image markers along a line.

It is assumed that on the parent Graph an ImageMarker is selected. During initialization, a pointer to this marker is stored and the selection is removed. The LineProfileTool adds itself as a full-sized child widget to the Graph's canvas, allowing for fast redraws while selection of the line is in progress. Once the line is selected (mouse button is released), the profile is calculate and displayed, a new LineMarker denoting the selected profile line is added to the Graph and the LineProfileTool deletes itself by setting the Graph's active tool to NULL.

# Future Plans

Actually, image analysis doesn't fit terribly well into the Graph framework. A cleaner approach would be to add a new MyWidget subclass (Image?) that operates on a single image, providing things like line profiles, intensity tables and measuring points on scanned graphs (simple g3data-like functionality). There could be facilities for making an Image from an ImageMarker and vice versa (if that's really needed). [ postponed until after the redesign of project handling ]

## Constructor & Destructor Documentation

LineProfileTool::LineProfileTool | ( | Graph * | graph,
|  | ApplicationWindow * | app,
|  | int | average_pixels
| ) |  |

Standard constructor.

References Graph::activeEnrichment(), d_average_pixels, PlotToolInterface::d_graph, d_op_dp, d_op_start, d_target, and Graph::deselectMarker().

## Member Function Documentation

double LineProfileTool::averageImagePixel | ( | const QImage & | image,
|  | int | px,
|  | int | py,
|  | bool | moreHorizontal
| ) |  |

protected

References d_average_pixels.

Referenced by calculateLineProfile().

void LineProfileTool::calculateLineProfile | ( | const QPoint & | start,
|  | const QPoint & | end
| ) |  |

References MultiLayer::activeLayer(), averageImagePixel(), d_app, PlotToolInterface::d_graph, d_target, ApplicationWindow::multilayerPlot(), ApplicationWindow::newTable(), ImageWidget::pixmap(), Table::setCell(), Table::setHeader(), Table::setText(), Graph::setXAxisTitle(), Graph::setYAxisTitle(), and sgn.

Referenced by mouseReleaseEvent().

void LineProfileTool::mouseMoveEvent | ( | QMouseEvent * | e | ) |

protected virtual

Mouse movements need to be monitored for updating the line during operation.

References d_op_dp, d_op_start, and d_target.

void LineProfileTool::mousePressEvent | ( | QMouseEvent * | e | ) |

protected virtual

Pressing the left mouse button starts line selection.

Clicks with anything else than the left button are propagated to the parent as usual.

References d_op_start.

void LineProfileTool::mouseReleaseEvent | ( | QMouseEvent * | e | ) |

protected virtual

Mouse releases end line selection and cause the profile to be displayed.

References calculateLineProfile(), PlotToolInterface::d_graph, d_op_start, and Graph::setActiveTool().

void LineProfileTool::paintEvent | ( | QPaintEvent * | e | ) |

protected virtual

Draw line during operation.

References d_op_dp, and d_op_start.

virtual int LineProfileTool::rtti | ( |  | ) | const

inline virtual

Reimplemented from PlotToolInterface.

References PlotToolInterface::Rtti_LineProfileTool.

void LineProfileTool::statusText | ( | const QString & |  | ) |

signal

Emitted whenever a new message should be presented to the user.

You don't have to connect to this signal if you alreay specified a reciever during initialization.

## Member Data Documentation

ApplicationWindow* LineProfileTool::d_app

private

Referenced by calculateLineProfile().

int LineProfileTool::d_average_pixels

private

Number of image pixels over which to average.

Referenced by averageImagePixel(), and LineProfileTool().

QPoint LineProfileTool::d_op_dp

private

Difference between current and start position during operation.

Referenced by LineProfileTool(), mouseMoveEvent(), and paintEvent().

QPoint LineProfileTool::d_op_start

private

Mouse position where an operation started.

Referenced by LineProfileTool(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), and paintEvent().

ImageWidget* LineProfileTool::d_target

private

The image to operate on.

Referenced by calculateLineProfile(), LineProfileTool(), and mouseMoveEvent().

The documentation for this class was generated from the following files:

- qtiplot/src/plot2D/LineProfileTool.h
- qtiplot/src/plot2D/LineProfileTool.cpp