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

class is responsible for keeping Labels/Annotations of the model More...

Inheritance diagram for Labels:
Collaboration diagram for Labels:

Public Member Functions

 Labels ()
 Constructor for the class.
 
function  clearContents ()
 Set all elements of the class to default values.
 
function  addLabels (labels, positions, values)
 Add labels with positions to the class.
 
function  crop (cropF)
 Recalculation of annotation positions during image crop.
 
function [ labelsList , labelValues , labelPositions , indices ] = getCurrentSliceLabels ()
 [labelsList, labelValues, labelPositions, indices] = getCurrentSliceLabels(obj) Get list of labels shown at the current slice
 
function [ labelsList , labelValues , labelPositions , indices ] = getLabels (rangeZ, rangeX, rangeY, rangeT)
 Get list of labels.
 
function [ labels , values , positions , indices ] = getLabelsById (labelId)
 Get labels using labelId.
 
function labelsNumber = getLabelsNumber ()
 Get total number of labels.
 
function [ labelsList , labelValues , labelPositions , indices ] = getSliceLabels (handles, sliceNumber, timePoint)
 [labelsList, labelValues, labelPositions, indices] = getSliceLabels(obj, handles, sliceNumber, timePoint) Get list of labels shown at the specified slice
 
function [ minZ , labelIds ] = getMinValueZ ()
 find and return the minimum Z value for all annotations as well as their indices
 
function [ maxZ , labelIds ] = getMaxValueZ ()
 find and return the maximum Z value for all annotations as well as their indices
 
function  removeLabels (labels)
 removeLabels(obj, labels) Remove specified labels
 
function result = renameLabels (oldLabel, newLabelText)
 Rename specified labels with new text.
 
function  replaceLabels (labels, positions, values)
 replaceLabels(obj, labels, positions, values) Replace existing labels with a new list of labels and their values
 
function result = updateLabels (oldLabel, newLabelText, newLabelPos, newLabelValues)
 Update specified labels with newLabels.
 
function  saveToFile (filename, options)
 save Labels to a file
 
function  sortLabels (sortBy, direction)
 Resort the list of annotation labels.
 

Public Attributes

 labelText
 a cell array with labels
 
 labelValue
 an array with values for labels
 
 labelPosition
 a matrix with coordinates of the labels [pointIndex, z x y t]
 

Detailed Description

class is responsible for keeping Labels/Annotations of the model

Constructor & Destructor Documentation

◆ Labels()

Labels.Labels ( )

Constructor for the class.

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

Member Function Documentation

◆ addLabels()

function Labels.addLabels ( labels,
positions,
values )

Add labels with positions to the class.

Parameters
labelsa cell array with labels
positionsa matrix with coordinates of the labels [pointIndex, z x y t]
valuesan array of numbers with values for the labels [optional], default = 1 Return values:

Examples:

labels{1} = 'my label 1';
labels{2} = 'my label 2';
positions(1,:) = [50, 75, 1, 3]; // position 1: z=1, x=50, y=75, t=3;
positions(2,:) = [50, 75, 2, 5]; // position 1: z=2, x=50, y=75, t=5;
obj.mibModel.I{obj.mibModel.Id}.hLabels.addLabel(labels, positions); // add a labels to the list, call from mibController
addLabel(obj, labels, positions); // Call within the class; add a labels to the list

◆ clearContents()

function Labels.clearContents ( )

Set all elements of the class to default values.

Examples:

obj.mibModel.I{obj.mibModel.Id}.hLabels.clearContents();
clearContents(obj); // Call within the class
function clearContents()
Set all elements of the class to default values.
Definition Labels.m:66

◆ crop()

function Labels.crop ( cropF)

Recalculation of annotation positions during image crop.

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

Examples:

cropF = [100 512 200 512 5 20 7 15]; // define parameters of the crop
cropF2 = [100 512 NaN NaN 5 NaN 7 NaN]; // alternative definition of parameters for the crop
obj.mibModel.I{obj.mibModel.Id}.hLabels.crop(cropF); // adjust coordinates due to cropping
Attention
parameters dx, dy, dz, dt are not used, so they can be replaced with NaNs

◆ getCurrentSliceLabels()

function [ labelsList , labelValues , labelPositions , indices ] = Labels.getCurrentSliceLabels ( )

[labelsList, labelValues, labelPositions, indices] = getCurrentSliceLabels(obj) Get list of labels shown at the current slice

Note
replaced with mibImage.getSliceLabels
Return values
labelsLista cell array with labels
labelPositionsa matrix with coordinates of the labels [labelIndex, z x y t]
indicesindices of the labels

Examples:

[labelsList, labelPositions, indices] = LabelsInstance.getCurrentSliceLabels(); // get all labels from the currently shown slice
[labelsList, labelPositions, indices] = getCurrentSliceLabels(obj); // Call within the class; get all labels from the currently shown slice
function [ labelsList , labelValues , labelPositions , indices ] = getCurrentSliceLabels()
[labelsList, labelValues, labelPositions, indices] = getCurrentSliceLabels(obj) Get list of labels sh...
Definition Labels.m:169

Referenced by getSliceLabels().

Here is the caller graph for this function:

◆ getLabels()

function [ labelsList , labelValues , labelPositions , indices ] = Labels.getLabels ( rangeZ,
rangeX,
rangeY,
rangeT )

Get list of labels.

Parameters
rangeZ[optional] define range of labels to retrieve for Z [minZ maxZ], can be NaN
rangeX[optional] define range of labels to retrieve for X [minX maxX], can be NaN
rangeY[optional] define range of labels to retrieve for Y [minY maxY], can be NaN
rangeT[optional] define range of labels to retrieve for T [minT maxT], can be NaN
Return values
labelsLista cell array with labels
labelValuesan array of numbers with values
labelPositionsa matrix with coordinates of the labels [labelIndex, z x y t]
indicesindices of the labels

Examples:

[labelsList, labelValues, labelPositions, indices] = obj.mibModel.I{obj.mibModel.Id}.hLabels.getLabels(); // get all labels
[labelsList, labelValues, labelPositions, indices] = obj.mibModel.I{obj.mibModel.Id}.hLabels.getLabels(50); // get all labels from slice 50
[labelsList, labelValues, labelPositions, indices] = obj.mibModel.I{obj.mibModel.Id}.hLabels.getLabels(obj, 50); // Call within the class; get all labels from slice 50

◆ getLabelsById()

function [ labels , values , positions , indices ] = Labels.getLabelsById ( labelId)

Get labels using labelId.

Parameters
labelIda variable or a vector with an old label to be updated:
  • a single number or a column of numbers: remove label that have index equal to the number
  • a matrix: remove all labels that have coordinates specified in the matrix [labelIndex, z x y t]
  • a cell array: remove all labels that have text specified in the cell array newLabelText, a cell or a char string with new text for the label
Return values
labels- cell array with labels of annotations
values- array with values of annotations
positions- a matrix with coordinates (index; z,x,y,t)
indices- array with indices of annoations | Examples:
labelIds = [5, 7, 10]';
[labels, values, positions, id] = obj.mibModel.I{obj.mibModel.Id}.hLabels.getLabelsById(labelIds); // call from mibController, get labels with indices 5, 7, 10

◆ getLabelsNumber()

function labelsNumber = Labels.getLabelsNumber ( )

Get total number of labels.

Return values
labelsNumbera number of labels

Examples:

labelsNumber = obj.mibModel.I{obj.mibModel.Id}.hLabels.getLabelsNumber(); // get number of labels
labelsNumber = getLabelsNumber(obj); // Call within the class; get number of labels
function labelsNumber = getLabelsNumber()
Get total number of labels.
Definition Labels.m:354

◆ getMaxValueZ()

function [ maxZ , labelIds ] = Labels.getMaxValueZ ( )

find and return the maximum Z value for all annotations as well as their indices

Return values
maxZvalue of max Z for all annotations
labelIdsindices of those annotations

References max.

◆ getMinValueZ()

function [ minZ , labelIds ] = Labels.getMinValueZ ( )

find and return the minimum Z value for all annotations as well as their indices

Return values
minZvalue of min Z for all annotations
labelIdsindices of those annotations

References min.

◆ getSliceLabels()

function [ labelsList , labelValues , labelPositions , indices ] = Labels.getSliceLabels ( handles,
sliceNumber,
timePoint )

[labelsList, labelValues, labelPositions, indices] = getSliceLabels(obj, handles, sliceNumber, timePoint) Get list of labels shown at the specified slice

Parameters
handlesa handles structure of im_browser
sliceNumber[optional], a slice number to get labels
timePoint[optional], a time point to get the labels
Return values
labelsLista cell array with labels
labelPositionsa matrix with coordinates of the labels [labelIndex, z x y]
indicesindices of the labels
Required fields of handles:

Examples:

[labelsList, labelPositions, indices] = obj.mibModel.I{obj.mibModel.Id}.hLabels.getSliceLabels(handles, 15); // get all labels from the slice 15
[labelsList, labelPositions, indices] = getSliceLabels(obj, handles); // Call within the class; get all labels from the currently shown slice
function [ labelsList , labelValues , labelPositions , indices ] = getSliceLabels(handles, sliceNumber, timePoint)
[labelsList, labelValues, labelPositions, indices] = getSliceLabels(obj, handles, sliceNumber,...
Definition Labels.m:370

References getCurrentSliceLabels().

Here is the call graph for this function:

◆ removeLabels()

function Labels.removeLabels ( labels)

removeLabels(obj, labels) Remove specified labels

Parameters
labelsa variable or a vector with a label:
  • omitted: remove all labels
  • a single number or a column of numbers: remove label that have index equal to the number
  • a matrix: remove all labels that have coordinates specified in the matrix [labelIndex, z x y t]
  • a cell array: remove all labels that have text specified in the cell array

Examples:

labels{1} = 'my label 1';
obj.mibModel.I{obj.mibModel.Id}.hLabels.removeLabels(labels); // remove annotations that match labels
removeLabels(obj, labels); // Call within the class; remove annotations that match labels
function removeLabels(labels)
removeLabels(obj, labels) Remove specified labels
Definition Labels.m:446

◆ renameLabels()

function result = Labels.renameLabels ( oldLabel,
newLabelText )

Rename specified labels with new text.

Parameters
oldLabela variable or a vector with an old label to be updated:
  • a single number or a column of numbers: remove label that have index equal to the number
  • a matrix: remove all labels that have coordinates specified in the matrix [labelIndex, z x y t]
  • a cell array: remove all labels that have text specified in the cell array
newLabelTexta cell or a char string with new text for the label
Return values
resultresult of the function work: 1 - good, 0 - bad

Examples:

oldLabelId = [5, 7, 10]';
label{1} = 'my label 1';
obj.mibModel.I{obj.mibModel.Id}.hLabels.renameLabels(oldLabelId, label); // call from mibController, rename labels with indices 5, 7, 10

◆ replaceLabels()

function Labels.replaceLabels ( labels,
positions,
values )

replaceLabels(obj, labels, positions, values) Replace existing labels with a new list of labels and their values

Parameters
labelsa cell array with labels
positionsa matrix with coordinates of the labels [pointIndex, z x y t]
valuesan array of numbers with values of the labels, [optional] default = 1

Examples:

labels{1} = 'my label 1';
labels{2} = 'my label 2';
positions(1,:) = [1, 50, 75, 5]; // position 1: x=50, y=75, z=1,t=5;
positions(2,:) = [2, 50, 75, 6]; // position 1: x=50, y=75, z=2, t=6;
obj.mibModel.I{obj.mibModel.Id}.hLabels.replaceLabels(labels, positions); // replace labels with a new list
replaceLabels(obj, labels, positions); // Call within the class; replace labels with a new list
function replaceLabels(labels, positions, values)
replaceLabels(obj, labels, positions, values) Replace existing labels with a new list of labels and t...
Definition Labels.m:565

Referenced by mibAnnotationsController.loadBtn_Callback().

Here is the caller graph for this function:

◆ saveToFile()

function Labels.saveToFile ( filename,
options )

save Labels to a file

Parameters
filenamefull path to file
optionsa structure with optional paramters .format - a char string ann - MIB annotation format landmarksAscii - amira landmarks in the ascii format landmarksBin - amira landmarks as binaries psi - PSI format ASCII xls - Microsoft Excel format .showWaitbar - [optional] a number 1-show; 0-do not show the waitbar .outputDir - [optional] output directory .convertToUnits - [optional] a logical, or not convert pixel coordinates to the units requires bounding box and pixSize information .boundingBox - a matrix [x1 width y1 height z1 depth], required for conversion to units .pixSize - a MIB structure with pixel sizes .labelText - [optional], instead of obj.labelText save provided labelText .labelPosition - [optional], instead of obj.labelPosition save provided labelPosition .labelValue - [optional], instead of obj.labelValue save provided labelValue .sliceNames - [optional], cell array with filenames, used for export to excel and csv .addLabelToFilename - [optional], logical add annotation label to filename, default = false
Required fields of options:

References labelPosition, labelText, labelValue, points2amiraLandmarks(), points2psi(), and xlswrite2().

Here is the call graph for this function:

◆ sortLabels()

function Labels.sortLabels ( sortBy,
direction )

Resort the list of annotation labels.

Parameters
sortBya string with the field to be used for sorting
  • name, default sort by the label name
  • value, sort by value
  • x, sort by the X coordinate
  • y, sort by the Y coordinate
  • z, sort by the Z coordinate
  • t, sort by the T coordinate
directiona string with sorting direction
  • ascend, default sort in the ascending order
  • descend, sort in the descending order

Examples:

obj.mibModel.I{obj.mibModel.Id}.hLabels.sortLabels(); // call from mibController, sort the list by the label name
obj.mibModel.I{obj.mibModel.Id}.hLabels.sortLabels('name', 'descend'); // call from mibController, sort the list by the label name using descending order

◆ updateLabels()

function result = Labels.updateLabels ( oldLabel,
newLabelText,
newLabelPos,
newLabelValues )

Update specified labels with newLabels.

Parameters
oldLabela variable or a vector with an old label to be updated:
  • a single number or a column of numbers: remove label that have index equal to the number
  • a matrix: remove all labels that have coordinates specified in the matrix [labelIndex, z x y t]
  • a cell array: remove all labels that have text specified in the cell array
newLabelTexta cell or a char string with new text for the label
newLabelPoscoordinates of the new label [z, x, y]
newLabelValuesan array of numbers with values of the labels, [optional] default = 1
Return values
resultresult of the function work: 1 - good, 0 - bad

Examples:

label{1} = 'my label 1';
newPosition(1,:) = [50, 75, 1, 5]; // position 1: x=50, y=75; z=1, t=5
obj.mibModel.I{obj.mibModel.Id}.hLabels.updateLabels(label, label, newPosition); // call from mibController, update coordinates of a label that has "my label 1" text

Member Data Documentation

◆ labelPosition

Labels.labelPosition

a matrix with coordinates of the labels [pointIndex, z x y t]

Referenced by saveToFile().

◆ labelText

Labels.labelText

a cell array with labels

Referenced by saveToFile().

◆ labelValue

Labels.labelValue

an array with values for labels

Referenced by saveToFile().


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