Skip to content

Commit 20f2b81

Browse files
author
Ubuntu
committed
fix alignment notebook coordinate systems names
1 parent 09a0c4e commit 20f2b81

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

notebooks/examples/alignment_using_landmarks.ipynb

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,12 @@
8686
"│ └── 'transcripts': DataFrame with shape: (<Delayed>, 8) (3D points)\n",
8787
"├── Shapes\n",
8888
"│ ├── 'cell_boundaries': GeoDataFrame shape: (167780, 1) (2D shapes)\n",
89-
"│ ├── 'cell_circles': GeoDataFrame shape: (167780, 2) (2D shapes)\n",
90-
"│ └── 'xenium_landmarks': GeoDataFrame shape: (3, 2) (2D shapes)\n",
89+
"│ └── 'cell_circles': GeoDataFrame shape: (167780, 2) (2D shapes)\n",
9190
"└── Tables\n",
9291
" └── 'table': AnnData (167780, 313)\n",
9392
"with coordinate systems:\n",
94-
" ▸ 'aligned', with elements:\n",
95-
" morphology_focus (Images)\n",
9693
" ▸ 'global', with elements:\n",
97-
" morphology_focus (Images), morphology_mip (Images), transcripts (Points), cell_boundaries (Shapes), cell_circles (Shapes), xenium_landmarks (Shapes)"
94+
" morphology_focus (Images), morphology_mip (Images), transcripts (Points), cell_boundaries (Shapes), cell_circles (Shapes)"
9895
]
9996
},
10097
"execution_count": 2,
@@ -142,19 +139,16 @@
142139
"│ ├── 'CytAssist_FFPE_Human_Breast_Cancer_hires_image': DataArray[cyx] (3, 2000, 1809)\n",
143140
"│ └── 'CytAssist_FFPE_Human_Breast_Cancer_lowres_image': DataArray[cyx] (3, 600, 543)\n",
144141
"├── Shapes\n",
145-
"│ ├── 'CytAssist_FFPE_Human_Breast_Cancer': GeoDataFrame shape: (4992, 2) (2D shapes)\n",
146-
"│ └── 'visium_landmarks': GeoDataFrame shape: (3, 2) (2D shapes)\n",
142+
"│ └── 'CytAssist_FFPE_Human_Breast_Cancer': GeoDataFrame shape: (4992, 2) (2D shapes)\n",
147143
"└── Tables\n",
148144
" └── 'table': AnnData (4992, 18085)\n",
149145
"with coordinate systems:\n",
150-
" ▸ 'aligned', with elements:\n",
151-
" CytAssist_FFPE_Human_Breast_Cancer_full_image (Images), CytAssist_FFPE_Human_Breast_Cancer_hires_image (Images), CytAssist_FFPE_Human_Breast_Cancer_lowres_image (Images), CytAssist_FFPE_Human_Breast_Cancer (Shapes), visium_landmarks (Shapes)\n",
152-
" ▸ 'downscaled_hires', with elements:\n",
146+
" ▸ 'CytAssist_FFPE_Human_Breast_Cancer', with elements:\n",
147+
" CytAssist_FFPE_Human_Breast_Cancer_full_image (Images), CytAssist_FFPE_Human_Breast_Cancer_hires_image (Images), CytAssist_FFPE_Human_Breast_Cancer_lowres_image (Images), CytAssist_FFPE_Human_Breast_Cancer (Shapes)\n",
148+
" ▸ 'CytAssist_FFPE_Human_Breast_Cancer_downscaled_hires', with elements:\n",
153149
" CytAssist_FFPE_Human_Breast_Cancer_hires_image (Images), CytAssist_FFPE_Human_Breast_Cancer (Shapes)\n",
154-
" ▸ 'downscaled_lowres', with elements:\n",
155-
" CytAssist_FFPE_Human_Breast_Cancer_lowres_image (Images), CytAssist_FFPE_Human_Breast_Cancer (Shapes)\n",
156-
" ▸ 'global', with elements:\n",
157-
" CytAssist_FFPE_Human_Breast_Cancer_full_image (Images), CytAssist_FFPE_Human_Breast_Cancer_hires_image (Images), CytAssist_FFPE_Human_Breast_Cancer_lowres_image (Images), CytAssist_FFPE_Human_Breast_Cancer (Shapes), visium_landmarks (Shapes)"
150+
" ▸ 'CytAssist_FFPE_Human_Breast_Cancer_downscaled_lowres', with elements:\n",
151+
" CytAssist_FFPE_Human_Breast_Cancer_lowres_image (Images), CytAssist_FFPE_Human_Breast_Cancer (Shapes)"
158152
]
159153
},
160154
"execution_count": 3,
@@ -282,12 +276,14 @@
282276
"outputs": [],
283277
"source": [
284278
"from spatialdata.models import ShapesModel\n",
279+
"from spatialdata.transformations import Identity\n",
285280
"\n",
286281
"visium_landmarks = ShapesModel.parse(\n",
287-
" np.array([[10556.699, 7829.764], [13959.155, 13522.025], [10621.200, 17392.116]]), geometry=0, radius=500\n",
282+
" np.array([[10556.699, 7829.764], [13959.155, 13522.025], [10621.200, 17392.116]]), geometry=0, radius=500, transformations={'CytAssist_FFPE_Human_Breast_Cancer': Identity()}\n",
288283
")\n",
289284
"visium_sdata[\"visium_landmarks\"] = visium_landmarks\n",
290285
"\n",
286+
"# for Xenium data, the data is aligned to the 'global' coordinate system as with can see with print(xenium_sdata), so there is no need to specify transformations in .parse()\n",
291287
"xenium_landmarks = ShapesModel.parse(\n",
292288
" np.array([[9438.385, 13933.017], [24847.866, 5948.002], [34082.584, 15234.235]]), geometry=0, radius=500\n",
293289
")\n",
@@ -389,7 +385,7 @@
389385
" reference_element=xenium_sdata[\"morphology_focus\"],\n",
390386
" moving_element=visium_sdata[\"CytAssist_FFPE_Human_Breast_Cancer_full_image\"],\n",
391387
" reference_coordinate_system=\"global\",\n",
392-
" moving_coordinate_system=\"global\",\n",
388+
" moving_coordinate_system=\"CytAssist_FFPE_Human_Breast_Cancer\",\n",
393389
" new_coordinate_system=\"aligned\",\n",
394390
")\n",
395391
"affine"
@@ -571,7 +567,7 @@
571567
"name": "python",
572568
"nbconvert_exporter": "python",
573569
"pygments_lexer": "ipython3",
574-
"version": "3.11.0"
570+
"version": "3.10.0"
575571
},
576572
"vscode": {
577573
"interpreter": {

0 commit comments

Comments
 (0)