Skip to content

Commit

Permalink
Behnam: registration, done
Browse files Browse the repository at this point in the history
  • Loading branch information
behnam-yousefi committed Aug 27, 2024
1 parent 0bcb6e8 commit d180805
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions notebooks/03_image_registration/plot_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,46 @@
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "de054d59-620c-4b6b-8826-0e11f25380d4",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 28,
"id": "6724f98c-26fa-4c94-84f3-cb3d4d7822c9",
"metadata": {},
"outputs": [],
"source": [
"adata_dir = \"data_level_1/adata/\"\n",
"he_image_dir = \"data_level_1/he_registered_old/\"\n",
"save_dir = \"data_level_1/adata_with_he/\""
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2535521a-dfaf-44f8-ba78-bb79ea60d2f5",
"metadata": {},
"outputs": [],
"source": [
"for sample in tqdm(range(1:57)):\n",
"\n",
" sample = f\"X{sample}\"\n",
" adata = sc.read_h5ad(adata_dir + f'{sample}.h5ad')\n",
" he_image = plt.imread(he_image_dir + f'{sample}.tiff')\n",
"\n",
" slide_id = adata.obs['Slide_ID'][0]\n",
" adata.uns['spatial'][slide_id]['images']['he_downscaled_aligned'] = he_image \n",
" adata.uns['spatial'][slide_id]['scalefactors']['tissue_he_downscaled_aligned_scalef'] = 1\n",
"\n",
" adata.write_h5ad(save_dir + f'{sample}.h5ad')"
]
}
],
"metadata": {
Expand Down

0 comments on commit d180805

Please sign in to comment.