How to get a specimen stack space(volume) from an mouse ISH section dataset or get an actual coodinates of point alignment in reference space?

Dear Allen Brain Atlas Team,

In this page, API for Mouse Brain Atlas, the author write this Once registration is achieved, information from the 3-D reference model can be transferred to the reconstructed Specimen and vice versa. The resulting transform information is stored in the database. Each SectionImage has an Alignment2d object that represents the 2-D affine transform between an image pixel position and a location in the Specimen volume. Each SectionDataSet has an Alignment3d object that represents the 3-D affine transform between a location in the Specimen volume and a point in the 3-D reference model. Spatial correspondence between any two SectionDataSets from different Specimens can be established by composing these transforms.

Because I’m a beginner, here are some questions about the alignment confusing me a long time:

  1. Is the refernce space actually this 25um annotation nrrd file?

  2. How to get the spcimen volume of an ISH section dataset or other type section data set?

  3. Is the fllowing code of alignment about x,y pixel in one section image to spcimen volume right? And spcimen volume to refernce space could be implemented by similar code?


import SimpleITK as stik

RMA = RmaApi()

IDA = ImageDownloadApi()

example_secdataset_id = 69782969

example_meta_data = RMA.model_query('SectionDataSet', num_rows = 'all', criteria = f"[id$eq{example_sec_id}]", include = "alignment3d, section_images(alignment2d)")[0]

exmaple_sec_sub_image_id = example_meta_data['section_images'][0]['id']

example_alig3d = example_meta_data['alignment3d']

example_alig2d = example_meta_data['section_images'][0]['alignment2d']

IDA.download_image(exmaple_sec_sub_image_id, 'example.jpg')

example_img = sitk.ReadImage('example.jpg', sitk.sitkUInt8)

transform2d = sitk.AffineTransform(2)

ver = "tsv"

transform2d.SetParameters((example_alig2d[f'{ver}_00'], example_alig2d[f'{ver}_01'],example_alig2d[f'{ver}_02'],example_alig2d[f'{ver}_03'],example_alig2d[f'{ver}_04'],example_alig2d[f'{ver}_05']))

transform_example_img = sitk.Resample(example_img, transform2d)

Is there anybody could help me?