Repository navigation
Conversation
vjaganat90
approved these changes
Nov 18, 2026
vjaganat90
left a comment
Member
There was a problem hiding this comment.
LGTM. I built the head and its base (2411943) and ran both:
- The 1200 x 1200 striped table reproduces exactly. Out of core, the base gives
MEAN2281.08 and refuses*ALL_GLCM*with theoutside the bounding boxerror; the head gives 649.5 and the in-memoryGLCM_ASM_AVE. - In memory nothing moved: on four random images (striped 1300 x 1100, 1030 x 1500 and 500 x 333, tiled 700 x 900; 8 ROIs each),
*ALL*, whole-slide andanisotropy_x=2give the same 29,428 values on both. - Out of core,
*ALL*on the two striped images over 1024 equals the in-memory run on the head (12,032 values, neighbor features aside); the base refuses both.
Nits
added 2 commits
November 20, 2026 12:35
…2D out-of-core scan A striped TIFF is read in 1024 x 1024 tiles. The tile buffer is always a full tile, and the strip loader writes only the part of a partial edge tile that lies inside the image, so the rest still holds the previous tile's pixels and labels. The out-of-core scan walked the whole buffer and took those cells as pixels past the image's edge. On a striped image larger than 1024 pixels in either direction, the sums over a ROI counted its pixels up to four times (MEAN 2281.08 against 649.5 in memory on a 300 x 300 ROI of a 1200 x 1200 image), and every family that sizes a buffer from the ROI's box refused the run with "pixel ... lies outside the bounding box". The out-of-core scan now skips cells beyond the image's bounds, as the prescan, phase 1 and phase 2 scans do. The new invariant test featurizes a striped 1120 x 1080 image, with ROIs in the first tile, across all four tiles and inside the partial corner tile, in memory and out of core, and a tiled copy out of core; every column must agree, for the intensity features alone and for every 2D group. The docs no longer limit out-of-core equality to striped files of up to 1024 x 1024 pixels: the tiles warning and the out-of-core rows and possible issues of the 2D family pages are updated.
…age pixels The strip loader reads a striped TIFF in 1024 x 1024 tiles into a buffer that is always a full tile. It now sets the part of a partial edge tile past the image to 0, so no reader of the buffer finds an earlier tile's pixels or labels there. Before, only the scans that bounded themselves by the image's size were safe; the nested-ROI scan was not. The 2D tile scans (the prescan, phase 1, phase 2, the 2.5D scan, the out-of-core scan and the nested-ROI scan) visit a tile's pixels through one walker, Nyxus::walk_tile_pixels, which visits the part of the tile inside the image row by row, instead of every cell of the buffer with a division and a bounds test per cell. The featurize-side strip loader tests check the whole tile buffer, with the part past the image required to be 0; on the previous loader they fail at tile (0,1). The striped out-of-core invariant adds a case with the image resampled twice along x, and checks that its out-of-core runs took the out-of-core path through the neighbor features, which that path leaves at 0. large_images.rst states what the test suite checks on the striped image, in place of a one-off measurement.
darkclad
force-pushed
the
main-ooc-striped-tiff
branch
from
November 23, 2026 14:48
522e9bd to
a5b47d6
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Out of core, a 2D striped TIFF larger than 1024 pixels in either direction now gives the in-memory values. Nyxus reads such a file in 1024 x 1024 tiles. The tile buffer is always a full tile, and the strip loader writes only the part of a partial edge tile that lies inside the image, so the rest of the buffer still holds the previous tile's pixels and labels. The out-of-core scan in
processNontrivialRoiswalked the whole buffer and took those cells as ROI pixels past the image's right or bottom edge:MEAN2281.08 out of core against 649.5 in memory, withMINandMAXunchanged.pixel (1224,100) lies outside the bounding box x 200..499, y 100..399 that sizes its buffer. Python raisedRuntimeError; the command line wrote those features as 0.Tiled TIFF files, and striped files of up to 1024 x 1024 pixels, were not affected.
The out-of-core scan now skips cells beyond the image's bounds, as the prescan, phase 1 and phase 2 scans already did. The strip loader also zero-fills the part of a partial edge tile past the image, so no reader of the buffer can find an earlier tile's pixels there. Every 2D tile scan now walks only a tile's in-image pixels, through one shared walker. In-memory values do not change.
Follow-ups are on Axle's PN Jira board (https://labshare.atlassian.net/jira/software/projects/PN/boards/851), which is where the PN keys below point. This closes PN-286 and PN-296.
Change
Two commits.
fix(ooc): skip the part of a partial edge tile past the image in the 2D out-of-core scansrc/nyx/phase3.cpp: the tile scan ofprocessNontrivialRoisskips a cell whose position is at or past the image's full width or height.tests/python/test_2d_ooc_invariant.py:test_2d_ooc_2d_striped_over_one_tile_matches_in_ram_invariantwrites a striped 1120 x 1080 image and a 64 x 64 tiled copy. The striped image is 2 x 2 tiles of 1024, with a 96-wide last column and a 56-high last row. It has three ROIs: one in the first tile, one across all four tiles, and one inside the partial corner tile. Every column of every ROI must agree between in memory, out of core, and the tiled copy out of core. It runs twice, once with*ALL_INTENSITY*and once with every 2D group. On the code before this change the intensity case fails on a value (MEAN1858 against 464.5 on the first ROI), and the all-groups case fails on theoutside the bounding boxrefusal.large_images.rstno longer limits out-of-core equality to striped files of up to 1024 x 1024 pixels, and the tiles warning is gone. The memory-limit paragraph oftroubleshooting.rst, the out-of-core rows of the 2D family pages, and the "Out-of-core ROIs of large striped TIFF files" entries of the intensity and intensity-histogram pages are updated to match.tests/vetting/not_covered.md: the function count oftest_2d_ooc_invariant.py.fix(tiff): zero-fill partial strip tiles and walk only a tile's in-image pixelssrc/nyx/grayscale_tiff.h:NyxusGrayscaleTiffStripLoader::loadTileFromFilesets the tile buffer to 0 before it fills a partial edge tile. This fixes the nested-ROI scan (nested_roi_py.cpp, PN-296), the one scan that walked the whole buffer without a bound.copyRowloses its "zero-fill" branch, which could never run.src/nyx/volume_walk.h:Nyxus::walk_tile_pixelsvisits the pixels of one 2D tile that lie inside the image, row by row, with their buffer offset and image position. The prescan (slideprops.cpp), phase 1, phase 2 (2D and 2.5D), the out-of-core scan and the nested-ROI scan use it in place of a loop over every cell with a division and a bounds test per cell.ImageLoader1xgainsget_full_widthandget_full_heightfor the nested-ROI scan.tests/test_2d_tiff_strip_loader_mechanics.h: the featurize-side loader checks cover the whole tile buffer and require the part past the image to be 0. On the loader before this change they fail at tile (0,1).tests/python/test_2d_ooc_invariant.py: the striped test gains an anisotropic case (anisotropy_x=2, intensity and morphology). Every case also checks that its out-of-core runs took the out-of-core path: ROIs 2 and 3 are neighbors in memory, and out of core the neighbor features read 0. All three cases fail on the code before this PR.docs/source/large_images.rst: the striped-image paragraph states what the test suite checks, in place of a one-off measurement.Changed values
Out of core only; every in-memory value is unchanged. Python API,
ram_limit=0against 64 MB, intensity1 + (x % 500) + 2 (y % 300).MEANINTEGRATED_INTENSITYSTANDARD_DEVIATIONENERGYMEANSTANDARD_DEVIATIONMEANMEANSTANDARD_DEVIATIONMINandMAXwere already correct. On both images,*ALL_GLCM*,*ALL_MORPHOLOGY*andGABORraised theoutside the bounding boxerror out of core before this change and now complete. After this change, all 738 columns of*ALL*other than the neighbour features match the in-memory run on every ROI of both images. A whole-image ROI of a 1200 x 1200 image of four quadrants (100, 1100, 2100, 3100), the example the intensity pages gave, now givesMEAN1600 andIH_MAX_GRADIENT360000 on both paths.No oracle applies: this is an out-of-core == in-memory relation, and the in-memory values are vetted separately.
Testing
pytest tests/python/on the whole directory: 330 passed. The 11 failures are the Arrow tests, which fail on this Arrow-less build with "Apache Arrow functionality is not available".pytest tests/python/ -m "not arrow"through the bindings (330 passed), 0 sanitizer diagnostics.check_coverage.py --check,check_test_names.py --check, everyscan_*_coverage.py --check, the regenerated docs, andsphinx-build -W: clean.Not in this PR, filed on the board:
The nested-ROI fix has no end-to-end test.
Nested.find_relationsrelates every child to every parent whatever the geometry (PN-155), so a stray label in a ROI's box cannot change its output. The loader tests above cover the buffer the scan reads.