![]() |
Microscopy Image Browser 2.91
MIB
|
a controller class for the table views of lines 3d More...
Public Member Functions | |
mibLines3DController (mibModel) | |
function | closeWindow () |
closing mibLines3DController window | |
function | updateWidgets () |
update widgets and tables | |
function | updateEdgesViewTable (activeTreeIndex, nodeByTree) |
update edge table | |
function activeIndex = | updateNodesViewTable (activeTreeIndex, nodeByTree) |
update nodes table | |
function | edgesViewTable_CellEditCallback (eventdata) |
callback for modification of cell in edgeViewTable | |
function | nodesViewTable_CellEditCallback (eventdata) |
callback for modification of cell in nodesViewTable | |
function | settingsBtn_Callback () |
update settings for Lines3D | |
function | loadBtn_Callback () |
load annotation from a file or import from Matlab | |
function | saveBtn_Callback (treeIds) |
save annotations to a file or export to Matlab | |
function | deleteBtn_Callback () |
% function saveAnnotationsToFile(obj, Lines3D) % save Lines3D structure to a file % % Parameters: % Lines3D: a structure with fields % .G graph object, that includes Edges and Nodes fields % .Settings a structure with settings global mibPath; delete all annotations | |
function | nodesViewTable_CellSelectionCallback (Indices, forceJump) |
a callback for cell selection of obj.View.handles.nodesViewTable | |
function | edgesViewTable_CellSelectionCallback (Indices, forceJump) |
a callback for cell selection of obj.View.handles.edgesViewTable | |
function | treesViewTable_CellSelectionCallback (Indices) |
a callback for cell selection of obj.View.handles.treesViewTable | |
function | treesViewTable_CellEditCallback (Indices) |
a callback for cell edit of obj.View.handles.treesViewTable | |
function | treesViewTable_cb (parameter) |
callbacks for the context menu of obj.View.handles.treesViewTable | |
function | edgesViewTable_cb (parameter) |
callbacks for the context menu of obj.View.handles.edgesViewTable | |
function | nodesViewTable_cb (parameter, nodeId) |
callbacks for the context menu of obj.View.handles.nodesViewTable | |
function | visualizeBtn_Callback (treeId) |
callback for press of the Visualize button visualize the graph in 3D using a separate figure | |
Static Public Member Functions | |
static function | ViewListner_Callback2 (obj, src, evnt) |
Public Attributes | |
mibModel | |
handles to the model | |
View | |
handle to the view | |
listener | |
a cell array with handles to listeners | |
hAx = "[]" | |
hFig = "[]" | |
axes for the 3D visualization figure | |
hPlot = "[]" | |
a handle to 3D visualization figure | |
imarisOptions | |
a handle to a plot on 3D visualization figure a structure with export options for imaris .radii - number with default radius .color - default color [Red Green Blue Alpha] in range from 0 to 1; .name - default name | |
indicesEdges | |
indices of selected node in the in edgesViewTable | |
indicesNodes | |
indices of selected node in the in nodesViewTable | |
indicesTrees | |
indices of selected trees in the in treeViewTable | |
jScrollEdges | |
java handle to the scroll bar of obj.View.handles.edgesViewTable | |
jScrollNodes | |
java handle to the scroll bar of obj.View.handles.nodesViewTable | |
jScrollTrees | |
java handle to the scroll bar of obj.View.handles.treesViewTable | |
jEdgesTable | |
java handle to the obj.View.handles.edgesViewTable | |
jNodesTable | |
java handle to the obj.View.handles.nodesViewTable | |
jTreeTable | |
java handle to the obj.View.handles.treesViewTable | |
EVENT | closeEvent |
> Description of events event firing when window is closed | |
![]() | |
addlistener | |
Creates a listener for the specified event and assigns a callback function to execute when the event occurs. | |
notify | |
Broadcast a notice that a specific event is occurring on a specified handle object or array of handle objects. | |
delete | |
Handle object destructor method that is called when the object's lifecycle ends. | |
disp | |
Handle object disp method which is called by the display method. See the MATLAB disp function. | |
display | |
Handle object display method called when MATLAB software interprets an expression returning a handle object that is not terminated by a semicolon. See the MATLAB display function. | |
findobj | |
Finds objects matching the specified conditions from the input array of handle objects. | |
findprop | |
Returns a meta.property objects associated with the specified property name. | |
fields | |
Returns a cell array of string containing the names of public properties. | |
fieldnames | |
Returns a cell array of string containing the names of public properties. See the MATLAB fieldnames function. | |
isvalid | |
Returns a logical array in which elements are true if the corresponding elements in the input array are valid handles. This method is Sealed so you cannot override it in a handle subclass. | |
eq | |
Relational functions example. See details for more information. | |
transpose | |
Transposes the elements of the handle object array. | |
permute | |
Rearranges the dimensions of the handle object array. See the MATLAB permute function. | |
reshape | |
hanges the dimensions of the handle object array to the specified dimensions. See the MATLAB reshape function. | |
sort | |
ort the handle objects in any array in ascending or descending order. | |
a controller class for the table views of lines 3d
mibLines3DController.mibLines3DController | ( | mibModel | ) |
function mibLines3DController.closeWindow | ( | ) |
closing mibLines3DController window
References handle.isvalid, and handle.notify.
function mibLines3DController.deleteBtn_Callback | ( | ) |
% function saveAnnotationsToFile(obj, Lines3D) % save Lines3D structure to a file % % Parameters: % Lines3D: a structure with fields % .G graph object, that includes Edges
and Nodes
fields % .Settings a structure with settings global mibPath; delete all annotations
if isempty(obj.mibModel.I{obj.mibModel.Id}.hLines3D.filename) fn_out = obj.mibModel.I{obj.mibModel.Id}.meta(<tt>Filename</tt>); [path, fn_out, ext] = fileparts(fn_out); if isempty(path); path = obj.mibModel.myPath; end if isempty(fn_out) fn_out = obj.mibModel.myPath; else fn_out = sprintf(<tt>Lines_%s</tt>, fn_out); fn_out = fullfile(path, fn_out); end else fn_out = obj.mibModel.I{obj.mibModel.Id}.hLines3D.filename; end Filters = {<tt>*.lines3d</tt>, <tt>Matlab format (*.lines3d)</tt>;... <tt>*.am</tt>, <tt>Amira Spatial Graph ASCII (*.am)</tt>;... <tt>*.am</tt>, <tt>Amira Spatial Graph BINARY (*.am)</tt>;... <tt>*.xls</tt>, <tt>Excel format (*.xls)</tt>; }; [filename, path, FilterIndex] = uiputfile(Filters, <tt>Save Lines3D...</tt>, fn_out); %... if isequal(filename,0); return; end % check for cancel fn_out = fullfile(path, filename); switch Filters{FilterIndex, 2} case <tt>Matlab format (*.lines3d)</tt> saveOptions.format = <tt>lines3d</tt>; case {<tt>Amira Spatial Graph ASCII (*.am)</tt>, <tt>Amira Spatial Graph BINARY (*.am)</tt>} if strcmp(Filters{FilterIndex, 2}, <tt>Amira Spatial Graph ASCII (*.am)</tt>) saveOptions.format = <tt>amira-ascii</tt>; else saveOptions.format = <tt>amira-binary</tt>; end extraNodeFields = obj.mibModel.I{obj.mibModel.Id}.hLines3D.extraNodeFields; if ~isempty(extraNodeFields) extraNodeFieldsNumeric = obj.mibModel.I{obj.mibModel.Id}.hLines3D.extraNodeFieldsNumeric; extraNodeFields = extraNodeFields(extraNodeFieldsNumeric>0); end extraEdgeFields = obj.mibModel.I{obj.mibModel.Id}.hLines3D.extraEdgeFields; if ~isempty(extraEdgeFields) extraEdgeFieldsNumeric = obj.mibModel.I{obj.mibModel.Id}.hLines3D.extraEdgeFieldsNumeric; extraEdgeFields = extraEdgeFields(extraEdgeFieldsNumeric>0); end if ~isempty(extraEdgeFields) || ~isempty(extraNodeFields)
% add default fields extraEdgeFields = [{Length
; Weight
}; extraEdgeFields]; extraNodeFields = [{Radius
}; extraNodeFields];
selectedNode = obj.View.handles.nodesViewAdditionalField.String(obj.View.handles.nodesViewAdditionalField.Value); if numel(extraNodeFields) < 2 prompts = {Field for nodes:
; Field for edges:
}; defAns = {[extraNodeFields; find(ismember(extraNodeFields, selectedNode))]; extraEdgeFields}; else nodeId2 = find(~ismember(extraNodeFields, selectedNode)); prompts = {First field for nodes:
; Second field for nodes:
; Field for edges:
}; defAns = {[extraNodeFields; find(ismember(extraNodeFields, selectedNode))]; ... [extraNodeFields; nodeId2(1)]; ... extraEdgeFields}; end
dlgTitle = Export to Amira
; options.WindowStyle = normal
; % [optional] style of the window options.PromptLines = [1, 1]; % [optional] number of lines for widget titles options.Title = sprintf(Select fields to export
); options.TitleLines = 2; options.Focus = 1; % [optional] define index of the widget to get focus [answer, selIndex] = mibInputMultiDlg({mibPath}, prompts, defAns, dlgTitle, options); if isempty(answer); return; end if numel(extraNodeFields) < 2 outputFieldNode = extraNodeFields(selIndex(1)); outputFieldEdge = extraEdgeFields(selIndex(2)); else outputFieldNode = [extraNodeFields(selIndex(1)); extraNodeFields(selIndex(2))]; outputFieldEdge = extraEdgeFields(selIndex(3)); end else outputFieldNode = {
(only numerical fields can be exported)Radius
}; outputFieldEdge = {Weight
}; end saveOptions.NodeFieldName = outputFieldNode; saveOptions.EdgeFieldName = outputFieldEdge; case Excel format (*.xls)
saveOptions.format = excel
; end
obj.mibModel.I{obj.mibModel.Id}.hLines3D.saveToFile(fn_out, saveOptions); fprintf(Saving Lines3D to s: done!
, fn_out); return;
if strcmp(Matlab format (*.lines3d)
, Filters{FilterIndex, 2}) % matlab format save(fn_out, Lines3D
, -mat
, -v7.3
); obj.mibModel.I{obj.mibModel.Id}.hLines3D.filename = fn_out; elseif strcmp(Excel format (*.xls)
, Filters{FilterIndex, 2}) % excel format wb = waitbar(0,Please wait...
,Name
,Generating Excel file...
,WindowStyle
,modal
); warning off MATLAB:xlswrite:AddSheet
% Sheet 1 s = {sprintf(Lines3D for s
, obj.mibModel.I{obj.mibModel.Id}.meta(Filename
));}; s(2,1) = {sprintf(Lines3D filename: s
, obj.mibModel.I{obj.mibModel.Id}.hLines3D.filename)}; s(4,1) = {NODES
};
Variables = obj.mibModel.I{obj.mibModel.Id}.hLines3D.G.Nodes.Properties.VariableNames; s(6,2) = {NodeId
}; s(6,3) = {TreeName
}; s(6,4) = {NodeName
}; s(6,5) = {X
}; s(6,6) = {Y
}; s(6,7) = {Z
}; Variables(ismember(Variables, {PointsXYZ
, TreeName
, NodeName
})) = []; s(6,8:8+numel(Variables)-1) = Variables;
Units = obj.mibModel.I{obj.mibModel.Id}.hLines3D.G.Nodes.Properties.VariableUnits; if ~isempty(Units) % s(7,2:2+numel(Variables)-1) = Units; end
% sheet 2 s2 = {sprintf(Lines3D for s
, obj.mibModel.I{obj.mibModel.Id}.meta(Filename
));}; s2(2,1) = {sprintf(Lines3D filename: s
, obj.mibModel.I{obj.mibModel.Id}.hLines3D.filename)}; s2(4,1) = {EDGES
};
Variables = obj.mibModel.I{obj.mibModel.Id}.hLines3D.G.Edges.Properties.VariableNames; s2(6,2) = {EndNode1
}; s2(6,3) = {EndNode2
}; s2(6,4) = {EndNode1Name
}; s2(6,5) = {EndNode2Name
}; s2(6,6) = {Weight
}; s2(6,7) = {Length
}; Variables(ismember(Variables, {EndNodes
, Weight
, Length
, Edges
})) = []; s2(6,8:8+numel(Variables)-1) = Variables; % Units = obj.mibModel.I{obj.mibModel.Id}.hLines3D.G.Edges.Properties.VariableUnits; % if ~isempty(Units) % s2(7,2:2+numel(Variables)-1) = Units; % end
dy1 = 8; dy2 = 8; waitbar(.1, wb); nodesCount = 0; for treeId = 1:obj.mibModel.I{obj.mibModel.Id}.hLines3D.noTrees [curTree, nodeIds, EdgesTable, NodesTable] = obj.mibModel.I{obj.mibModel.Id}.hLines3D.getTree(treeId);
TreeName = curTree.Nodes.TreeName(1,:); TreeName = NodesTable.TreeName(1,:); NodeNames = NodesTable.NodeName; % store node names for generation of edges s(dy1, 1) = TreeName; [noRows, ~] = size(NodesTable); s(dy1:dy1+noRows-1, 2) = num2cell(nodeIds); s(dy1:dy1+noRows-1, 3) = NodesTable.TreeName; s(dy1:dy1+noRows-1, 4) = NodesTable.NodeName; s(dy1:dy1+noRows-1, 5:7) = [num2cell(NodesTable.PointsXYZ(:,1)), num2cell(NodesTable.PointsXYZ(:,2)), num2cell(NodesTable.PointsXYZ(:,3))]; NodesTable.TreeName = []; NodesTable.NodeName = []; NodesTable.PointsXYZ = []; [~, noCols] = size(NodesTable); s(dy1:dy1+noRows-1, 8:8+noCols-1) = table2cell(NodesTable); dy1 = dy1 + noRows;
s2(dy2, 1) = TreeName; [noRows, ~] = size(EdgesTable); s2(dy2:dy2+noRows-1, 2) = num2cell(EdgesTable.EndNodes(:,1)); s2(dy2:dy2+noRows-1, 3) = num2cell(EdgesTable.EndNodes(:,2)); s2(dy2:dy2+noRows-1, 4) = NodeNames(EdgesTable.EndNodes(:,1)-nodesCount); s2(dy2:dy2+noRows-1, 5) = NodeNames(EdgesTable.EndNodes(:,2)-nodesCount); s2(dy2:dy2+noRows-1, 6) = num2cell(EdgesTable.Weight); s2(dy2:dy2+noRows-1, 7) = num2cell(EdgesTable.Length); EdgesTable.EndNodes = []; EdgesTable.Weight = []; EdgesTable.Length = []; EdgesTable.Edges = []; % do not save Edges [~, noCols] = size(EdgesTable); s2(dy2:dy2+noRows-1, 8:8+noCols-1) = table2cell(EdgesTable); dy2 = dy2 + noRows; nodesCount = nodesCount + size(NodesTable,1); end
waitbar(.2, wb); xlswrite2(fn_out, s, Nodes
, A1
); waitbar(.7, wb); xlswrite2(fn_out, s2, Edges
, A1
);
waitbar(1, wb); delete(wb); else % Spatial graph for Amira if strcmp(Filters{FilterIndex+numel(Filters)/2}, Amira Spatial Graph ASCII (*.am)
) options.format = ascii
; else options.format = binary
; end options.overwrite = 1;
extraNodeFields = obj.mibModel.I{obj.mibModel.Id}.hLines3D.extraNodeFields; if ~isempty(extraNodeFields) extraNodeFieldsNumeric = obj.mibModel.I{obj.mibModel.Id}.hLines3D.extraNodeFieldsNumeric; extraNodeFields = extraNodeFields(extraNodeFieldsNumeric>0); end extraEdgeFields = obj.mibModel.I{obj.mibModel.Id}.hLines3D.extraEdgeFields; if ~isempty(extraEdgeFields) extraEdgeFieldsNumeric = obj.mibModel.I{obj.mibModel.Id}.hLines3D.extraEdgeFieldsNumeric; extraEdgeFields = extraEdgeFields(extraEdgeFieldsNumeric>0); end
if ~isempty(extraEdgeFields) || ~isempty(extraNodeFields) % add default fields extraEdgeFields = [{Length
; Weight
}; extraEdgeFields]; extraNodeFields = [{Radius
}; extraNodeFields];
selectedNode = obj.View.handles.nodesViewAdditionalField.String(obj.View.handles.nodesViewAdditionalField.Value); if numel(extraNodeFields) < 2 prompts = {Field for nodes:
; Field for edges:
}; defAns = {[extraNodeFields; find(ismember(extraNodeFields, selectedNode))]; extraEdgeFields}; else nodeId2 = find(~ismember(extraNodeFields, selectedNode)); prompts = {First field for nodes:
; Second field for nodes:
; Field for edges:
}; defAns = {[extraNodeFields; find(ismember(extraNodeFields, selectedNode))]; ... [extraNodeFields; nodeId2(1)]; ...
extraEdgeFields}; end dlgTitle = Export to Amira
; options.WindowStyle = normal
; % [optional] style of the window options.PromptLines = [1, 1]; % [optional] number of lines for widget titles options.Title = sprintf(Select fields to export
); options.TitleLines = 2; options.Focus = 1; % [optional] define index of the widget to get focus [answer, selIndex] = mibInputMultiDlg({mibPath}, prompts, defAns, dlgTitle, options); if isempty(answer); return; end if numel(extraNodeFields) < 2 outputFieldNode = extraNodeFields(selIndex(1)); outputFieldEdge = extraEdgeFields(selIndex(2)); else outputFieldNode = [extraNodeFields(selIndex(1)); extraNodeFields(selIndex(2))]; outputFieldEdge = extraEdgeFields(selIndex(3)); end else outputFieldNode = {
(only numerical fields can be exported)Radius
}; outputFieldEdge = {Weight
}; end options.NodeFieldName = outputFieldNode; options.EdgeFieldName = outputFieldEdge;
Lines3D.G.Nodes.XData = Lines3D.G.Nodes.PointsXYZ(:,1); Lines3D.G.Nodes.YData = Lines3D.G.Nodes.PointsXYZ(:,2); Lines3D.G.Nodes.ZData = Lines3D.G.Nodes.PointsXYZ(:,3); Lines3D.G.Nodes = removevars(Lines3D.G.Nodes, PointsXYZ
); % remove PointsXYZ Lines3D.G.Nodes.(outputFieldNode) = Lines3D.G.Nodes.(outputFieldNode); % remove PointsXYZ Lines3D.G.Nodes = removevars(Lines3D.G.Nodes, outputFieldNode); % remove PointsXYZ
% generate points for edge segments % require to have two points (starting and ending) for each % edge Lines3D.G.Edges.Points = repmat({zeros([2 6])}, [size(Lines3D.G.Edges,1) 1]); storeEdgeValues = Lines3D.G.Edges.(outputFieldEdge{1}); Lines3D.G.Edges.(outputFieldEdge{1}) = zeros([size(Lines3D.G.Edges,1) 1]); for edgeId = 1:size(Lines3D.G.Edges,1) id1 = Lines3D.G.Edges.EndNodes(edgeId,1); id2 = Lines3D.G.Edges.EndNodes(edgeId,2); Lines3D.G.Edges.Points{edgeId, :} = ... [Lines3D.G.Nodes.XData([id1 id2]), Lines3D.G.Nodes.YData([id1 id2]), Lines3D.G.Nodes.ZData([id1 id2])]; Lines3D.G.Edges.(outputFieldEdge{1})(edgeId) = storeEdgeValues(edgeId); end graph2amiraSpatialGraph(fn_out, Lines3D.G, options); end fprintf(Saving Lines3D to s: done!
, fn_out);
end
References handle.notify.
function mibLines3DController.edgesViewTable_cb | ( | parameter | ) |
callbacks for the context menu of obj.View.handles.edgesViewTable
parameter | a string with selected option |
function mibLines3DController.edgesViewTable_CellEditCallback | ( | eventdata | ) |
callback for modification of cell in edgeViewTable
function mibLines3DController.edgesViewTable_CellSelectionCallback | ( | Indices, | |
forceJump ) |
a callback for cell selection of obj.View.handles.edgesViewTable
Indices | index of the selected cell, returned by eventdata.Indices structure of GUI |
forceJump | switch 1 - jump to node, 0 - do as obj.View.handles.jumpCheck.Value indicates |
function mibLines3DController.loadBtn_Callback | ( | ) |
load annotation from a file or import from Matlab
References Lines3D.activeNodeId, handle.disp, handle.fieldnames, Lines3D.filename, Lines3D.G, mib_uigetfile(), mibInputMultiDlg(), and handle.notify.
function mibLines3DController.nodesViewTable_cb | ( | parameter, | |
nodeId ) |
callbacks for the context menu of obj.View.handles.nodesViewTable
parameter | a string with selected option |
nodeId | [optional], index of the node to jump or modify |
References mibInputDlg(), and handle.notify.
function mibLines3DController.nodesViewTable_CellEditCallback | ( | eventdata | ) |
callback for modification of cell in nodesViewTable
References handle.notify.
function mibLines3DController.nodesViewTable_CellSelectionCallback | ( | Indices, | |
forceJump ) |
a callback for cell selection of obj.View.handles.nodesViewTable
Indices | index of the selected cell, returned by eventdata.Indices structure of GUI |
forceJump | switch 1 - jump to node, 0 - do as obj.View.handles.jumpCheck.Value indicates |
function mibLines3DController.saveBtn_Callback | ( | treeIds | ) |
save annotations to a file or export to Matlab
References Lines3D.activeNodeId, Lines3D.G, Lines3D.getOptions(), mibInputDlg(), and mibInputMultiDlg().
function mibLines3DController.settingsBtn_Callback | ( | ) |
update settings for Lines3D
References mibInputMultiDlg(), and handle.notify.
function mibLines3DController.treesViewTable_cb | ( | parameter | ) |
callbacks for the context menu of obj.View.handles.treesViewTable
parameter | a string with selected option |
References mibInputDlg(), and handle.notify.
function mibLines3DController.treesViewTable_CellEditCallback | ( | Indices | ) |
a callback for cell edit of obj.View.handles.treesViewTable
Indices | index of the selected cell, returned by eventdata.Indices structure of GUI |
References handle.notify.
function mibLines3DController.treesViewTable_CellSelectionCallback | ( | Indices | ) |
function mibLines3DController.updateEdgesViewTable | ( | activeTreeIndex, | |
nodeByTree ) |
update edge table
activeTreeIndex | index of active tree |
nodeByTree | [optional], vector of indices, nodes belonging to the tree |
References min.
function activeIndex = mibLines3DController.updateNodesViewTable | ( | activeTreeIndex, | |
nodeByTree ) |
update nodes table
activeTreeIndex | index of active tree |
nodeByTree | [optional], vector of indices, nodes belonging to the tree |
activeIndex | index of tha active node |
References min.
function mibLines3DController.updateWidgets | ( | ) |
update widgets and tables
References N.
|
static |
function mibLines3DController.visualizeBtn_Callback | ( | treeId | ) |
callback for press of the Visualize button visualize the graph in 3D using a separate figure
treeId | [optional] index of tree to visualize |
References handle.disp, handle.isvalid, max, and mibInputMultiDlg().
EVENT mibLines3DController.closeEvent |
> Description of events event firing when window is closed
mibLines3DController.hAx = "[]" |
mibLines3DController.hFig = "[]" |
axes for the 3D visualization figure
Default: "[]"
mibLines3DController.hPlot = "[]" |
a handle to 3D visualization figure
Default: "[]"
mibLines3DController.imarisOptions |
a handle to a plot on 3D visualization figure a structure with export options for imaris .radii - number with default radius .color - default color [Red Green Blue Alpha] in range from 0 to 1; .name - default name
mibLines3DController.indicesEdges |
indices of selected node in the in edgesViewTable
mibLines3DController.indicesNodes |
indices of selected node in the in nodesViewTable
mibLines3DController.indicesTrees |
indices of selected trees in the in treeViewTable
mibLines3DController.jEdgesTable |
java handle to the obj.View.handles.edgesViewTable
mibLines3DController.jNodesTable |
java handle to the obj.View.handles.nodesViewTable
mibLines3DController.jScrollEdges |
java handle to the scroll bar of obj.View.handles.edgesViewTable
mibLines3DController.jScrollNodes |
java handle to the scroll bar of obj.View.handles.nodesViewTable
mibLines3DController.jScrollTrees |
java handle to the scroll bar of obj.View.handles.treesViewTable
mibLines3DController.jTreeTable |
java handle to the obj.View.handles.treesViewTable
mibLines3DController.listener |
a cell array with handles to listeners
mibLines3DController.mibModel |
handles to the model
Referenced by mibLines3DController().
mibLines3DController.View |
handle to the view