# Image-to-image synchronization

**URL:** <https://community.brain-map.org/t/image-to-image-synchronization/2863>\
**Category:** Allen Brain Atlas API\
**Created:** [January 8, 2024, 4:49pm UTC](https://community.brain-map.org/t/image-to-image-synchronization/2863 "2024-01-08T16:49:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SvenOtto](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.brain-map.org/svenotto/32/893_2.png) [@SvenOtto](https://community.brain-map.org/u/SvenOtto)\
**Post date:** [January 8, 2024, 4:49pm UTC](https://community.brain-map.org/t/image-to-image-synchronization/2863/1 "2024-01-08T16:49:37Z")

</div>

- [Image-to\_Atlas](https://community.brain-map.org/t/image-to-image-synchronization/2863#image-to_atlas-1)
- [Image-to\_Image](https://community.brain-map.org/t/image-to-image-synchronization/2863#image-to_image-6)
- [Image-to-Image 2-D](https://community.brain-map.org/t/image-to-image-synchronization/2863#image-to-image-2-d-11)
- [Reference-To-Image](https://community.brain-map.org/t/image-to-image-synchronization/2863#reference-to-image-16)
- [Image-To-Reference](https://community.brain-map.org/t/image-to-image-synchronization/2863#image-to-reference-21)
- [Structure-To-Image](https://community.brain-map.org/t/image-to-image-synchronization/2863#structure-to-image-26)

![image](https://canada1.discourse-cdn.com/flex027/uploads/brainobservatory/original/2X/5/508bb704304880becc0b7ea5b97e691a6136eaaf.png) The following set of image synchronization services uses the image alignment results from the Informatics Data Processing Pipeline. Note: all locations on SectionImages are reported in pixel coordinates and all locations in 3-D ReferenceSpaces are reported in microns.

## Image-to\_Atlas

For a specified Atlas, find the closest annotated SectionImage and (x,y) location as defined by a seed SectionImage and seed (x,y) location.

### Prototype

```auto
http://api.brain-map.org/api/v2/image_to_atlas/[SectionImage.id].[xml|json]?x=[#]&y=[#]&z=[#]&atlas_id=[#]

```

### Example

For a seed location in SectionImage 68173101, locate the closest image and (x,y) position within the P56 coronal Atlas:

```auto
http://api.brain-map.org/api/v2/image_to_atlas/68173101.xml?x=6208&y=2368&atlas_id=1

```

### Parameters

| filename | Integer | Seed SectionImage for spatial sync. |
| --- | --- | --- |
| file extension | String | XML or JSON format is specified as the file extension. |
| x | Float | x pixel coordinate of the seed location in the seed SectionImage. |
| y | Float | y pixel coordinate of the seed location in the seed SectionImage. |
| atlas\_id | Integer | Target Atlas for image sync. |

### Returns

XML or JSON document containing the following:

| section\_image\_id | Closest annotated SectionImage to the seed SectionImage and pixel location. |
| --- | --- |
| section\_number | Section number of the closest SectionImage. |
| x | Closest x pixel coordinate on the closest SectionImage. |
| y | Closest y pixel coordinate on the closest SectionImage. |

## Image-to\_Image

For a list of target SectionDataSets, find the closest SectionImage and (x,y) location as defined by a seed SectionImage and seed (x,y) pixel location.

### Prototype

```auto
http://api.brain-map.org/api/v2/image_to_image/[SectionImage.id].[xml|json]?x=[#]&y=[#]&section_data_set_ids=[#,#,#...]

```

### Example

For seed location in SectionImage 68173101, locate the closest 3-D position in each input SectionDataSet.

```auto
http://api.brain-map.org/api/v2/image_to_image/68173101.xml?x=6208&y=2368&section_data_set_ids=67810540,69782969

```

### Parameters

| filename | Integer | Seed SectionImage for spatial sync. |
| --- | --- | --- |
| file extension | String | XML or JSON format is specified as the file extension. |
| x | Float | x pixel coordinate of the seed location in the seed SectionImage. |
| y | Float | y pixel coordinate of the seed location in the seed SectionImage. |
| section\_data\_set\_ids | Array | Comma delimited list of target SectionDataSet IDs for image sync. |

### Returns

XML or JSON document containing the following for each SectionDataSet in the section\_data\_set\_ids:

| section\_image\_id | Closest SectionImage to the seed SectionImage and pixel location. |
| --- | --- |
| section\_number | Section number of the closest SectionImage. |
| x | Closest x pixel coordinate on the closest SectionImage. |
| y | Closest y pixel coordinate on the closest SectionImage. |

## Image-to-Image 2-D

For a list of target SectionImages, find the closest (x,y) location as defined by a seed SectionImage and seed (x,y) location.

### Prototype

```auto
http://api.brain-map.org/api/v2/image_to_image_2d/[SectionImage.id].[xml|json]?x=[#]&y=[#]&section_image_ids=[#,#,#...]

```

### Example

For a seed location in SectionImage 68173101, locate the closest 2-D position in each input SectionImage:

```auto
http://api.brain-map.org/api/v2/image_to_image_2d/68173101.xml?x=6208&y=2368&section_image_ids=68173103,68173105,68173107

```

### Parameters

| filename | Integer | Seed SectionImage ID for image sync. |
| --- | --- | --- |
| file extension | String | XML or JSON format is specified as the file extension. |
| x | Float | x pixel coordinate of the seed location in the seed SectionImage. |
| y | Float | y pixel coordinate of the seed location in the seed SectionImage. |
| section\_image\_ids | Array | Comma delimited list of target SectionImage IDs for image sync. |

### Returns

XML or JSON document containing the following for each SectionImage in the section\_image\_ids:

| x | Closest x pixel coordinate to the seed location. |
| --- | --- |
| y | Closest y pixel coordinate to the seed location. |

## Reference-To-Image

For a list of target SectionDataSets, find the closest SectionImage and (x,y) location as defined by a (x,y,z) location in a specified ReferenceSpace.

### Prototype

```auto
http://api.brain-map.org/api/v2/reference_to_image/[ReferenceSpace.id].[xml|json]?x=[#]&y=[#]&z=[#]&section_data_set_ids=[#,#,#...]

```

### Example

For a 3-D seed location in the P56 ReferenceSpace, locate the closest image and (x,y) location for each input SectionDataSet.

```auto
http://api.brain-map.org/api/v2/reference_to_image/10.xml?x=6085&y=3670&z=4883&section_data_set_ids=68545324,67810540

```

### Parameters

| filename | Integer | Seed ReferenceSpace for spatial sync. |
| --- | --- | --- |
| file extension | String | XML or JSON format is specified as the file extension. |
| x | Float | x coordinate (in microns) of the seed location in the seed ReferenceSpace. |
| y | Float | y coordinate (in microns) of the seed location in the seed ReferenceSpace. |
| z | Float | z coordinate (in microns) of the seed location in the seed ReferenceSpace. |
| section\_data\_set\_ids | Array | Comma delimited list of target SectionDataSets IDs for image sync. |

### Returns

XML or JSON document containing the following for each SectionDataSet in the section\_data\_set\_ids:

| section\_image\_id | Closest SectionImage to the seed ReferenceSpace and location. |
| --- | --- |
| section\_number | Section number of the closest SectionImage. |
| x | Closest x pixel coordinate to the seed location. |
| y | Closest y pixel coordinate to the closest SectionImage. |

## Image-To-Reference

For a specified SectionImage and (x,y) location, return the (x,y,z) location in the ReferenceSpace of the associated SectionDataSet.

### Prototype

```auto
http://api.brain-map.org/api/v2/image_to_reference/[SectionImage.id].[xml|json]?x=[#]&y=[#]

```

### Example

For a location in SectionImage 68173101, return the (x,y,z) position in the associated ReferenceSpace.

```auto
http://api.brain-map.org/api/v2/image_to_reference/68173101.xml?x=6208&y=2368

```

RMA query to return the associated ReferenceSpace:

```auto
http://api.brain-map.org/api/v2/data/query.xml?criteria=
model::SubImage, rma::criteria,[id$eq68173101],
rma::include,data_set, 
rma::options[only$eq'data_sets.id,data_sets.reference_space_id,sub_images.id']

```

### Parameters

| filename | Integer | SectionImage.id. |
| --- | --- | --- |
| file extension | String | XML or JSON format is specified as the file extension. |
| x | Float | x pixel coordinate on the specified SectionImage. |
| y | Float | y pixel coordinate on the specified SectionImage. |

### Returns

XML or JSON document containing the (x,y,z) location in the associated ReferenceSpace.

| x | x coordinate (in microns) in the associated ReferenceSpace. |
| --- | --- |
| y | y coordinate (in microns) in the associated ReferenceSpace. |
| z | z coordinate (in microns) in the associated ReferenceSpace. |

## Structure-To-Image

For a list of target structures, find the closest SectionImage and (x,y) location as defined by the centroid of each Structure.

### Prototype

```auto
http://api.brain-map.org/api/v2/structure_to_image/[SectionDataSet.id].[xml|json]?structure_ids=[#,#,#...]

```

### Example

For each Structure in the input list, locate the closest image and (x,y) location in SectionDataSet 68545324:

```auto
http://api.brain-map.org/api/v2/structure_to_image/68545324.xml?structure_ids=315,698,1089,703,477,803,512,549,1097,313,771,354

```

### Parameters

| filename | Integer | ID of the closest SectionImage to the 3-D centroid of the structure. |
| --- | --- | --- |
| file extension | String | XML or JSON format is specified as the file extension. |
| structure\_ids | Array | List of target Structures for sync. |

### Returns

XML or JSON document containing the following for each Structure in the structure\_ids:

| section\_image\_id | Closest SectionImage to the 3-D centroid of the structure. |
| --- | --- |
| section\_number | Section number of the closest SectionImage. |
| x | Closest x pixel coordinate of the closest SectionImage. |
| y | Closest y pixel coordinate of the closest SectionImage. |
