Skip to content

Commit

Permalink
Merge pull request FZJ-INM1-BDA#38 from scalableminds/visualize_parce…
Browse files Browse the repository at this point in the history
…llation_map

Visualize parcellation map
  • Loading branch information
dickscheid authored Jul 13, 2023
2 parents a448774 + c105abe commit 89e1e09
Show file tree
Hide file tree
Showing 7 changed files with 392 additions and 9 deletions.
11 changes: 11 additions & 0 deletions +siibra/+internal/API.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@
end
absoluteLink = siibra.internal.API.absoluteLinkV3(relativeLink);
end

function absoluteLink = templateForParcellationMap(spaceId, parcellationId)
arguments
spaceId string
parcellationId string
end
relativeLink = "/map/resampled_template?parcellation_id=" + parcellationId + ...
"&space_id=" + spaceId;
absoluteLink = siibra.internal.API.absoluteLinkV3(relativeLink);
end

function absoluteLink = featuresPageForParcellation(atlasId, parcellationId, page, size)
relativeLink = "/atlases/" + atlasId + ...
"/parcellations/" + parcellationId + ...
Expand Down
20 changes: 18 additions & 2 deletions +siibra/+items/+maps/ParcellationMap.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,25 @@
nifti = siibra.items.NiftiImage(obj.CachePath);
end

function visualize(obj)
function visualize(obj, colorMapName)
arguments
obj
colorMapName string = "lines"
end

template = obj.Space.loadTemplateResampledForParcellation(obj.Parcellation).normalizedData();
labelVolume = obj.fetch().loadData;
volumeViewer(labelVolume, VolumeType="Labels");

volshow(template, ...
"RenderingStyle","GradientOpacity", ...
"Alphamap", linspace(0,0.2,256), ...
"OverlayData", labelVolume, ...
"OverlayRenderingStyle", "LabelOverlay", ...
"OverlayAlphamap", linspace(0.3,1.0,256), ...
"OverlayColormap", colormap(colorMapName) ...
);


end
end
end
Expand Down
2 changes: 1 addition & 1 deletion +siibra/+items/Region.m
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function visualizeInTemplate(obj, spaceName, colormap_name)
end

space = obj.matchAgainstSpacesParcellationSupports(spaceName);
template = space.loadTemplate().normalizedData();
template = space.loadTemplateResampledForParcellation(obj.Parcellation).normalizedData();
continuousMap = obj.continuousMap(spaceName).fetch().loadData();

fig = uifigure;
Expand Down
10 changes: 10 additions & 0 deletions +siibra/+items/Space.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,15 @@
end
niftiImage = siibra.items.NiftiImage(cachedPath);
end
function niftiImage = loadTemplateResampledForParcellation(obj, parcellation)
cachedPath = siibra.internal.cache(obj.Name + "-" + parcellation.Name + ".nii.gz", "template_cache");
if ~isfile(cachedPath)
siibra.internal.API.doWebsaveWithLongTimeout( ...
cachedPath, ...
siibra.internal.API.templateForParcellationMap(obj.Id, parcellation.Id) ...
)
end
niftiImage = siibra.items.NiftiImage(cachedPath);
end
end
end
5 changes: 0 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ jobs:
- name: Run all tests
uses: matlab-actions/run-tests@v1

- name: Convert the walkthrough live script into script
uses: matlab-actions/run-command@v1
with:
command: export("walkthrough.mlx", format="m");

- name: Run walkthrough
uses: matlab-actions/run-command@v1
with:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
*.asv
screen-shots/
+siibra/cache/
walkthrough.m
Loading

0 comments on commit 89e1e09

Please sign in to comment.