Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 3 additions & 7 deletions docs/source/Math/f_2dmoments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,8 @@ set again with every pixel also weighted by its distance to the ROI contour.
with anisotropy the run can crash, a known defect (`#521 <https://github.com/PolusAI/nyxus/issues/521>`__). The GPU's distance search computes
the step with a single-precision logarithm.
* - **Out-of-core**
- Yes, all 180 moments, with or without anisotropy, with the same values as in memory on
tiled TIFF files and on striped files of up to 1024 × 1024 pixels: the weighted moments are
measured against the same contour on both paths. On a larger striped file out-of-core
processing of this family raises an error or returns wrong values, depending on the ROI
(see :ref:`large-images-tiles`).
- Yes, all 180 moments, with or without anisotropy, with the same values as in memory: the
weighted moments are measured against the same contour on both paths.
* - **IBSI**
- None. IBSI defines no geometric moment features.

Expand Down Expand Up @@ -222,8 +219,7 @@ Settings
* - Memory limit
- ``--ramLimit``
- ``Nyxus(..., ram_limit=...)``
- ROIs whose footprint reaches the limit are computed out of core, with the same values; on
a striped file larger than 1024 × 1024 pixels it raises an error or changes the moments.
- ROIs whose footprint reaches the limit are computed out of core, with the same values.
* - GPU
- ``--useGpu=true``
- ``Nyxus(..., use_gpu_device=0)``
Expand Down
4 changes: 1 addition & 3 deletions docs/source/Math/f_erosion.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ thin or ragged ones, so the count is a rough measure of the ROI's thickness in p
:doc:`/gpu`), a known defect (`#520 <https://github.com/PolusAI/nyxus/issues/520>`__). The GPU uses the same structuring element, the same pixel
range and the same cap.
* - **Out-of-core**
- Yes, with the same values as in memory on tiled TIFF files and on striped files of up to
1024 × 1024 pixels. On a larger striped file out-of-core erosion raises an error or returns a
wrong value, depending on the ROI; see :ref:`large-images-tiles`.
- Yes, with the same values as in memory.
* - **IBSI**
- Neither feature has an IBSI identifier; IBSI defines no erosion count.

Expand Down
4 changes: 1 addition & 3 deletions docs/source/Math/f_fractal_dimension.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ rough or ragged shapes give larger values.
* - **Out-of-core**
- Yes. Out of core both features have their in-memory values: box counting follows the same
rule for the padded side :math:`S`, and the divider walks the same borders, traced the same
way (the worked example gives 1.3732 and 1.1311 on both paths). On a striped image larger
than 1024 pixels in either direction out-of-core processing raises an error or returns wrong
values, depending on the ROI (see :ref:`large-images-tiles`).
way (the worked example gives 1.3732 and 1.1311 on both paths).
* - **IBSI**
- Neither feature has an IBSI identifier; IBSI defines no fractal dimension.

Expand Down
4 changes: 1 addition & 3 deletions docs/source/Math/f_gabor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ orientation.
from Python. The GPU values are not checked against the CPU values (see
:ref:`gabor-possible-issues`).
* - **Out-of-core**
- Yes, with the same values as in memory on tiled TIFF files and on striped files of up to
1024 × 1024 pixels. On a larger striped file out-of-core processing of this family raises
an error or returns wrong values, depending on the ROI (see :ref:`large-images-tiles`).
- Yes, with the same values as in memory.
* - **IBSI**
- No identifier. IBSI defines no Gabor feature; its image-feature chapter names Gabor filters
only as an image transformation.
Expand Down
4 changes: 1 addition & 3 deletions docs/source/Math/f_glcm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ regularity that first-order intensity statistics cannot see.
* - **GPU**
- No; computed on the CPU in every build.
* - **Out-of-core**
- Yes, with the same values as in memory on tiled TIFF files and on striped files of up to
1024 × 1024 pixels. On a larger striped file out-of-core processing of this family raises
an error or returns wrong values, depending on the ROI (see :ref:`large-images-tiles`).
- Yes, with the same values as in memory.
* - **IBSI**
- 25 of the 30 features have an IBSI identifier. Four of the other 5 return the same value as
one that does; ``GLCM_VARIANCE`` equals IBSI joint variance, which ``GLCM_JVAR`` matches only
Expand Down
4 changes: 1 addition & 3 deletions docs/source/Math/f_gldm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ pixels with many same-level neighbours) or heterogeneous (few).
* - **GPU**
- No; computed on the CPU in every build.
* - **Out-of-core**
- Yes, with the same values as in memory on tiled TIFF files and on striped files of up to
1024 × 1024 pixels. On a larger striped file out-of-core processing of this family raises
an error or returns wrong values, depending on the ROI (see :ref:`large-images-tiles`).
- Yes, with the same values as in memory.
* - **IBSI**
- None. IBSI defines no GLDM; the family follows PyRadiomics. IBSI's neighbouring grey level
dependence matrix with :math:`\alpha = 0` and :math:`\delta = 1` counts the same
Expand Down
4 changes: 1 addition & 3 deletions docs/source/Math/f_gldzm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ areas deep inside the ROI give large ones.
* - **GPU**
- No; computed on the CPU in every build.
* - **Out-of-core**
- Yes, with the same values as in memory on tiled TIFF files and on striped files of up to
1024 × 1024 pixels. On a larger striped file out-of-core processing of this family raises
an error or returns wrong values, depending on the ROI (see :ref:`large-images-tiles`).
- Yes, with the same values as in memory.
* - **IBSI**
- 16 of the 18 features have an IBSI identifier. Grey level mean and zone distance mean have
none.
Expand Down
4 changes: 1 addition & 3 deletions docs/source/Math/f_glrlm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ texture is fine (many short runs) or coarse (few long runs).
* - **GPU**
- No; computed on the CPU in every build.
* - **Out-of-core**
- Yes, with the same values as in memory on tiled TIFF files and on striped files of up to
1024 × 1024 pixels. On a larger striped file out-of-core processing of this family raises
an error or returns wrong values, depending on the ROI (see :ref:`large-images-tiles`).
- Yes, with the same values as in memory.
* - **IBSI**
- All 16 features have an IBSI identifier.

Expand Down
4 changes: 1 addition & 3 deletions docs/source/Math/f_glszm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ small zones; coarse or homogeneous textures give few large ones.
level non-uniformity, grey level variance and zone variance do not follow the formulas on
this page.
* - **Out-of-core**
- Yes, with the same values as in memory on tiled TIFF files and on striped files of up to
1024 × 1024 pixels. On a larger striped file out-of-core processing of this family raises
an error or returns wrong values, depending on the ROI (see :ref:`large-images-tiles`).
- Yes, with the same values as in memory.
* - **IBSI**
- All 16 features have an IBSI identifier.

Expand Down
6 changes: 2 additions & 4 deletions docs/source/Math/f_image_quality.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ computed on the ROI's bounding box as a rectangular image.
* - **GPU**
- No; computed on the CPU in every build.
* - **Out-of-core**
- Partly, with a label image only. On tiled TIFF files and on striped files of up to
1024 × 1024 pixels (see :ref:`large-images-tiles`), ``FOCUS_SCORE`` and
``LOCAL_FOCUS_SCORE`` have the same values as in memory, and so do the saturations unless
the ROI is constant.
- Partly, with a label image only. ``FOCUS_SCORE`` and ``LOCAL_FOCUS_SCORE`` have the same
values as in memory, and so do the saturations unless the ROI is constant.
``POWER_SPECTRUM_SLOPE`` and ``SHARPNESS`` are not computed out of core, a known defect
(`#508 <https://github.com/PolusAI/nyxus/issues/508>`__; see :ref:`imq-possible-issues`). In whole-image mode an image too large for memory is refused.
* - **IBSI**
Expand Down
14 changes: 1 addition & 13 deletions docs/source/Math/f_intensity_histogram.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ indices, as IBSI defines it, and over the bin-centre intensities, in the image's
* - **GPU**
- No; computed on the CPU in every build.
* - **Out-of-core**
- Yes, with the same values as in memory on tiled TIFF files and on striped files of up to
1024 × 1024 pixels; see :ref:`intensity-histogram-possible-issues` for larger striped files
and :ref:`large-images-tiles`.
- Yes, with the same values as in memory.
* - **IBSI**
- 23 features have an identifier from the IBSI intensity histogram features, which list 23
features: the 19 ``_IDX`` statistics other than ``IH_ROBUST_MEAN_IDX`` and the 4 gradient
Expand Down Expand Up @@ -745,16 +743,6 @@ In-memory arrays are not in the input's units
1.84. Read from a file, the same image gives :math:`-9` and :math:`-7.16`. The ``_IDX`` features
do not change.

Out-of-core ROIs of large striped TIFF files
A ROI processed out of core is read from the file again. For a striped (not tiled) TIFF more
than 1024 pixels high or wide, the pixels read back do not match the image, and most ``IH_*``
features differ from the in-memory values; the minimum, maximum, range, bin size and number of
bins come from the first pass over the image and do not change. On a 1200 × 1200 image of four
quadrants of 100, 1100, 2100 and 3100, ``IH_MAX_GRADIENT`` was 1123200 in place of 360000 and
``IH_MEAN_VAL`` 1635.0 in place of 1600. The intensity features are affected too; see
:ref:`intensity-possible-issues`. Tiled TIFF files of the same size, and striped files of
1024 × 1024 pixels, give the in-memory values.


Validation
----------
Expand Down
8 changes: 3 additions & 5 deletions docs/source/Math/f_morphology.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ intensity-weighted features, they use only the ROI's mask.
- Partly. Out of core the contour is traced as in memory, every border of the ROI in image
coordinates, so every contour-based feature, with or without anisotropy, has its in-memory
value. The neighbour features are not computed: they are 0, and ``POLYGONALITY_AVE`` and
``HEXAGONALITY_*`` are −1. On a striped file larger than 1024 × 1024 pixels out-of-core
processing raises an error or returns wrong values, depending on the ROI. See
:ref:`morphology-possible-issues`, :doc:`/large_images` and :ref:`large-images-tiles`.
``HEXAGONALITY_*`` are −1. See :ref:`morphology-possible-issues` and
:doc:`/large_images`.
* - **IBSI**
- None. IBSI defines morphological features in 3D only (DHQ4), so no 2D code on this page
has an identifier.
Expand Down Expand Up @@ -1313,8 +1312,7 @@ Out of core
0, and an out-of-core ROI is also not seen as a neighbour by the ROIs computed in memory, so
their neighbour features leave it out. ``POLYGONALITY_AVE`` and ``HEXAGONALITY_*``, which need
the neighbour count, are −1 out of core. On the worked example every other code gives its
in-memory value; on striped files larger than 1024 × 1024 pixels see
:ref:`large-images-tiles`, and for the families that differ see :doc:`/large_images`.
in-memory value; for the families that differ see :doc:`/large_images`.

Codes that need companions
Several codes read values that another family computes, and are wrong when no code of that
Expand Down
4 changes: 1 addition & 3 deletions docs/source/Math/f_ngldm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ counts; fine textures give low ones.
* - **GPU**
- No; computed on the CPU in every build.
* - **Out-of-core**
- Yes, with the same values as in memory on tiled TIFF files and on striped files of up to
1024 × 1024 pixels (see :ref:`large-images-tiles` for larger striped files), except on a
constant ROI (see
- Yes, with the same values as in memory, except on a constant ROI (see
:ref:`ngldm-possible-issues`).
* - **IBSI**
- 17 of the 19 features have an IBSI identifier. Grey level mean and dependence count mean
Expand Down
7 changes: 2 additions & 5 deletions docs/source/Math/f_ngtdm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@ neighbourhood averages. The features describe how coarse, busy or contrasted a t
* - **GPU**
- No; computed on the CPU in every build.
* - **Out-of-core**
- Yes, with the same values as in memory on tiled TIFF files and on striped files of up to
1024 × 1024 pixels, except in
- Yes, with the same values as in memory, except in
IBSI mode: there only the first ROI that a ``Nyxus`` object or a command-line run computes
out of core matches, and the later ones are wrong, a known defect (`#512 <https://github.com/PolusAI/nyxus/issues/512>`__): the list
of grey levels is not cleared between out-of-core ROIs in IBSI mode. On a larger striped
file out-of-core processing of this family raises an error or returns wrong
values, depending on the ROI (see :ref:`large-images-tiles`).
of grey levels is not cleared between out-of-core ROIs in IBSI mode.
* - **IBSI**
- All 5 features have an IBSI identifier.

Expand Down
13 changes: 1 addition & 12 deletions docs/source/Math/f_pixel_intensity.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ lies.
* - **GPU**
- No; computed on the CPU in every build.
* - **Out-of-core**
- Yes, with the same values as in memory on tiled TIFF files and on striped files of up to
1024 × 1024 pixels; see :ref:`intensity-possible-issues` for larger striped files and
:ref:`large-images-tiles`.
- Yes, with the same values as in memory.
* - **IBSI**
- 18 features have an identifier from the IBSI intensity-based statistics, which list 18
features. ``COV`` follows a different convention from IBSI; its entry says how.
Expand Down Expand Up @@ -850,15 +848,6 @@ Covered range of in-memory images
``COVERED_IMAGE_INTENSITY_RANGE`` is not computed for arrays passed to ``Nyxus.featurize``: it
is 0 in pandas and ``-0.0`` in Arrow and Parquet files. Write the image to a file to get it.

Out-of-core ROIs of large striped TIFF files
A ROI processed out of core is read from the file again. For a striped (not tiled) TIFF more
than 1024 pixels high or wide, the pixels read back do not match the image, and the features
computed from them differ from the in-memory values (``MIN``, ``MAX``, ``RANGE`` and
``UNIFORMITY_PIU`` come from the first pass over the image and stay correct): on a
1200 × 1200 image of four quadrants of 100, 1100, 2100 and 3100, ``MEAN`` was 4764.0 in place
of 1600. Tiled TIFF files of the same size, and striped files of 1024 × 1024 pixels, give the
in-memory values.

Grey levels above 65535
``ENERGY`` and ``ROOT_MEAN_SQUARED`` square each pixel as a 32-bit unsigned integer, a known
defect (`#490 <https://github.com/PolusAI/nyxus/issues/490>`__), which
Expand Down
6 changes: 2 additions & 4 deletions docs/source/Math/f_radial_distribution.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ unevenly the intensity is spread over the wedges.
* - **GPU**
- No; computed on the CPU in every build.
* - **Out-of-core**
- Yes, with or without anisotropy, with the same values as in memory on tiled TIFF files and
on striped files of up to 1024 × 1024 pixels: the contour is the same on both paths. On a
larger striped file out-of-core processing raises an error or returns wrong values,
depending on the ROI (see :ref:`large-images-tiles`).
- Yes, with or without anisotropy, with the same values as in memory: the contour is the
same on both paths.
* - **IBSI**
- None. IBSI defines no radial distribution features.

Expand Down
4 changes: 1 addition & 3 deletions docs/source/Math/f_zernike.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ patterns and high orders fine radial and angular detail.
* - **GPU**
- No; computed on the CPU in every build.
* - **Out-of-core**
- Yes, with the same values as in memory on tiled TIFF files and on striped files of up to
1024 × 1024 pixels. On a larger striped file out-of-core processing of this family raises
an error or returns wrong values, depending on the ROI (see :ref:`large-images-tiles`).
- Yes, with the same values as in memory.
* - **IBSI**
- None. IBSI defines no Zernike features.

Expand Down
42 changes: 12 additions & 30 deletions docs/source/large_images.rst
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,8 @@ the last digits (see :doc:`Math/f_morphology_3d`). A test volume with two ROIs,
volume. This holds for inputs Nyxus can stream; see the end of
:ref:`large-images-tiles` for those it refuses.

In 2D, every family matches the in-memory values on tiled TIFF files and on striped files of up to
1024 x 1024 pixels (see :ref:`large-images-tiles` for larger striped files), with these
exceptions:
In 2D, every family matches the in-memory values, on tiled and striped TIFF files of any size, with
these exceptions:

* In IBSI mode 2D NGTDM matches only on the first ROI computed out of core, a known defect
(`#512 <https://github.com/PolusAI/nyxus/issues/512>`__; see :doc:`Math/f_ngtdm`).
Expand All @@ -207,9 +206,7 @@ neighbor features for large ROIs, raise the RAM limit so that the ROIs are compu
When a feature fails on an out-of-core 2D ROI, Python raises ``RuntimeError`` with the message
``Error while computing feature ... over oversized ROI ...``. The command line prints the same
message and continues: the ROI's row is written with 0 in that feature's columns, and the run
exits with status 0. For example, on a 300 x 300 ROI of a striped 1200 x 1200 image, the contour
failed out of core with ``pixel ... lies outside the bounding box ... that sizes its buffer`` (see
:ref:`large-images-tiles`). After a command-line run with large ROIs, search the console output for
exits with status 0. After a command-line run with large ROIs, search the console output for
``Error while computing feature``.

.. _large-images-tiles:
Expand All @@ -226,30 +223,15 @@ same tile size; a pair with different tile sizes is refused with an error that s
In memory and in whole-slide mode, tiling does not change the results: a 256 x 256 image with 66
ROIs, 30 of them crossing 64 x 64 tile borders, gave the same features tiled and striped.

Out of core, tiling does not change the results either: a tiled TIFF of several tiles gives the
values of a striped copy of the same image, and the in-memory values, for ROIs inside one tile and
for ROIs that span tiles.

.. warning::

Out-of-core processing of a 2D striped TIFF larger than 1024 pixels in either direction, which
Nyxus reads as several 1024 x 1024 tiles, places the pixels of later tiles at wrong positions
and can read ROI pixels more than once, so the results depend on the family. Measured on a
300 x 300 square and a 300 x 240 elliptical ROI inside the first 1024 x 1024 region of a
striped 1200 x 1200 image:

* Every family that builds the ROI's pixel matrix or contour (the texture families, the
moments, morphology, the radial distribution, the fractal dimension, Zernike and Gabor) stops
when a misplaced pixel lies outside the ROI's bounding box: from Python the call raises
``RuntimeError`` ("pixel ... lies outside the bounding box ... that sizes its buffer"); the
command line prints that error and leaves those features uncomputed.
* When every misplaced pixel stays inside the bounding box, the same families return wrong
values without an error.
* ROI pixels were read more than once: the intensity features built from sums, such as
``MEAN``, differed from the in-memory values, while ``MIN`` and ``MAX`` kept them.

Keep large 2D ROIs of such images in memory by raising the RAM limit, store the images as tiled
TIFF files, or split them so that each is at most 1024 x 1024 pixels.
Out of core, tiling does not change the results either: a tiled TIFF of several tiles, and a
striped TIFF larger than 1024 pixels in either direction, give the values of a copy of the same
image in the other layout, and the in-memory values, for ROIs inside one tile, for ROIs that span
tiles, and for ROIs in the partial tiles at the right and bottom edges of the image. The test suite
checks this on a striped 1120 x 1080 image with a ROI in the first tile, one across all four tiles
and one inside the partial corner tile: out of core, on the striped image and on a tiled copy, every
column of the intensity, intensity histogram, morphology, texture, moments, Gabor and Zernike groups
other than the neighbor features matches the in-memory run, and so do the intensity and morphology
columns with ``anisotropy_x`` set to 2.

Out-of-core processing of a volume streams it one read at a time. When a single read of the
intensity or label file returns the whole volume, as with a NIfTI file or an OME-Zarr array
Expand Down
Loading
Loading