Main Content

removeRegionValue

Remove row from ROI label

Description

removeRegionValue(lss,midx,lblname) removes all rows of the ROI label lblname for the member specified by midx.

  • If lblname is a character vector or a string scalar, the function targets a parent label.

  • If lblname is a two-element string array or a two-element cell array of character vectors, the function:

    • Interprets the first element as the name of a parent label.

    • Interprets the second element as the sublabel name of an ROI label.

    • Removes all the regions of the sublabel.

example

removeRegionValue(lss,midx,lblname,'LabelRowIndex',ridx) removes a row, specified by ridx, of the ROI label lblname for the member midx.

If lblname is a two-element string array or a two-element cell array of character vectors, the function:

  • Interprets the first element as the name of a parent label.

  • Interprets the second element as the sublabel name of an ROI label.

  • Removes all the regions of the sublabel contained in row ridx.

removeRegionValue(lss,midx,lblname,'SublabelRowIndex',sridx) removes the sublabel row specified by sridx. In this case, lblname must be a two-element string array or a two-element cell array of character vectors:

  • The first element is the name of a parent attribute label.

  • The second element is the sublabel name of an ROI label.

removeRegionValue(lss,midx,lblname,'LabelRowIndex',ridx,'SublabelRowIndex',sridx) removes the sublabel row specified by sridx of the ROI or point label row specified by ridx. In this case, lblname must be a two-element string array or a two-element cell array of character vectors:

  • The first element is the name of a parent ROI or point label.

  • The second element is the sublabel name of an ROI label.

Examples

collapse all

Load a labeled signal set containing recordings of whale songs.

load whales
lss
lss = 
  labeledSignalSet with properties:

             Source: {2×1 cell}
         NumMembers: 2
    TimeInformation: "sampleRate"
         SampleRate: 4000
             Labels: [2×3 table]
        Description: "Characterize wave song regions"

 Use labelDefinitionsHierarchy to see a list of labels and sublabels.
 Use setLabelValue to add data to the set.

Get the names and values of the labels in the set. For the following, concentrate on the second member of the set.

lbldefs = getLabelValues(lss)
lbldefs=2×3 table
                 WhaleType    MoanRegions    TrillRegions
                 _________    ___________    ____________

    Member{1}      blue       {3×2 table}    {1×3 table} 
    Member{2}      blue       {3×2 table}    {1×3 table} 

idx = 2;

Retrieve the moan and trill regions. Use a signalMask object to plot the signal and highlight the moans and trills.

mvals = getLabelValues(lss,idx,'MoanRegions');
tvals = getLabelValues(lss,idx,'TrillRegions');

tb = [mvals;tvals];
tb.Value = categorical( ...
    [repmat("moan",height(mvals),1);repmat("trill",height(tvals),1)], ...
    ["moan" "trill"]);

sm = signalMask(tb,"SampleRate",lss.SampleRate);

plotsigroi(sm,getSignal(lss,idx))

Remove the second moan from the labels. Plot the signal again. Highlight the moans and trills.

removeRegionValue(lss,idx,'MoanRegions','LabelRowIndex',2)

mvals = getLabelValues(lss,idx,'MoanRegions');

tb = [mvals;tvals];
tb.Value = categorical( ...
    [repmat("moan",height(mvals),1);repmat("trill",height(tvals),1)], ...
    ["moan" "trill"]);

sm = signalMask(tb,"SampleRate",lss.SampleRate);

plotsigroi(sm,getSignal(lss,idx))

Input Arguments

collapse all

Labeled signal set, specified as a labeledSignalSet object.

Example: labeledSignalSet({randn(100,1) randn(10,1)},signalLabelDefinition('female')) specifies a two-member set of random signals containing the attribute 'female'.

Member row number, specified as a positive integer. midx specifies the member row number as it appears in the Labels table of a labeled signal set.

Label or sublabel name. To specify a label, use a character vector or a string scalar. To specify a sublabel, use a two-element cell array of character vectors or a two-element string array:

  • The first element is the name of the parent label.

  • The second element is the name of the sublabel.

Example: signalLabelDefinition("Asleep",'LabelType','roi') specifies a label of name "Asleep" for a region of a signal in which a patient is asleep during a clinical trial.

Example: {'Asleep' 'REM'} or ["Asleep" "REM"] specifies a region of a signal in which a patient undergoes REM sleep.

Label row index, specified as a positive integer. This argument applies only for ROI and point labels.

Sublabel row index, specified as a positive integer. This argument applies only when a label and sublabel pair has been specified in lblname and the sublabel is of type ROI or point.

Introduced in R2018b