SVG download API help

Hi,

I’m trying to figure out how to download the reference SVG outlines from the brain atlas. We have an example working on Observable HQ

But I’m not sure how to download a different slice. I would like to download slice 90 (see below)

to approximate the slice of spatial transcriptomics data we have made available on our Vizgen deck.gl Visualizer
Applications - Vizgen (see below screenshot)

Also, if anyone knows how we might go about warping the brain atlas to our sample we’d be interested in that as well.

My question might be similar to this one: How do I download reference atlas images? - #5 by nileg

Best,
Nick

The information about downloading specific images and SVGs is found on this documentation page.

First, you need to decide what atlas you are using. The screenshot of slice 90 in your post looked like the most recent “Adult Mouse, 3D Coronal” atlas, but I believe your example on the SVG test page is from the older “Mouse, P56, Coronal” atlas.

You can query the API for all the slices (in XML format) used for the reference atlas with something like the following. I’ve based it on the example shown on the linked documentation page, but changed the atlas id to match the “Adult Mouse, 3D Coronal” atlas (id = 602630314).

http://api.brain-map.org/api/v2/data/query.xml?criteria=model::AtlasImage,
rma::criteria,
[annotated$eqtrue],
atlas_data_set(atlases[id$eq602630314]),
alternate_images[image_type$eq'Atlas+-+Adult+Mouse'],
rma::options[order$eq'sub_images.section_number'][num_rows$eqall]

The query returns the images ordered by the section number, which puts them in the same order as the atlas. You can verify that you have the same number of atlas-image entries in your query response as are in the reference atlas (132 images).

So, if you want to get the SVG for image 90 out of 132 in the reference atlas, you would go to the 90th atlas-image returned by the query and find its id attribute. Alternatively, you could specify that you want only the 90th row of the query by modifying like so:

http://api.brain-map.org/api/v2/data/query.xml?criteria=model::AtlasImage,
rma::criteria,
[annotated$eqtrue],
atlas_data_set(atlases[id$eq602630314]),
alternate_images[image_type$eq'Atlas+-+Adult+Mouse'],
rma::options[order$eq'sub_images.section_number'][num_rows$eq1][start_row$eq89]

(Note that we set the start_row option to 89, not 90, because rows are numbered starting from 0 by the API).

This particular atlas image has an ID of 576986811.

You can then get that SVG using a query similar to your test example, just using this ID instead:

http://api.brain-map.org/api/v2/svg_download/576986811?groups=28

Hope that helps!

1 Like