-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add dask suppport and valis alignment (#69)
- add dask support for loading larger than RAM transcript dataframes - refactor alignment methods (decouple alignment matrix loading from alignment) - add Valis registration support to the processinig pipeline - cleanup of unused functions/impots - hestcore 1.0.3 -> 1.0.4 (better documentation)
- Loading branch information
1 parent
239b506
commit b87046f
Showing
19 changed files
with
3,018 additions
and
688 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,23 @@ | ||
__pycache__ | ||
data | ||
align_coord_img.ipynb | ||
src/hiSTloader/yolov8n.pt | ||
.vscode/launch.json | ||
dist | ||
src/hest.egg-info | ||
make.bat | ||
Makefile | ||
*.parquet | ||
bench_data | ||
cell_seg | ||
filtered | ||
src/hest/bench/timm_ctp | ||
my_notebooks | ||
.gitattributes | ||
cells_xenium.geojson | ||
nuclei_xenium.geojson | ||
nuclei.tif | ||
cells.tif | ||
src_slides | ||
data64.h5 | ||
tests/assets | ||
config | ||
tests/output_tests | ||
tissue_seg | ||
|
||
results | ||
atlas | ||
figures/test_paul | ||
bench_data.zip | ||
old_bench_data | ||
tutorials/downloads | ||
tutorials/processed | ||
bench_config/my_bench_config.yaml | ||
src/hest/bench/private | ||
str.csv | ||
bench_data_old | ||
ST_data_emb/ | ||
ST_pred_results/ | ||
hest_data | ||
fm_v1 | ||
cufile.log | ||
int.csv | ||
docs/build | ||
docs/source/generated | ||
local | ||
hest_vis | ||
hest_vis2 | ||
hest_vis | ||
vis | ||
vis2 | ||
models/deeplabv3* | ||
htmlcov | ||
models/CellViT-SAM-H-x40.pth | ||
debug_seg | ||
replace_seg | ||
test_vis | ||
data | ||
.vscode/launch.json | ||
dist | ||
src/hest.egg-info | ||
bench_data | ||
.gitattributes | ||
tests/assets | ||
config | ||
tests/output_tests | ||
HEST/ | ||
|
||
results | ||
atlas | ||
ST_data_emb/ | ||
ST_pred_results/ | ||
hest_data | ||
fm_v1 | ||
docs/build | ||
docs/source/generated | ||
local | ||
models/deeplabv3* | ||
htmlcov | ||
models/CellViT-SAM-H-x40.pth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Slide Adapter class for Valis compatibility | ||
import os | ||
|
||
import numpy as np | ||
from valis import slide_tools | ||
from valis.slide_io import PIXEL_UNIT, MetaData, SlideReader | ||
|
||
from hestcore.wsi import wsi_factory | ||
|
||
|
||
class SlideReaderAdapter(SlideReader): | ||
def __init__(self, src_f, *args, **kwargs): | ||
super().__init__(src_f, *args, **kwargs) | ||
self.wsi = wsi_factory(src_f) | ||
self.metadata = self.create_metadata() | ||
|
||
def create_metadata(self): | ||
meta_name = f"{os.path.split(self.src_f)[1]}_Series(0)".strip("_") | ||
slide_meta = MetaData(meta_name, 'SlideReaderAdapter') | ||
|
||
slide_meta.is_rgb = True | ||
slide_meta.channel_names = self._get_channel_names('NO_NAME') | ||
slide_meta.n_channels = 1 | ||
slide_meta.pixel_physical_size_xyu = [0.25, 0.25, PIXEL_UNIT] | ||
level_dim = self.wsi.level_dimensions() #self._get_slide_dimensions() | ||
slide_meta.slide_dimensions = np.array([list(item) for item in level_dim]) | ||
|
||
return slide_meta | ||
|
||
def slide2vips(self, level, xywh=None, *args, **kwargs): | ||
img = self.slide2image(level, xywh=xywh, *args, **kwargs) | ||
vips_img = slide_tools.numpy2vips(img) | ||
|
||
return vips_img | ||
|
||
def slide2image(self, level, xywh=None, *args, **kwargs): | ||
level_dim = self.wsi.level_dimensions()[level] | ||
img = self.wsi.get_thumbnail(level_dim[0], level_dim[1]) | ||
|
||
if xywh is not None: | ||
xywh = np.array(xywh) | ||
start_c, start_r = xywh[0:2] | ||
end_c, end_r = xywh[0:2] + xywh[2:] | ||
img = img[start_r:end_r, start_c:end_c] | ||
|
||
return img |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.