Skip to content

Commit

Permalink
quickfix wrapup for admba, fix admba orientation/resolution
Browse files Browse the repository at this point in the history
Result of mob-programming!

Co-authored-by: Viktor Plattner <[email protected]>
Co-authored-by: sfmig <[email protected]>
  • Loading branch information
3 people committed Jul 22, 2024
1 parent af891dc commit 03c4a13
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ def create_atlas(
cleanup_files=False,
compress=True,
scale_meshes=True,
resolution_mapping=[2, 1, 0],
)
print("Done. Atlas generated at: ", output_filename)
return output_filename
Expand All @@ -319,7 +320,12 @@ def create_atlas(
atlas_link="https://search.kg.ebrains.eu/instances/8ab25629-bdac-47d0-bc86-6f3aa3885f29",
atlas_file_url="https://data.kg.ebrains.eu/zip?container=https://object.cscs.ch/v1/AUTH_4791e0a3b3de43e2840fe46d9dc2b334/ext-d000023_3Drecon-ADMBA-E11pt5_pub",
orientation="rsa",
resolution=(16, 20, 16), # possibly try 20, 16, 16
resolution=(
16,
16,
20,
), # this is in ASR, the target orientation.
# The resolution in LR is lower than SI and AP!
citation="Young et al. 2021, https://doi.org/10.7554/eLife.61408",
root_id=15564,
atlas_packager="Pradeep Rajasekhar, WEHI, Australia, "
Expand Down
19 changes: 18 additions & 1 deletion brainglobe_atlasapi/atlas_generation/wrapup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def wrapup_atlas_from_data(
cleanup_files=False,
compress=True,
scale_meshes=False,
resolution_mapping=None,
additional_references={},
additional_metadata={},
):
Expand Down Expand Up @@ -102,6 +103,9 @@ def wrapup_atlas_from_data(
If True the meshes points are scaled by the resolution
to ensure that they are specified in microns,
regardless of the atlas resolution.
resolution_mapping: list, optional
a list of three mapping the target space axes to the source axes
only needed for mesh scaling of anisotropic atlases
additional_references: dict, optional
(Default value = empty dict).
Dictionary with secondary reference stacks.
Expand Down Expand Up @@ -171,7 +175,20 @@ def wrapup_atlas_from_data(

if scale_meshes:
# Scale the mesh to the desired resolution, BEFORE transforming:
mesh.points *= resolution
# Note that this transformation happens in original space,
# but the resolution is passed in target space (typically ASR)
if not resolution_mapping:

Check warning on line 180 in brainglobe_atlasapi/atlas_generation/wrapup.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/wrapup.py#L180

Added line #L180 was not covered by tests
# isotropic case, so don't need to re-map resolution
mesh.points *= resolution

Check warning on line 182 in brainglobe_atlasapi/atlas_generation/wrapup.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/wrapup.py#L182

Added line #L182 was not covered by tests
else:
# resolution needs to be transformed back
# to original space in anisotropic case
original_resolution = (

Check warning on line 186 in brainglobe_atlasapi/atlas_generation/wrapup.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/wrapup.py#L186

Added line #L186 was not covered by tests
resolution[resolution_mapping[0]],
resolution[resolution_mapping[1]],
resolution[resolution_mapping[2]],
)
mesh.points *= original_resolution

Check warning on line 191 in brainglobe_atlasapi/atlas_generation/wrapup.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/wrapup.py#L191

Added line #L191 was not covered by tests

# Reorient points:
mesh.points = space_convention.map_points_to(
Expand Down

0 comments on commit 03c4a13

Please sign in to comment.