Microscopy Image Browser 2.91
MIB
Loading...
Searching...
No Matches
mibMeasure Class Reference

class is responsible for keeping Measurements More...

Inheritance diagram for mibMeasure:
Collaboration diagram for mibMeasure:

Public Member Functions

 mibMeasure (hImg)
 Constructor for the class.
 
function  addMeasurements (newData, n)
 add or insert measurement into the obj.Data structure
 
function  addMeasurementsToPlot (mibModel, mode, axes)
 plot measurement marks above images
 
function  clearContents ()
 Set all elements of the class to default values.
 
function  clearData ()
 Removes all values of the Data structure.
 
function  generateKymograph (mibController, index, colCh, options)
 generate kymograph and save it as an image
 
function  editMeasurements (mibController, index, colCh, widthProfile, finetuneCheck, calcIntensity)
 update measurements
 
function  removeMeasurements (index)
 removeMeasurements(obj, index) Remove measurement(s) from the class
 
function  setOptions ()
 Update all values of the Options structure of the class.
 
function  setDefaultOptions ()
 Set all values of the Options structure of the class to default values.
 
function position = drawROI (mibController, type, pos, instant)
 show a ROI object in the mibController.mibView.handles.mibImageAxes for selection of the area to measure
 
function  updateROIposition1 (new_position)
 Update ROI position during movement of imrect and imellipse.
 
function  updateROIposition2 (new_position)
 Update position during movement of impoly, imline.
 
function  updateROIScreenPosition (mode)
 Updates position of ROI when plotting in handles.imageAxes.
 
function number = getNumberOfMeasurements ()
 number = getNumberOfMeasurements(obj) Get number of stored measurements
 
function circ = circlefit (x, y)
 least squares circle fitting (see matlab help/demo (pendulum))
 
function result = AngleFun (mibController, index, colCh, finetuneCheck, calcIntensity)
 This function allows the measurement of an angle between 3 points.
 
function result = CaliperFun (mibController, index, colCh, finetuneCheck, calcIntensity)
 measuring a distance between two opposite sides of an object
 
function result = CircleFun (mibController, index, colCh, finetuneCheck, calcIntensity)
 This function allows the measurement of a radius.
 
function result = DistanceFreeFun (mibController, colCh, finetuneCheck, calcIntensity, freehandOptions)
 measuring of distance along the free-hand path. The path is converted to the impoly line
 
function result = DistancePolyFun (mibController, index, colCh, noPoints, finetuneCheck, calcIntensity, options)
 measuring of distance along the path
 
function result = PointFun (mibController, index, colCh, finetuneCheck, calcIntensity)
 add a point as a marker
 
function result = DistanceFun (mibController, index, colCh, finetuneCheck, integrateWidth, calcIntensity, options)
 measuring distance between two points
 

Public Attributes

 Data
 a structure with measurements .Data.n - index, double .Data.type - type, string: LinDistance, .Data.value - value, double .Data.info - info, free text .Data.X - X-coordinates of points .Data.Y - Y-coordinates of points .Data.Z - Z-coordinates of points .Data.T - T-coordinates of points .Data.orientation - orientation of the measurement: 4-yx; 1-zx; 2-zy .Data.spline .Data.circ .Data.intensity - average intensity of the profile .Data.profile - intensity profile .Data.integrateWidth - only for Distance (linear) width of the integrated intensity profile, otherwise empty
 
 hImg
 handle to mibImage class
 
 Options
 a structure with show options .Options.marker1 = o; - style 1 for markers .Options.marker2 = .; - style 2 for markers .Options.markersize = 10; - size of markers .Options.linestyle1 = -; - style 1 for lines .Options.linestyle2 = ; - style 2 for lines .Options.linewidth = 1 ; - width for lines .Options.color1 = y; - color style 1 .Options.color2 = k; - color style 2 .Options.textcolorfg = y; - text color .Options.textcolorbg = none; - color for text background .Options.fontsize = 14; - size of the font .Options.splinemethod = spline; - method for splines .Options.showMarkers = 1; .Options.showLines = 1; .Options.showText = 1;
 
 roi
 a structure with ROI data:
 
 typeToShow
 a string that defines type of measurements to show:
 
 fixZ
 a switch that fixes Z and T values when the measurements are recalculated
 
EVENT addMeasurement
 add a new measurement, when the Measure Tool is displayed note: use this syntax instead to send event motifyEvent.Name = addMeasurement; eventdata = ToggleEventData(motifyEvent); notify(obj.mibModel, modelNotify, eventdata);
 
EVENT updatePosition
 update coordinates of measurements
 

Detailed Description

class is responsible for keeping Measurements

Constructor & Destructor Documentation

◆ mibMeasure()

mibMeasure.mibMeasure ( hImg)

Constructor for the class.

Constructor for the mibMeasure class. Create a new instance of the class with default parameters

Parameters
hImg- handle to mibImage class

References hImg.

Member Function Documentation

◆ addMeasurements()

function mibMeasure.addMeasurements ( newData,
n )

add or insert measurement into the obj.Data structure

Parameters
newDatastructure of a new measurement to insert. Fields should match those of obj.Data
n[optional] position where to add the measurement, default - number of measurements in obj.Data + 1

Examples:

mibMeasure.addMeasurements(newData, 5); insert measurement to position 5
mibMeasure(hImg)
Constructor for the class.
Definition mibMeasure.m:134

References n.

◆ addMeasurementsToPlot()

function mibMeasure.addMeasurementsToPlot ( mibModel,
mode,
axes )

plot measurement marks above images

Parameters
mibModelmibModel class of MIB
modea string that defines a mode of the shown image: shown (in most cases), or full (for panning)
axesdefine a handles to axes that should be used for drawing, used in mibSnapshotGUI.m; default mibView.handles.mibImageAxes
Required fields of mibModel:

Examples:

obj.mibModel.I{obj.mibModel.I}.hMeasure.addMeasurementsToPlot(obj.mibModel, 'shown', obj.mibView.handles.mibImageAxes); // call from mibController; to show the measurements above the image in the mibController.plotImage function
obj.mibModel.I{obj.mibModel.I}.hMeasure.addMeasurementsToPlot(obj.mibModel, 'full', obj.mibView.handles.mibImageAxes); // call from mibController; to show the measurements above the image in the mibGUI_WindowButtonDownFcn function

References mibModel.convertDataToMouseCoordinates(), and mibModel.mibShowAnnotationsCheck.

Here is the call graph for this function:

◆ AngleFun()

function result = mibMeasure.AngleFun ( mibController,
index,
colCh,
finetuneCheck,
calcIntensity )

This function allows the measurement of an angle between 3 points.

Parameters
mibControllerhandle of mibController
index[Optional] an index of measurement to update; when empty ([] ) - adds a new measurement
colCh[optional] color channel to use for profile; default = 1
finetuneCheck[optional] 1 (default) - allow fine-tuning during the placing of measurements; 0 - instant placing
calcIntensity[optional] 1 (default) - calculate intensity profile, 0 - do not calculate
Return values
calcIntensityresult - 1-success, 0-cancel
Required fields of mibController:

Examples

obj.mibModel.I{obj.mibModel.Id}.hMeasure.AngleFun(obj, [], 1); // call from mibMeasureToolController; get points and measure the angle between them. Calculate intensity profile for color channel 1
obj.mibModel.I{obj.mibModel.Id}.hMeasure.AngleFun(obj, 2, 1); // call from mibMeasureToolController; edit second measurement.

References max, mibController.mibModel, mibController.mibView, n, and mibController.plotImage().

Here is the call graph for this function:

◆ CaliperFun()

function result = mibMeasure.CaliperFun ( mibController,
index,
colCh,
finetuneCheck,
calcIntensity )

measuring a distance between two opposite sides of an object

Parameters
mibControllerhandle of mibController
index[Optional] an index of measurement to update; when empty ([] ) - adds a new measurement
colCh[optional] color channel to use for profile; default = 1
finetuneCheck[optional] 1 (default) - allow fine-tuning during the placing of measurements; 0 - instant placing
calcIntensity[optional] 1 (default) - calculate intensity profile, 0 - do not calculate
Return values
calcIntensityresult - 1-success, 0-cancel
Required fields of mibController:

Examples

obj.mibModel.I{obj.mibModel.Id}.hMeasure.CaliperFun(obj, [], 1); // call from mibMeasureToolController; get points and measure the distance between them. Calculate intensity profile for color channel 1
obj.mibModel.I{obj.mibModel.Id}.hMeasure.CaliperFun(obj, 2, 1); // call from mibMeasureToolController; edit second measurement.

References D(), max, mibController.mibModel, mibController.mibView, n, and mibController.plotImage().

Here is the call graph for this function:

◆ circlefit()

function circ = mibMeasure.circlefit ( x,
y )

least squares circle fitting (see matlab help/demo (pendulum))

Parameters
x
y
Return values
circ
Generated fields of circ:

References M, and n.

◆ CircleFun()

function result = mibMeasure.CircleFun ( mibController,
index,
colCh,
finetuneCheck,
calcIntensity )

This function allows the measurement of a radius.

Parameters
mibControllerhandle of mibController
index[Optional] an index of measurement to update; when empty ([] ) - adds a new measurement
colCh[optional] color channel to use for profile; default = 1
finetuneCheck[optional] 1 (default) - allow fine-tuning during the placing of measurements; 0 - instant placing
calcIntensity[optional] 1 (default) - calculate intensity profile, 0 - do not calculate
Return values
calcIntensityresult - 1-success, 0-cancel
Required fields of mibController:

Examples

obj.mibModel.I{obj.mibModel.Id}.hMeasure.CircleFun(obj, [], 1); // call from mibMeasureToolController; get points and measure the radius. Calculate intensity profile for color channel 1
obj.mibModel.I{obj.mibModel.Id}.hMeasure.CircleFun(obj, 2, 1); // call from mibMeasureToolController; edit second measurement.

References A(), B(), mibController.mibModel, mibController.mibView, n, and mibController.plotImage().

Here is the call graph for this function:

◆ clearContents()

function mibMeasure.clearContents ( )

Set all elements of the class to default values.

Examples:

obj.mibModel.I{obj.mibModel.I}.hMeasure.clearContents(); // call from mibController;

◆ clearData()

function mibMeasure.clearData ( )

Removes all values of the Data structure.

Examples:

obj.mibModel.I{obj.mibModel.I}.hMeasure.clearData(); // call from mibController;

◆ DistanceFreeFun()

function result = mibMeasure.DistanceFreeFun ( mibController,
colCh,
finetuneCheck,
calcIntensity,
freehandOptions )

measuring of distance along the free-hand path. The path is converted to the impoly line

Parameters
mibControllerhandle of mibController
colCh[optional] color channel to use for profile; default = 1
finetuneCheck[optional] 1 (default) - allow fine-tuning during the placing of measurements; 0 - instant placing
calcIntensity[optional] 1 (default) - calculate intensity profile, 0 - do not calculate
freehandOptionsstructure with additional parameters .fixNumberPoints - logical, when checked do not ask for number of points .noPointsEdit - string with selected number of points to use
Return values
freehandOptionsresult - 1-success, 0-cancel
Required fields of mibController:
Required fields of freehandOptions:

Examples

obj.mibModel.I{obj.mibModel.Id}.hMeasure.DistanceFreeFun(obj, 1); // call from mibMeasureToolController; draw a path and measure the distance between points. Calculate intensity profile for color channel 1

References mibInputMultiDlg(), mibController.mibModel, n, and mibController.plotImage().

Here is the call graph for this function:

◆ DistanceFun()

function result = mibMeasure.DistanceFun ( mibController,
index,
colCh,
finetuneCheck,
integrateWidth,
calcIntensity,
options )

measuring distance between two points

Parameters
mibControllerhandle of mibController
index[Optional] an index of measurement to update; when empty ([] ) - adds a new measurement
colCh[optional] color channel to use for profile; default = 1
finetuneCheck[optional] 1 (default) - allow fine-tuning during the placing of measurements; 0 - instant placing
integrateWidth[optional] a number of pixels for integration of image intensity profile
calcIntensity[optional] 1 (default) - calculate intensity profile, 0 - do not calculate
optionsstructure with additional options .widthProfile - width of profile for measurements of intensity profiles, could be empty .outputFilename - full path to the output file .outputFormat - output format, tif, csv, mat, preview', when preview show it as a plot .calcKymograph - true/false, calculate kymograph .addScale - add scale to kymograph
Return values
optionsresult - 1-success, 0-cancel
Required fields of mibController:
Required fields of options:

Examples

obj.mibModel.I{obj.mibModel.Id}.hMeasure.DistanceFun(obj, [], 1); // call from mibMeasureToolController; get points and measure the distance between them. Calculate intensity profile for color channel 1
obj.mibModel.I{obj.mibModel.Id}.hMeasure.DistanceFun(obj, 2, 1); // call from mibMeasureToolController; edit second measurement.

References A(), B(), max, mibAddScaleBar(), mibAddText2Img(), mibImageProfileIntegrate(), mibController.mibModel, mibController.mibView, n, and mibController.plotImage().

Here is the call graph for this function:

◆ DistancePolyFun()

function result = mibMeasure.DistancePolyFun ( mibController,
index,
colCh,
noPoints,
finetuneCheck,
calcIntensity,
options )

measuring of distance along the path

Parameters
mibControllerhandle of mibController
index[Optional] an index of measurement to update; when empty ([] ) - adds a new measurement
colCh[optional] color channel to use for profile; default = 1
noPoints[optional] define number of points in the path; default = 5
finetuneCheck[optional] 1 (default) - allow fine-tuning during the placing of measurements; 0 - instant placing
calcIntensity[optional] 1 (default) - calculate intensity profile, 0 - do not calculate
optionsstructure with additional options .widthProfile - width of profile for measurements of intensity profiles, could be empty .outputFilename - full path to the output file .outputFormat - output format, tif, csv, mat, preview', when preview show it as a plot .calcKymograph - true/false, calculate kymograph .addScale - add scale to kymograph
Return values
optionsresult - 1-success, 0-cancel
Required fields of mibController:
Required fields of options:

Examples

obj.mibModel.I{obj.mibModel.Id}.hMeasure.DistancePolyFun(obj, [], 1, 10); // call from mibMeasureToolController; get 10 points and measure the distance between them. Calculate intensity profile for color channel 1
obj.mibModel.I{obj.mibModel.Id}.hMeasure.DistancePolyFun(obj, 2, 1); // call from mibMeasureToolController; edit second measurement.

References max, mibAddScaleBar(), mibAddText2Img(), mibController.mibGUI_ScrollWheelFcn(), mibController.mibModel, mibController.mibView, N, n, and mibController.plotImage().

Here is the call graph for this function:

◆ drawROI()

function position = mibMeasure.drawROI ( mibController,
type,
pos,
instant )

show a ROI object in the mibController.mibView.handles.mibImageAxes for selection of the area to measure

Creates an instanse of Matlab imroi class and store it in mibMeasure.roi.imroi

Parameters
mibControllera handle of mibController class
typea type of ROI: 'imline', 'imellipse'
poscoordinates of the ROI
  • [x1, y1; x2, y2] -> 'imline'
  • [x1, y1, Rwidth, Rheight] -> 'imellipse'
instant[optional], used only for imellipse to automatically get position of vertices. 1 or 0 (default).
Return values
positioncoordinates of the selected area
Required fields of mibController:

Examples:

position = obj.mibModel.I{obj.mibModel.I}.hMeasure.drawROI(obj, 'imline', [10, 10; 50, 50]); // call from mibController; draw a line

References mibController.mibModel, and mibController.mibView.

◆ editMeasurements()

function mibMeasure.editMeasurements ( mibController,
index,
colCh,
widthProfile,
finetuneCheck,
calcIntensity )

update measurements

Parameters
mibControllerhandle to mibController class
indexan index of the measurement to update
colChnumber of a color channel for intensity profile, or 0 for all color channels
widthProfile[optional] width of profile for measurements of intensity profiles, could be empty
finetuneCheck[optional] a number 0 - do not fine tune the measurement; 1-do the finetuning manually
calcIntensity[optional] 1 (default) - calculate intensity profile, 0 - do not calculate

References mibController.mibModel.

◆ generateKymograph()

function mibMeasure.generateKymograph ( mibController,
index,
colCh,
options )

generate kymograph and save it as an image

Parameters
mibControllerhandle to mibController class
indexan index of the measurement to update
colChnumber of a color channel for intensity profile, or 0 for all color channels
optionsstructure with additional options .widthProfile - width of profile for measurements of intensity profiles, could be empty .outputFilename - full path to the output file .outputFormat - output format, tif, csv, mat .calcKymograph - true/false, calculate kymograph
Required fields of options:

◆ getNumberOfMeasurements()

function number = mibMeasure.getNumberOfMeasurements ( )

number = getNumberOfMeasurements(obj) Get number of stored measurements

Return values
numbernumber of stored measurements

Examples

number = obj.mibModel.I{obj.mibModel.I}.hMeasure.getNumberOfMeasurements(); // call from mibController; get the total number

◆ PointFun()

function result = mibMeasure.PointFun ( mibController,
index,
colCh,
finetuneCheck,
calcIntensity )

add a point as a marker

Parameters
mibControllerhandle of mibController
index[Optional] an index of measurement to update; when empty ([] ) - adds a new measurement
colCh[optional] color channel to use for profile; default = 1
finetuneCheck[optional] 1 (default) - allow fine-tuning during the placing of measurements; 0 - instant placing
calcIntensity[optional] 1 (default) - calculate intensity profile, 0 - do not calculate
Return values
calcIntensityresult - 1-success, 0-cancel
Required fields of mibController:

Examples

obj.mibModel.I{obj.mibModel.Id}.hMeasure.PointFun(obj, [], 1); // call from mibMeasureToolController; place points and assign a label.
obj.mibModel.I{obj.mibModel.Id}.hMeasure.PointFun(obj, 2, 1); // call from mibMeasureToolController; edit second measurement.

References mibInputDlg(), mibController.mibModel, mibController.mibView, n, and mibController.plotImage().

Here is the call graph for this function:

◆ removeMeasurements()

function mibMeasure.removeMeasurements ( index)

removeMeasurements(obj, index) Remove measurement(s) from the class

Parameters
index[optional], an index of the measurement point to remove, when empty or zero - removes all points

Examples

obj.mibModel.I{obj.mibModel.I}.hMeasure.removeMeasurements(); // call from mibController;remove all measurements
obj.mibModel.I{obj.mibModel.I}.hMeasure.removeMeasurements(5); // call from mibController; remove 5th measurement

◆ setDefaultOptions()

function mibMeasure.setDefaultOptions ( )

Set all values of the Options structure of the class to default values.

Examples:

obj.mibModel.I{obj.mibModel.I}.hMeasure.setDefaultOptions(); // call from mibController;

◆ setOptions()

function mibMeasure.setOptions ( )

Update all values of the Options structure of the class.

Examples:

obj.mibModel.I{obj.mibModel.I}.hMeasure.setOptions(); call from mibController;
main controller for MIB
Definition mibController.m:18

References A(), and mibInputMultiDlg().

Here is the call graph for this function:

◆ updateROIposition1()

function mibMeasure.updateROIposition1 ( new_position)

Update ROI position during movement of imrect and imellipse.

one of two functions resposible for update of mibMeasure.roi. pos. The other one is mibMeasure.updateROIposition2()

Parameters
new_positiona vector with coordinates of a new position [xmin, ymin, width, height]

References max.

◆ updateROIposition2()

function mibMeasure.updateROIposition2 ( new_position)

Update position during movement of impoly, imline.

one of two functions resposible for update of mibMeasure.roi. pos. The other one is mibMeasure.updateROIposition1()

Parameters
new_positiona vector with coordinates of a new position [point_number][x, y]

References max.

◆ updateROIScreenPosition()

function mibMeasure.updateROIScreenPosition ( mode)

Updates position of ROI when plotting in handles.imageAxes.

Parameters
modeidentifier of the updating mode:
  • 'crop' during zooming
  • 'full' during panning of the axes

Examples

obj.mibModel.I{obj.mibModel.I}.hMeasure.updateROIScreenPosition('crop'); // call from mibController; update positions of all ROIs during zoom in/out
obj.mibModel.I{obj.mibModel.I}.hMeasure.updateROIScreenPosition('full'); // call from mibController; update positions of all ROIs during panning

References max.

Member Data Documentation

◆ addMeasurement

EVENT mibMeasure.addMeasurement

add a new measurement, when the Measure Tool is displayed note: use this syntax instead to send event motifyEvent.Name = addMeasurement; eventdata = ToggleEventData(motifyEvent); notify(obj.mibModel, modelNotify, eventdata);

Events
addMeasurement

◆ Data

mibMeasure.Data

a structure with measurements .Data.n - index, double .Data.type - type, string: LinDistance, .Data.value - value, double .Data.info - info, free text .Data.X - X-coordinates of points .Data.Y - Y-coordinates of points .Data.Z - Z-coordinates of points .Data.T - T-coordinates of points .Data.orientation - orientation of the measurement: 4-yx; 1-zx; 2-zy .Data.spline .Data.circ .Data.intensity - average intensity of the profile .Data.profile - intensity profile .Data.integrateWidth - only for Distance (linear) width of the integrated intensity profile, otherwise empty

◆ fixZ

mibMeasure.fixZ

a switch that fixes Z and T values when the measurements are recalculated

◆ hImg

mibMeasure.hImg

handle to mibImage class

Referenced by mibMeasure().

◆ Options

mibMeasure.Options

a structure with show options .Options.marker1 = o; - style 1 for markers .Options.marker2 = .; - style 2 for markers .Options.markersize = 10; - size of markers .Options.linestyle1 = -; - style 1 for lines .Options.linestyle2 = ; - style 2 for lines .Options.linewidth = 1 ; - width for lines .Options.color1 = y; - color style 1 .Options.color2 = k; - color style 2 .Options.textcolorfg = y; - text color .Options.textcolorbg = none; - color for text background .Options.fontsize = 14; - size of the font .Options.splinemethod = spline; - method for splines .Options.showMarkers = 1; .Options.showLines = 1; .Options.showText = 1;

◆ roi

mibMeasure.roi

a structure with ROI data:

  • roi.pos - coordinates of ROIs
  • roi.type - ROIs type: imline
  • roi.imroi - handle to imroi Matlab class
  • roi.cb - array of callbacks to addNewPositionCallback function

◆ typeToShow

mibMeasure.typeToShow

a string that defines type of measurements to show:

  • All - show all
  • Angle
  • Caliper
  • Circle (R)
  • Distance (linear)
  • Distance (polyline)
  • Point

◆ updatePosition

EVENT mibMeasure.updatePosition

update coordinates of measurements

Events
updatePosition

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