Microscopy Image Browser  1.233
All Classes Files Functions Variables Pages
roiRegion Class Reference

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

Inheritance diagram for roiRegion:
Collaboration diagram for roiRegion:

Public Member Functions

 roiRegion (hImg)
 Constructor for the class. More...
 
function  clearContents ()
 Set all elements of the class to default values. More...
 
function  addROI (handles, type, index, coordinates, noPoints)
 Adds ROI. More...
 
function  imfreehandFun (handles, index)
 Adds impoly type of ROI using imfreehand tool. More...
 
function  impolyFun (handles, index, coordinates, noPoints)
 Adds impoly type of ROI. More...
 
function  imrectFun (handles, index, coordinates)
 Adds imrect type of ROI. More...
 
function  imellipseFun (handles, index, coordinates)
 Adds imellipse type of ROI. More...
 
function  storeROI (newData, index)
 add or insert ROI information into the obj.Data structure More...
 
function  removeROI (index)
 removeROI(obj, index) Remove ROI(s) from the class More...
 
function [ number ,

indices ] = 
getNumberOfROI (orientation)
 [number, indices] = getNumberOfROI(obj, orientation) Get number of stored ROI More...
 
function  setDefaultOptions ()
 Set all values of the Options structure of the class to default values. More...
 
function  updateOptions ()
 Update the Options structure of the class. More...
 
function  resample (resampledRatio)
 Recalculation of ROI position during image resampling. More...
 
function  crop (cropF)
 Recalculation of ROI position during image crop. More...
 
function [
position ,
screenPosition ] = 
drawROI (handles, type, pos, instant)
 draw a ROI object in the handles.imageAxes More...
 
function  updateROIposition1 (new_position)
 Update ROI position during movement of imrect and imellipse. More...
 
function  updateROIposition2 (new_position)
 Update position during movement of impoly, imline. More...
 
function
handles = 
addROIsToPlot (handles, mode)
 plot ROIs above the imageAxes of im_browser More...
 
function mask = returnMask (index, Height, Width, orient, blockModeSwitch)
 Return a bitmap mask of the specified ROI. More...
 
function  updateROIScreenPosition (mode)
 Updates position of ROI when plotting in handles.imageAxes. More...
 

Public Attributes

 roi
 a structure with ROI data: More...
 
 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 More...
 
 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; More...
 
 hImg
 handle to imageData class More...
 

Detailed Description

class is resposnible to keep regions of interest (ROI)

Constructor & Destructor Documentation

roiRegion.roiRegion (   hImg)

Constructor for the class.

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

Parameters
hImg- handle to imageData class

References hImg.

Member Function Documentation

function roiRegion.addROI (   handles,
  type,
  index,
  coordinates,
  noPoints 
)

Adds ROI.

Parameters
handleshandles structure of im_browser
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:

handles.Img{handles.Id}.I.hROI.addROI(handles, 'imrect'); // Add a new imrect ROI
handles.Img{handles.Id}.I.hROI.addROI(handles, [], 3); // Modify the 3rd ROI
function handles = roiRegion.addROIsToPlot (   handles,
  mode 
)

plot ROIs above the imageAxes of im_browser

Parameters
handleshandles structure of im_browser.m
modea string that defines a mode of the shown image: shown (in most cases), or full (for panning)
Required fields of handles:

Examples:

handles = handles.Img{handles.Id}.I.hMeasure.addROIsToPlot(handles, 'shown'); // to show the measurements above the image in the imageData.plotImage function
handles = handles.Img{handles.Id}.I.hMeasure.addROIsToPlot(handles, 'full'); // to show the measurements above the image in the im_browser_WindowButtonDownFcn function
function roiRegion.clearContents ( )

Set all elements of the class to default values.

Examples:

clearContents(obj); // Call within the class

Examples:

roiRegion.clearData();
clearData(obj); // Call within the class

Examples:

handles.Img{handles.Id}.I.hROI.findIndexByLabel('ROI 1'); // Return index of the ROI that has 'ROI 1' label
function roiRegion.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 = roiRegion.crop(cropF); // crop ROIs
indices = remove(obj, cropF); // Call within the class; crop ROIs
function [ position , screenPosition ] = roiRegion.drawROI (   handles,
  type,
  pos,
  instant 
)

draw a ROI object in the handles.imageAxes

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

Parameters
handleshandles structure of im_browser.m
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 handles:

Examples:

position = roiRegion.drawROI(handles, 'imline', [10, 10; 50, 50]); // draw a line
position = drawROI(obj, handles, 'imline', [10, 10; 50, 50]);; // Call within the class; draw a line
function [ number , indices ] = roiRegion.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 = roiRegion.getNumberOfROI(4); // get the total number of ROIs for the XY orientation
number = getNumberOfROI(obj); // Call within the class; get the total number
function roiRegion.imellipseFun (   handles,
  index,
  coordinates 
)

Adds imellipse type of ROI.

Parameters
handleshandles structure of im_browser
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 handles:

Examples:

handles.Img{handles.Id}.I.hROI.imellipseFun(handles, 5); // Add a new imellipse ROI to position 5
handles.Img{handles.Id}.I.hROI.imellipseFun(handles, 5, [100, 150, 250, 350]); // Add a new imellipse ROI to position 5; x1=100, x2=150, radiusX=250; radiusY=350

References getClickPoint().

Here is the call graph for this function:

function roiRegion.imfreehandFun (   handles,
  index 
)

Adds impoly type of ROI using imfreehand tool.

Parameters
handleshandles structure of im_browser
indexindex of the ROI. If not empty will allow to modify a ROI with the provided index

Examples:

handles.Img{handles.Id}.I.hROI.imfreehandFun(handles, 5); // Add a new impoly ROI to position 5

References mib_inputdlg().

Here is the call graph for this function:

function roiRegion.impolyFun (   handles,
  index,
  coordinates,
  noPoints 
)

Adds impoly type of ROI.

Parameters
handleshandles structure of im_browser
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 handles:

Examples:

handles.Img{handles.Id}.I.hROI.impolyFun(handles, [], [], 5); // Add a new impoly ROI with 5 vertices
handles.Img{handles.Id}.I.hROI.impolyFun(handles, 5, [100, 150; 250, 350; 50, 150]); // Add impoly ROI to position 5; with specified vertices

References getClickPoint().

Here is the call graph for this function:

function roiRegion.imrectFun (   handles,
  index,
  coordinates 
)

Adds imrect type of ROI.

Parameters
handleshandles structure of im_browser
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 handles:

Examples:

handles.Img{handles.Id}.I.hROI.imrectFun(handles, 5); // Add a new imrect ROI to position 5
handles.Img{handles.Id}.I.hROI.imrectFun(handles, 5, [100, 150, 250, 350]); // Add a new imrect ROI to position 5; x1=100, x2=150, width=250; height=350

References getClickPoint().

Here is the call graph for this function:

function roiRegion.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 roiRegion.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 = roiRegion.resample(resampledRatio); // resample ROIs
indices = resample(obj, resampledRatio); // Call within the class; resample ROIs
function mask = roiRegion.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 = roiRegion.returnMask(new_position, 1); // get mask of ROI number 1
mask = returnMask(obj, 0); // Call within the class; get combined mask of all shown ROIs

References ib_connectPoints().

Here is the call graph for this function:

function roiRegion.setDefaultOptions ( )

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

Examples:

setDefaultOptions(obj); // Call within the class
function roiRegion.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
n[optional] position where to add the measurement, default - number of measurements in obj.Data + 1

Examples:

roiRegion.storeROI(newData, 5); insert ROI to position 5
storeROI(obj, newData); // Call within the class. Add a ROI
function roiRegion.updateOptions ( )

Update the Options structure of the class.

Examples:

handles.Img{handles.Id}.I.hROI.updateOptions();
updateOptions(obj); // Call within the class
function roiRegion.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]
function roiRegion.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]
function roiRegion.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

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

Member Data Documentation

roiRegion.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

Referenced by mibmeasureTool>saveBtn_Callback(), and roiSaveBtn_Callback().

roiRegion.hImg

handle to imageData class

Referenced by roiRegion().

roiRegion.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;

Referenced by classRF_train(), get_black_white_filter(), ib_anisotropicDiffusion(), menuModelsSaveAs(), model_cm_Callback(), and regRF_train().

roiRegion.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

Referenced by do_andiff_filtering(), do_andiff_filtering_backup(), do_diplib_andiff_filtering(), ib_anisotropicDiffusion(), ib_autoBrightness(), ib_linearContrast(), ib_smoothImage(), imageFilterDoitBtn_Callback(), menuImageIntensity(), menuImageProfileArbitrary_Callback(), menuImageProfileLine_Callback(), menuMaskInvert(), menuSelectionInvert(), and menuToolsMeasure().


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