Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
855b69a
Fix missing GDAL and dependencies
newmana Apr 19, 2024
28305e9
Add how to create conda environment
newmana Apr 19, 2024
b5bd0dd
Test.
newmana Apr 22, 2024
5369908
.
newmana Apr 22, 2024
b473167
.
newmana Apr 23, 2024
5139fa6
Fix for ICU.
newmana Apr 23, 2024
9497262
Fix deprecation warning.
newmana Apr 23, 2024
867b5f1
Add how to generate a transformation matrix.
newmana Apr 24, 2024
09c6e34
Make .py files executable and add alignment script and instructions
newmana Apr 24, 2024
e8244e3
.
newmana Apr 24, 2024
61b455d
.
newmana Apr 24, 2024
82dad4f
Improve instructions
newmana Apr 24, 2024
f4341ca
Use new API
newmana Apr 24, 2024
d2531a8
Use new API for spatialdata
newmana Apr 24, 2024
1ecd1be
Reformat.
newmana Apr 24, 2024
b1d22ad
Display remove vs total files and improve logic
newmana Apr 24, 2024
a604a41
Show previous spatialdata api usage
newmana Apr 24, 2024
ede45a9
Show previous spatialdata api usage
newmana Apr 24, 2024
5b927f1
Save working 0.0.9 version.
newmana Apr 25, 2024
3fc03dc
Save working 0.0.9 version.
newmana Apr 25, 2024
b345c2b
Set to use 0.0.9 of spatial data
newmana Apr 25, 2024
181c83c
Merge branch 'andrew_n_hovernet' of github.com:BiomedicalMachineLearn…
newmana Apr 25, 2024
5965c71
Using spatialdata 0.0.9 as default.
newmana Apr 25, 2024
4aca780
.
newmana Apr 25, 2024
c56a012
.
newmana Apr 26, 2024
d202b31
Fix formatting.
newmana Apr 26, 2024
5b69b0d
Working
newmana Apr 26, 2024
1707e81
Merge branch 'andrew_n_hovernet' of github.com:BiomedicalMachineLearn…
newmana Apr 26, 2024
9661716
Cleanup and get pipeline for creating masks into notebook
newmana Apr 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 32 additions & 3 deletions development/Xenium_classification/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,20 @@ The following data are required for each training sample (sequenced whole slide
Additionally, a single-cell reference atlas is needed to generate the cell type labels.

### 0. Installation

Modules to load:
```commandline
$ module load gcc/12 # Otherwise ICU with fail with OSError: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.30' not found
```

The `environment.yml` contains the required dependencies for the conda environment.

Example:
```commandline
$ conda env create --prefix /scratch/project_mnt/andrew/conda/hovernet --file /scratch/project_mnt/andrew/STimage/development/Xenium_classification/environment.yml
$ conda activate hovernet
```

Computing performance metrics relies on some code from https://github.com/meszlili96/PanNukeChallenge. This repository should be cloned into the same folder as this source.


Expand All @@ -22,20 +34,37 @@ These labels are then processed and stored into an anndata object for the Xenium

```
python load_annotations.py --xenium XENIUM_DIR --annotated ANNOTATED_PATH --out-dir OUT_DIR

```

Alternatively, the labels can be provided in the form of a geopandas dataframe. See `generate_masks.py` for details.


### 2. Register H&E image
The H&E image must be registered to the Xenium DAPI data, which can be done with SIFT or similar methods. An affine transformation matrix should be saved as a csv file, with the standard 2x3 format. Example:
### 2. Register H&E image and Alignment

The full-color H&E image must be registered to the Xenium DAPI data to ensure proper alignment between the morphological information and the spatial gene expression data.

Two ways to perform the registration:
* Using Xenium Explorer:
- You can use Xenium Explorer to produce a transformation matrix and keypoints:
https://www.10xgenomics.com/support/software/xenium-explorer/latest/tutorials/xe-image-alignment
* Using the register.py script:
- Provide a greyscale DAPI TIFF image.
- Using OpenCV it generates the keypoints and transformation matrix.

An affine transformation matrix should be saved as a csv file, with the standard 2x3 format. Example:

```
-0.002511365031637, -0.776020225795623, 27762.2568957
0.775820476630406, -0.00237876719423, -1158.81828889
```

Registration and alignment requires the transformation matrix. To align the RGB H&E image:
```
python ./src/alignment.py --out-dir OUT_DIR --tif-path RGB_MORPHOLOGY_OME_FILE --transform TRANSFORM_PATH
```
Here, `RGB_MORPHOLOGY_OME_FILE` is the path to the RGB H&E image file in OME-TIFF format and `TRANSFORM_PATH` is the CSV file containing the transformation matrix.

Note: Make sure you have the necessary dependencies installed, such as OpenCV and any other required libraries, before running the scripts.

### 3. Generate training data
The following command generates the training data (cell masks and H&E tiles) given the Xenium data and H&E image.
Expand Down
Loading