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

class is responsible to keep regions of interest (ROI) More...

Inheritance diagram for mibRoiRegion:
Collaboration diagram for mibRoiRegion:

Public Member Functions

 mibRoiRegion (mibImage)
 Constructor for the class.
 
function  clearContents ()
 Set all elements of the class to default values.
 
function  clearData ()
 Removes all values of the Data structures.
 
function index = findIndexByLabel (labelStr)
 Finds index of a ROI that has Data.label == labelStr.
 
function  addROI (mibController, type, index, coordinates, noPoints)
 Adds ROI.
 
function  imfreehandFun (mibController, index)
 Adds impoly type of ROI using imfreehand tool.
 
function  impolyFun (mibController, index, coordinates, noPoints)
 Adds impoly type of ROI.
 
function  imrectFun (mibController, index, coordinates)
 Adds imrect type of ROI.
 
function  imellipseFun (mibController, index, coordinates)
 Adds imellipse type of ROI.
 
function  storeROI (newData, index)
 add or insert ROI information into the obj.Data structure
 
function  removeROI (index)
 removeROI(obj, index) Remove ROI(s) from the class
 
function [ number , indices ] = getNumberOfROI (orientation)
 [number, indices] = getNumberOfROI(obj, orientation) Get number of stored ROI
 
function  setDefaultOptions ()
 Set all values of the Options structure of the class to default values.
 
function  updateOptions ()
 Update the Options structure of the class.
 
function  resample (resampledRatio)
 Recalculation of ROI position during image resampling.
 
function  crop (cropF)
 Recalculation of ROI position during image crop.
 
function [ position , screenPosition ] = drawROI (mibController, type, pos, instant)
 draw a ROI object in the mibGUI.handles.mibImageAxes
 
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  addROIsToPlot (mibController, mode)
 plot ROIs above the handles.mibImageAxes of mibGUI
 
function bb = getBoundingBox (index)
 return the bounding box for the ROI
 
function mask = returnMask (index, Height, Width, orient, blockModeSwitch)
 Return a bitmap mask of the specified ROI.
 
function  updateROIScreenPosition (mode)
 Updates position of ROI when plotting in mibGUI.handles.mibImageAxes.
 

Public Attributes

 roi
 a structure with ROI data:
 
 Data
 a new structure for ROI data .Data.label - string with a label .Data.type - type, string: imrect, imellipse, impoly, imfreehand .Data.X - X-coordinates of points .Data.Y - Y-coordinates of points .Data.orientation - orientaion of the ROI: 1-xz, 2-yz, 4-yx .Data.BoundingBox - a structire with bounding box for the current ROI .x - [xmin, xmax]; .y - [ymin, ymax]
 
 Options
 a structure with show options .Options.marker = s; - style 1 for markers .Options.markersize = 10; - size of markers .Options.linestyle = -; - style 1 for lines .Options.linewidth = 2 ; - width for lines .Options.color = w; - color style .Options.textcolorfg = y; - text color .Options.textcolorbg = none; - color for text background .Options.fontsize = 14; - size of the font .Options.showMarkers = 1; .Options.showLines = 1; .Options.showText = 0;
 
 mibImage
 handle to mibImage class
 

Detailed Description

class is responsible to keep regions of interest (ROI)

Constructor & Destructor Documentation

◆ mibRoiRegion()

mibRoiRegion.mibRoiRegion ( mibImage)

Constructor for the class.

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

Parameters
mibImage- handle to imageData class

References mibImage.

Member Function Documentation

◆ addROI()

function mibRoiRegion.addROI ( mibController,
type,
index,
coordinates,
noPoints )

Adds ROI.

Parameters
mibControllerhandle to mibController class, or it can be empty ([]) for imrect, when coordinates are provided
typetype of ROI to add: "imrect", "imellipse", "impoly", "imfreehand"
index[optional] index of the ROI. If not empty will allow to modify a ROI with the provided index
coordinates[optional] coordinates for placing the ROI, can be []
noPoints[@ optional] noPoints for the impoly type, dafault = 5

Examples:

◆ addROIsToPlot()

function mibRoiRegion.addROIsToPlot ( mibController,
mode )

plot ROIs above the handles.mibImageAxes of mibGUI

Parameters
mibControllerhandle to mibController class
modea string that defines a mode of the shown image: shown (in most cases), or full (for panning)
Required fields of mibController:

Examples:

obj.mibModel.I{obj.mibModel.Id}.hROI.addROIsToPlot(mibController, 'shown'); // call from mibController class, to show the measurements above the image in mibController.plotImage function
main controller for MIB
Definition mibController.m:18
obj.mibModel.I{obj.mibModel.Id}.hROI.addROIsToPlot(mibController, 'full'); // call from mibController class, to show the measurements above the image in the mibController.WindowButtonDownFcn function

References mibController.mibModel, and mibController.mibView.

◆ clearContents()

function mibRoiRegion.clearContents ( )

Set all elements of the class to default values.

Examples:

obj.mibModel.I{obj.mibModel.Id}.hROI.clearContents(); // call from mibController; clear the class contents and reset to default options

◆ clearData()

function mibRoiRegion.clearData ( )

Removes all values of the Data structures.

Examples:

obj.mibModel.I{obj.mibModel.Id}.hROI.clearData(); // call from mibController; clear the class contents

◆ crop()

function mibRoiRegion.crop ( cropF)

Recalculation of ROI position during image crop.

Parameters
cropFa vector [x1, y1, dx, dy, z1, dz] with parameters of the crop. Note! The units are pixels!

Examples:

cropF = [100 512 200 512 5 20]; // define parameters of the crop.
indices = obj.mibModel.I{obj.mibModel.Id}.hROI.crop(cropF); // call from mibController, crop ROIs

◆ drawROI()

function [ position , screenPosition ] = mibRoiRegion.drawROI ( mibController,
type,
pos,
instant )

draw a ROI object in the mibGUI.handles.mibImageAxes

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

Parameters
mibControllerhandle to mibController class
typea type of ROI: 'imline', 'imellipse'
poscoordinates of the ROI
  • [x1, y1; x2, y2] -> 'imrect' coordinates of two corners
  • [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 in the Data format
screenPositioncoordinagtes of the selected area in the imageAxes units
Required fields of mibController:

Examples:

position = obj.drawROI(mibController, 'imline', [10, 10; 50, 50]); // draw a line

References mibController.mibModel, and mibController.mibView.

◆ findIndexByLabel()

function index = mibRoiRegion.findIndexByLabel ( labelStr)

Finds index of a ROI that has Data.label == labelStr.

Parameters
labelStrlabel string
Return values
indexindex of the ROI that has the label

Examples:

obj.mibModel.I{obj.mibModel.I}.hROI.findIndexByLabel('ROI 1'); // Call from mibController; return index of the ROI that has 'ROI 1' label

◆ getBoundingBox()

function bb = mibRoiRegion.getBoundingBox ( index)

return the bounding box for the ROI

Parameters
indexan index of ROI to get mask, use 0 - to get combined mask for all shown ROIs. It is also possible to use obj.Data.label field as string of chars
Return values
bba matrix with the bounding box information as [xmin, xmax, ymin, ymax]

References max, and min.

◆ getNumberOfROI()

function [ number , indices ] = mibRoiRegion.getNumberOfROI ( orientation)

[number, indices] = getNumberOfROI(obj, orientation) Get number of stored ROI

Parameters
orientation[optional] defines orienation, 1-xz, 2-yz, 4-yx, 0-get all. When omitted returns number of ROIs for the shown orientation
Return values
numbernumber of ROIs
indicesindices of ROIs

Examples

number = obj.getNumberOfROI(4); // get the total number of ROIs for the XY orientation
[number, indices] = obj.mibModel.I{obj.mibModel.Id}.hROI.getNumberOfROI(); // call from mibController, get number of ROIs and thie indices

◆ imellipseFun()

function mibRoiRegion.imellipseFun ( mibController,
index,
coordinates )

Adds imellipse type of ROI.

Parameters
mibControllerhandle to mibController class
indexindex of the ROI. If not empty will allow to modify a ROI with the provided index
coordinates[optional] coordinates for placing the ROI manually, [x-center y-center, radiusX, radiusY]
Required fields of mibController:

Examples:

obj.imellipseFun(mibController, 5); // Add a new imellipse ROI to position 5
obj.imellipseFun(mibController, 5, [100, 150, 250, 350]); // Add a new imellipse ROI to position 5; x1=100, x2=150, radiusX=250; radiusY=350

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

Here is the call graph for this function:

◆ imfreehandFun()

function mibRoiRegion.imfreehandFun ( mibController,
index )

Adds impoly type of ROI using imfreehand tool.

Parameters
mibControllerhandle to mibController class
indexindex of the ROI. If not empty will allow to modify a ROI with the provided index

Examples:

obj.imfreehandFun(mibController, 5); // Add a new impoly ROI to position 5

References mibInputDlg().

Here is the call graph for this function:

◆ impolyFun()

function mibRoiRegion.impolyFun ( mibController,
index,
coordinates,
noPoints )

Adds impoly type of ROI.

Parameters
mibControllerhandle to mibController class
indexindex of the ROI. If not empty will allow to modify a ROI with the provided index
coordinates[optional] coordinates for placing the ROI manually
noPoints[optional] number of points in the polyline when adding a new ROI
Required fields of mibController:

Examples:

obj.impolyFun(mibController, [], [], 5); // Add a new impoly ROI with 5 vertices
obj.impolyFun(mibController, 5, [100, 150; 250, 350; 50, 150]); // Add impoly ROI to position 5; with specified vertices

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

Here is the call graph for this function:

◆ imrectFun()

function mibRoiRegion.imrectFun ( mibController,
index,
coordinates )

Adds imrect type of ROI.

Parameters
mibControllera handle to mibController class
indexindex of the ROI. If not empty will allow to modify a ROI with the provided index
coordinates[optional] coordinates for placing the ROI manually
Required fields of mibController:

Examples:

obj.imrectFun(5); // Add a new imrect ROI to position 5
obj.imrectFunimrectFun(5, [100, 150, 250, 350]); // Add a new imrect ROI to position 5; x1=100, x2=150, width=250; height=350

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

Here is the call graph for this function:

◆ removeROI()

function mibRoiRegion.removeROI ( index)

removeROI(obj, index) Remove ROI(s) from the class

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

Examples

Measure.removeROI(); // remove all ROIs
removeROI(obj, 5); // Call within the class; remove 5th ROI
function removeROI(index)
removeROI(obj, index) Remove ROI(s) from the class
Definition mibRoiRegion.m:627

◆ resample()

function mibRoiRegion.resample ( resampledRatio)

Recalculation of ROI position during image resampling.

Parameters
resampledRatioa vector [ratioW, ratioH, ratioZ] ratio of new/old dimensions after resampling.

Examples:

resampledRatio = [.5 .5 1]; // bin in 2 times XY dimension.
indices = obj.mibModel.I{obj.mibModel.Id}.hROI.resample(resampledRatio); // call from mibController, resample ROIs

◆ returnMask()

function mask = mibRoiRegion.returnMask ( index,
Height,
Width,
orient,
blockModeSwitch )

Return a bitmap mask of the specified ROI.

Parameters
indexan index of ROI to get mask, use 0 - to get combined mask for all shown ROIs. It is also possible to use obj.Data.label field as string of chars
Height[optional] height of the image
Width[optional] width of the image
orient[optional] orientation of the dataset: 1-xz, 2-yz, 4-yz, 0-for all orientations. Default, the currently shown orientation.
blockModeSwitchoverride the blockModeSwitch
Return values
maskmask image [1:Height, 1:Width]

Examples:

mask = obj.mibModel.I{obj.mibModel.Id}.hROI.returnMask(new_position, 1); // call from mibController, get mask of ROI number 1
mask = obj.mibModel.I{obj.mibModel.Id}.hROI.returnMask(0); // call from mibController, get combined mask of all shown ROIs

References max, mibConnectPoints(), and min.

Here is the call graph for this function:

◆ setDefaultOptions()

function mibRoiRegion.setDefaultOptions ( )

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

Examples:

mibRoiRegion.setDefaultOptions();
mibRoiRegion(mibImage)
Constructor for the class.
Definition mibRoiRegion.m:86
setDefaultOptions(obj); // Call within the class
function setDefaultOptions()
Set all values of the Options structure of the class to default values.
Definition mibRoiRegion.m:700

◆ storeROI()

function mibRoiRegion.storeROI ( newData,
index )

add or insert ROI information into the obj.Data structure

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

Examples:

mibRoiRegion.storeROI(newData, 5); insert ROI to position 5
storeROI(obj, newData); // Call within the class. Add a ROI
function storeROI(newData, index)
add or insert ROI information into the obj.Data structure
Definition mibRoiRegion.m:597

◆ updateOptions()

function mibRoiRegion.updateOptions ( )

Update the Options structure of the class.

Examples:

obj.mibModel.I{obj.mibModel.Id}.hROI.updateOptions(); // call from mibController class

References A(), mibInputMultiDlg(), and n.

Here is the call graph for this function:

◆ updateROIposition1()

function mibRoiRegion.updateROIposition1 ( new_position)

Update ROI position during movement of imrect and imellipse.

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

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

References max.

◆ updateROIposition2()

function mibRoiRegion.updateROIposition2 ( new_position)

Update position during movement of impoly, imline.

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

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

References max.

◆ updateROIScreenPosition()

function mibRoiRegion.updateROIScreenPosition ( mode)

Updates position of ROI when plotting in mibGUI.handles.mibImageAxes.

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

Examples

Measure.updateROIScreenPosition('crop'); // update positions of all ROIs during zoom in/out
obj.updateROIScreenPosition('full'); // update positions of all ROIs during panning

References max.

Member Data Documentation

◆ Data

mibRoiRegion.Data

a new structure for ROI data .Data.label - string with a label .Data.type - type, string: imrect, imellipse, impoly, imfreehand .Data.X - X-coordinates of points .Data.Y - Y-coordinates of points .Data.orientation - orientaion of the ROI: 1-xz, 2-yz, 4-yx .Data.BoundingBox - a structire with bounding box for the current ROI .x - [xmin, xmax]; .y - [ymin, ymax]

◆ mibImage

mibRoiRegion.mibImage

handle to mibImage class

Referenced by mibRoiRegion().

◆ Options

mibRoiRegion.Options

a structure with show options .Options.marker = s; - style 1 for markers .Options.markersize = 10; - size of markers .Options.linestyle = -; - style 1 for lines .Options.linewidth = 2 ; - width for lines .Options.color = w; - color style .Options.textcolorfg = y; - text color .Options.textcolorbg = none; - color for text background .Options.fontsize = 14; - size of the font .Options.showMarkers = 1; .Options.showLines = 1; .Options.showText = 0;

◆ roi

mibRoiRegion.roi

a structure with ROI data:

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

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