Skip to content

Documentation inconistency #532

@blaginin

Description

@blaginin
  • TIA Toolbox version: 1.3.1, dev
  • Python version: 3.10.8 (conda)
  • Operating System: MacOS 13.1 (22C65)

Description

Trying to learn the library and discovered some cases where docs are inconsistent with the current behaviour.

What I Did

>>>  store = AnnotationStore()
TypeError: Can't instantiate abstract class AnnotationStore with abstract methods __getitem__, __len__, __setitem__, commit, dump, dumps, open

AnnotationStore has become abstract, and it would be helpful to update the docs accordingly. Examples can either state that users must use derived classes or explicitly show methods usage on SQLiteStore or DictionaryStore.

>>> store = DictionaryStore()
>>> store.add(
...     Annotation(
...         geometry=Polygon.from_bounds(0, 0, 1, 1),
...         properties={"class": 42},
...     ),
...     key="foo",
... )
AttributeError: 'DictionaryStore' object has no attribute 'add'

It looks like .add.append?

  • Tried to query my AnnotationStore (as it was stated here and here).
>>> store = DictionaryStore()
>>> store.append(
...     Annotation(
...         geometry=Polygon.from_bounds(0, 0, 1, 1),
...         properties={"class": 42},
...     ),
...     key="foo",
... )
>>> store.bquery(where="props['class'] == 42") 
AttributeError: 'NoneType' object has no attribute 'bounds'

The method works successfully with SQLiteStore but fails on DictionaryStore. Maybe it would be helpful to add a test for that behaviour.

  • Tried to predict classes of batches (as it was stated here)
>>> wsi_data = wsi.slide_thumbnail(resolution=5, units="power")
>>> assert type(wsi_data) == np.ndarray

>>> predictor = PatchPredictor(pretrained_model="resnet18-kather100k", batch_size=32)
>>> tile_output = predictor.predict(
...    imgs=[wsi_data],
...    mode="tile",
...    merge_predictions=True,
...    patch_input_shape=[224, 224],
...    stride_shape=[224, 224],
...    resolution=1,
...    units="baseline",
...    return_probabilities=True,
...    on_gpu=False
... )
TypeError: expected str, bytes or os.PathLike object, not ndarray

The method works with filenames but not with ndarray objects. Thus, users have to save their intermediate images to call the methods, which seems like an extra step.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions