VivoQuant
Public Slots | Public Member Functions | List of all members
DistanceOperator Class Reference

Object to interact with the Distance/Annotation Operator when it is active. More...

Public Slots

void clear (bool quiet=false)
 Clear all the annotations. More...
 
void saveData (string filename=string())
 Save the annotations on the disk. More...
 
void loadData ()
 Load the annotations from the disk. More...
 
void saveDataIPACS (bool quiet=false)
 Save annotations to a iPACS (works only if the data was loaded from an iPACS) More...
 
string loadDataIPACS (bool quiet=false)
 Load annotations from an iPACS (works only if the data was loaded from an iPACS) More...
 
void saveProfilePlot (string filename=string())
 Save the profile plot to the disk as PDF or PNG. More...
 
void saveProfile (string filename=string(), bool quiet=false)
 Save the profile plot to the disk as a CSV file. More...
 
void addGraph (string item)
 Add any type of annotation based on a text string. More...
 
void addRectangle (string color, string label, int plane=0, QPointF labelPos=QPointF(), TPoint &topLeft=TPoint(), TPoint &bottomRight=TPoint(), bool linkedLabel=true, bool hidden=false)
 Add a new rectangle annotation. More...
 

Public Member Functions

void loadData (string filename, int slice=-1, bool clearExist=true)
 Load annotations from a file. More...
 
bool loadAnnotationsFromData (Index idx, bool quiet=false)
 Load annotations from an iPACS for a given data set (works only if the data was loaded form an iPACS) More...
 
void saveAnnotationsToData (Index idx, bool quiet=false)
 Save annotations to a loaded iPACS data set (works only if the data was loaded form an iPACS) More...
 
int count ()
 Get the number of annotations in the table. More...
 
Array< int > getSliceAnnotationIds (unsigned int slice)
 Get the annotations on a particular slice. More...
 
void rescaleAnnotation (float sf)
 Rescale all annotations. More...
 
bool deleteAnnotation (unsigned int id)
 Delete the specified annotation. More...
 
bool setAnnotationVisible (unsigned int id, bool visible)
 Show / hide a specified annotation. More...
 
bool setAnnotationLabel (unsigned int id, string label)
 Change the label of the specified annotation. More...
 
bool setAnnotationLocation (unsigned int id, float x, float y, float z)
 Change the center point of the specified annotation. More...
 
bool setAnnotationDistance (unsigned int id, float distance)
 Change the distance of the specified line. More...
 
bool setAnnotationRadius (unsigned int id, float radius)
 Change the radius of the specified circle. More...
 
bool setAnnotationWidth (unsigned int id, float width)
 Change the width of the specified rectangle. More...
 
bool setAnnotationHeight (unsigned int id, float height)
 Change the height of the specified rectangle. More...
 
bool setAnnotationWidthAndHeight (unsigned int id, float width, float height)
 Change the height of the specified rectangle. More...
 
bool setAnnotationStart (unsigned int id, float x, float y, float z)
 Change the start point of the specified line or the top corner of the specified rectangle. More...
 
bool setAnnotationEnd (unsigned int id, float x, float y, float z)
 Change the end point of the specified line or the bottom corner of the specified rectangle. More...
 
bool setAnnotationColor (unsigned int id, string color)
 Change the color of the specified annotation. More...
 
bool setAnnotationFontSize (unsigned int id, int size)
 Change the size of the specified annotation. More...
 
bool setAnnotationFont (unsigned int id, string font, int size=0)
 Change the font of the specified annotation. More...
 
bool setAnnotationPenWidth (unsigned int id, float penWidth)
 Change the pen width of the specified annotation. More...
 
Object getAnnotationInfo (unsigned int id)
 Get the information for the specified annotation. More...
 
float getAnnotationIntensity (unsigned int id)
 Get the intensity of the specified annotation (circle) More...
 
void setProfilePlotDimensions (int width, int height)
 Set the dimensions of the profile plot. More...
 

Detailed Description

Object to interact with the Distance/Annotation Operator when it is active.

This object can be used to draw point, circle and line annotations. The annotations can also be saved on disk or on an iPACS.

Images are loaded in the data manager starting with the reference at 0 See also ScriptMaster::currentOp() to obtain this object and MainWin::setViewMode() to enter the Distance/Annotation Operator.

Member Function Documentation

◆ addGraph

void addGraph ( string  item)
slot

Add any type of annotation based on a text string.

Parameters
itemThe text string containing the annotation's information
Note
Expected format: shape;type;color;rawLabel;plane;linkedp;startp;endp;showAll;linked;hidden
Ex: Point;blue;myLabel;2;30.4:78.9:0
Line;1;yellow;%4dmm;2;0:0:0;10.1:2,2:0;.89.1:78.9:0;1;1;

◆ addRectangle

void addRectangle ( string  color,
string  label,
int  plane = 0,
QPointF  labelPos = QPointF(),
TPoint &  topLeft = TPoint(),
TPoint &  bottomRight = TPoint(),
bool  linkedLabel = true,
bool  hidden = false 
)
slot

Add a new rectangle annotation.

Parameters
colorThe color
labelThe label
planeThe plane on which the annotation is drawn
labelPosThe position of the label
locationThe rectangle's center
topLeftThe x-axis length
bottomRightThe y-axis's length
linkedLabelEnable the linked state of the label
hiddenThe annotation's visibility

◆ clear

void clear ( bool  quiet = false)
slot

Clear all the annotations.

Parameters
quietSet to true to avoid the confirmation message

◆ count()

int count ( )
inline

Get the number of annotations in the table.

Returns
The number of annotations

◆ deleteAnnotation()

bool deleteAnnotation ( unsigned int  id)

Delete the specified annotation.

Parameters
idThe id of the annotation to delete (0-based from the annotation table)
Returns
True if deleted, false otherwise

◆ getAnnotationInfo()

Object getAnnotationInfo ( unsigned int  id)

Get the information for the specified annotation.

Parameters
idThe id of the annotation to get the info (0-based from the annotation table)
Returns
An array of key-value pairs containing the information
Note
Possible keys: shape, color, label, plane, type, rawlabel, labelp, linked, location & hide.
Line specific: startp, endp & distance.
Circle specific: radius (NB unlike a line's distance or a rectangle's width and height, circle radius is currently implemented as an integer number of voxels and does not correspond to a real distance in the image.
Rectangle specific: width, height, topp, bottomp.

◆ getAnnotationIntensity()

float getAnnotationIntensity ( unsigned int  id)

Get the intensity of the specified annotation (circle)

Parameters
idThe id of the annotation to get the intensity (0-based from the annotation table)
Returns
The first image's average intensity inside the circle

◆ getSliceAnnotationIds()

Array<int> getSliceAnnotationIds ( unsigned int  slice)

Get the annotations on a particular slice.

Returns
The ids the annotations on that slice

◆ loadAnnotationsFromData()

bool loadAnnotationsFromData ( Index  idx,
bool  quiet = false 
)

Load annotations from an iPACS for a given data set (works only if the data was loaded form an iPACS)

Parameters
idxIndex of data (see ScriptMaster::index())
quietSet to true to avoid confirmation message
Returns
True if succeeded, false otherwise

◆ loadData [1/2]

void loadData ( )
slot

Load the annotations from the disk.

Parameters
quietSet to true to avoid the confirmation message

◆ loadData() [2/2]

void loadData ( string  filename,
int  slice = -1,
bool  clearExist = true 
)

Load annotations from a file.

Parameters
filenameThe location of the file to load from
sliceThe slice to load the annotations on
clearexist annotations

◆ loadDataIPACS

string loadDataIPACS ( bool  quiet = false)
slot

Load annotations from an iPACS (works only if the data was loaded from an iPACS)

Parameters
quietSet to true to avoid confirmation message
Returns
A string containing "OK" if the annotations were loaded sucessfully, an empty string otherwise

◆ rescaleAnnotation()

void rescaleAnnotation ( float  sf)

Rescale all annotations.

Parameters
sfThe scale factor

◆ saveAnnotationsToData()

void saveAnnotationsToData ( Index  idx,
bool  quiet = false 
)

Save annotations to a loaded iPACS data set (works only if the data was loaded form an iPACS)

Parameters
idxIndex of data (see ScriptMaster::index())
quietSet to true to avoid confirmation message

◆ saveData

void saveData ( string  filename = string())
slot

Save the annotations on the disk.

Parameters
filename(optional) The location of the file to save to. If not supplied a file browser will open

◆ saveDataIPACS

void saveDataIPACS ( bool  quiet = false)
slot

Save annotations to a iPACS (works only if the data was loaded from an iPACS)

Parameters
quietSet to true to avoid confirmation message

◆ saveProfile

void saveProfile ( string  filename = string(),
bool  quiet = false 
)
slot

Save the profile plot to the disk as a CSV file.

Parameters
filename(optional) The location and filename of the file to save to. If not supplied a file browser will open
quiet(optional) Set to true to avoid dialog to be displayed on success.

◆ saveProfilePlot

void saveProfilePlot ( string  filename = string())
slot

Save the profile plot to the disk as PDF or PNG.

Parameters
filename(optional) The location and filename of the file to save to. If not supplied a file browser will open

◆ setAnnotationColor()

bool setAnnotationColor ( unsigned int  id,
string  color 
)

Change the color of the specified annotation.

Parameters
idThe id of the annotation to set the color (0-based from the annotation table)
colorThe new color name (ie: "red", "yellow", etc.)
Returns
True if set, false otherwise

◆ setAnnotationDistance()

bool setAnnotationDistance ( unsigned int  id,
float  distance 
)

Change the distance of the specified line.

Parameters
idThe id (0-based from the annotation table) of the line annotation to change
distanceThe new distance
Returns
True if set, false otherwise

◆ setAnnotationEnd()

bool setAnnotationEnd ( unsigned int  id,
float  x,
float  y,
float  z 
)

Change the end point of the specified line or the bottom corner of the specified rectangle.

Parameters
idThe id (0-based from the annotation table) of the line or rectangle annotation to change
xThe x coordinate of the new end point
yThe y coordinate of the new end point
zThe z coordinate of the new end point
Returns
True if set, false otherwise

◆ setAnnotationFont()

bool setAnnotationFont ( unsigned int  id,
string  font,
int  size = 0 
)

Change the font of the specified annotation.

Parameters
idThe id of the annotation to set the font (0-based from the annotation table)
sizeThe new size (optional)
fontThe new font
Returns
True if set, false otherwise

◆ setAnnotationFontSize()

bool setAnnotationFontSize ( unsigned int  id,
int  size 
)

Change the size of the specified annotation.

Parameters
idThe id of the annotation to set the size (0-based from the annotation table)
sizeThe new size
Returns
True if set, false otherwise

◆ setAnnotationHeight()

bool setAnnotationHeight ( unsigned int  id,
float  height 
)

Change the height of the specified rectangle.

Parameters
idThe id (0-based from the annotation table) of the rectangle annotation to change
heightThe new height
Returns
True if set, false otherwise

◆ setAnnotationLabel()

bool setAnnotationLabel ( unsigned int  id,
string  label 
)

Change the label of the specified annotation.

Parameters
idThe id of the annotation to set the label (0-based from the annotation table)
labelThe new label
Returns
True if set, false otherwise

◆ setAnnotationLocation()

bool setAnnotationLocation ( unsigned int  id,
float  x,
float  y,
float  z 
)

Change the center point of the specified annotation.

Parameters
idThe id of the annotation to change (0-based from the annotation table)
xThe x coordinate of the new location
yThe y coordinate of the new location
zThe z coordinate of the new location
Returns
True if set, false otherwise

◆ setAnnotationPenWidth()

bool setAnnotationPenWidth ( unsigned int  id,
float  penWidth 
)

Change the pen width of the specified annotation.

Parameters
idThe id of the annotation to set the font (0-based from the annotation table)
penWidthThe pen width
Returns
True if set, false otherwise

◆ setAnnotationRadius()

bool setAnnotationRadius ( unsigned int  id,
float  radius 
)

Change the radius of the specified circle.

Parameters
idThe id (0-based from the annotation table) of the circle annotation to change
radiusThe new radius
Returns
True if set, false otherwise

◆ setAnnotationStart()

bool setAnnotationStart ( unsigned int  id,
float  x,
float  y,
float  z 
)

Change the start point of the specified line or the top corner of the specified rectangle.

Parameters
idThe id (0-based from the annotation table) of the line or rectangle annotation to change
xThe x coordinate of the new start point
yThe y coordinate of the new start point
zThe z coordinate of the new start point
Returns
True if set, false otherwise

◆ setAnnotationVisible()

bool setAnnotationVisible ( unsigned int  id,
bool  visible 
)

Show / hide a specified annotation.

Parameters
idThe id of the annotation to set visible (0-based from the annotation table)
visibleThe visible state
Returns
True if set, false otherwise

◆ setAnnotationWidth()

bool setAnnotationWidth ( unsigned int  id,
float  width 
)

Change the width of the specified rectangle.

Parameters
idThe id (0-based from the annotation table) of the rectangle annotation to change
widthThe new width
Returns
True if set, false otherwise

◆ setAnnotationWidthAndHeight()

bool setAnnotationWidthAndHeight ( unsigned int  id,
float  width,
float  height 
)

Change the height of the specified rectangle.

Parameters
idThe id (0-based from the annotation table) of the rectangle annotation to change
widthThe new width
heightThe new height
Returns
True if set, false otherwise

◆ setProfilePlotDimensions()

void setProfilePlotDimensions ( int  width,
int  height 
)

Set the dimensions of the profile plot.

Parameters
widthThe width of the profile plot window
heightThe height of the profile plot window