|
1 | 1 | # TODO: implement readImgData and read10xVisium? |
2 | 2 | # TODO: interop w/ SpatialData class from scverse |
3 | | -# TODO: no type hints in the docstring |
4 | 3 | from typing import Any, Dict, List, Optional, Union |
5 | 4 | from warnings import warn |
6 | 5 |
|
@@ -338,7 +337,8 @@ def set_spatial_coordinates(self, spatial_coords: biocframe.BiocFrame, in_place: |
338 | 337 | spatial_coords: |
339 | 338 | New spatial coordinates. |
340 | 339 | |
341 | | - in_place: Whether to modify the ``SpatialExperiment`` in place. Defaults to False. |
| 340 | + in_place: |
| 341 | + Whether to modify the ``SpatialExperiment`` in place. Defaults to False. |
342 | 342 | |
343 | 343 | Returns: |
344 | 344 | A modified ``SpatialExperiment`` object, either as a copy of the original or as a reference to the (in-place-modified) original. |
@@ -401,10 +401,11 @@ def set_image_data(self, img_data: biocframe.BiocFrame, in_place: bool = False) |
401 | 401 | """Set new image data. |
402 | 402 | |
403 | 403 | Args: |
404 | | - img_data (biocframe.BiocFrame): |
| 404 | + img_data: |
405 | 405 | New image data. |
406 | 406 | |
407 | | - in_place (bool): Whether to modify the ``SpatialExperiment`` in place. Defaults to False. |
| 407 | + in_place: |
| 408 | + Whether to modify the ``SpatialExperiment`` in place. Defaults to False. |
408 | 409 | |
409 | 410 | Returns: |
410 | 411 | A modified ``SpatialExperiment`` object, either as a copy of the original or as a reference to the (in-place-modified) original. |
@@ -461,12 +462,18 @@ def get_img( |
461 | 462 | Retrieve spatial images based on the provided sample and image ids. |
462 | 463 |
|
463 | 464 | Args: |
464 | | - # TODO: describe what `sample_id=True`, `sample_id=None`, `sample_id="sample_1"` mean |
465 | | - sample_id (Union[str, True, None], optional): The sample id. `sample_id=True` then get all samples... |
466 | | - image_id (Union[str, True, None], optional): The image id. |
| 465 | + sample_id: The sample id. |
| 466 | + - `sample_id=True`: Matches all samples. |
| 467 | + - `sample_id=None`: Matches the first sample. |
| 468 | + - `sample_id="<str>"`: Matches a sample by its id. |
| 469 | +
|
| 470 | + image_id: The image id. |
| 471 | + - `image_id=True`: Matches all images for the specified sample(s). |
| 472 | + - `image_id=None`: Matches the first image for the sample(s). |
| 473 | + - `image_id="<str>"`: Matches image(s) by its(their) id. |
467 | 474 |
|
468 | 475 | Returns: |
469 | | - Union[SpatialImage, List[SpatialImage]]: One or more `SpatialImage` objects. |
| 476 | + One or more `SpatialImage` objects. |
470 | 477 |
|
471 | 478 | Behavior: |
472 | 479 | - sample_id = True, image_id = True: |
@@ -557,15 +564,15 @@ def add_img( |
557 | 564 | Add a new image entry. |
558 | 565 |
|
559 | 566 | Args: |
560 | | - image_source (str): The file path to the image. |
561 | | - scale_factor (float): The scaling factor associated with the image. |
562 | | - sample_id (Union[str, True, None]): The sample id. |
563 | | - image_id (Union[str, True, None]): The image id. |
564 | | - load (bool, optional): Whether to load the image into memory. If `True`, |
| 567 | + image_source: The file path to the image. |
| 568 | + scale_factor: The scaling factor associated with the image. |
| 569 | + sample_id: The sample id. |
| 570 | + image_id: The image id. |
| 571 | + load: Whether to load the image into memory. If `True`, |
565 | 572 | the method reads the image file from `image_source`. Defaults to `True`. |
566 | 573 |
|
567 | 574 | Returns: |
568 | | - SpatialExperiment: The updated SpatialExperiment object containing the |
| 575 | + The updated SpatialExperiment object containing the |
569 | 576 | newly added image entry. |
570 | 577 |
|
571 | 578 | Raises: |
|
0 commit comments