Skip to content

Commit

Permalink
adapt the step by step guides
Browse files Browse the repository at this point in the history
  • Loading branch information
valentin-pinkau committed Dec 10, 2024
1 parent 1d8d6f3 commit 7b38568
Show file tree
Hide file tree
Showing 11 changed files with 3 additions and 34 deletions.
35 changes: 2 additions & 33 deletions +siibra/+items/Parcellation.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
region = obj.RegionTree.Nodes.Region(index);
end
function region = getRegion(obj, regionNameQuery)
nodeId = obj.RegionTree.findnode(regionNameQuery);
region = obj.RegionTree.Nodes.Region(nodeId);
nodeIndex = find(obj.RegionTree.Nodes.RegionName == regionNameQuery);
region = obj.RegionTree.Nodes.Region(nodeIndex);
end
function children = getChildRegions(obj, region)
nodeId = obj.RegionTree.findnode(region.Id);
Expand Down Expand Up @@ -102,35 +102,4 @@
end
end


methods (Static)
function tree = createParcellationTree(parcellation, regions)
root.name = parcellation.Name;
root.children = regions;
[source, target, region] = siibra.items.Parcellation.traverseTree(parcellation, root, string.empty, string.empty, siibra.items.Region.empty);
% append root node
nodes = target;
nodes(length(nodes) + 1) = root.name;
region(length(region) + 1) = siibra.items.Region(root.name, parcellation, []);
% make nodes unique
[uniqueNodes, uniqueIndices, ~] = unique(nodes);
nodeTable = table(uniqueNodes.', region(uniqueIndices).', 'VariableNames', ["Name", "Region"]);
tree = digraph(source, target, zeros(length(target), 1), nodeTable);
end

function [source, target, regions] = traverseTree(parcellation, root, source, target, regions)
% Parses the parcellation tree.
% Recursively calls itself to parse the children of the current
% root.
% Creates a region for each node in the parcellation tree.

for childNum = 1:numel(root.children)
child = root.children(childNum);
source(length(source) + 1) = root.name;
target(length(target) + 1) = child.name;
regions(length(regions) + 1) = siibra.items.Region(child.name, parcellation, child.x_dataset_specs);
[source, target, regions] = siibra.items.Parcellation.traverseTree(parcellation, child, source, target, regions);
end
end
end
end
2 changes: 1 addition & 1 deletion +siibra/spaceOverview.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function overviewTable = spaceOverview()
spaces = siibra.spaces();
overviewTable = table([spaces.Name].', [spaces.AtlasName].', [spaces.VolumeType].', [spaces.Format].', 'VariableNames', ["Space", "Atlas", "VolumeType", "Format"]);
overviewTable = table([spaces.Name].', [spaces.AtlasName].', 'VariableNames', ["Space", "Atlas"]);
end

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified step-by-step/02_maps_and_templates/04_access_big_brain.mlx
Binary file not shown.

0 comments on commit 7b38568

Please sign in to comment.