Repository navigation
fix(binning)!: honour the coarse grey depth and its sign in every family #486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| #include <numeric> | ||
| #include "3d_glcm.h" | ||
| #include "3d_ooc_volume.h" | ||
| #include "../helpers/helpers.h" | ||
| #include "../environment.h" | ||
|
|
||
|
|
@@ -40,19 +41,13 @@ void D3_GLCM_feature::calculate (LR& r, const Fsettings& s) | |
| // clear the feature values buffers | ||
| clear_result_buffers(); | ||
|
|
||
| // grey-bin intensities | ||
| int w = r.aux_image_cube.width(), | ||
| h = r.aux_image_cube.height(), | ||
| d = r.aux_image_cube.depth(); | ||
|
|
||
| SimpleCube<PixIntens> D; | ||
| D.allocate (w,h,d); | ||
|
|
||
| auto greyBinningInfo = STNGS_GLCM_GREYDEPTH(s); // former Nyxus::theEnvironment.get_coarse_gray_depth() | ||
| if (STNGS_IBSI(s)) // former Nyxus::theEnvironment.ibsi_compliance | ||
| greyBinningInfo = 0; | ||
|
|
||
| bin_intensities_3d (D, r.aux_image_cube, r.aux_min, r.aux_max, greyBinningInfo); | ||
| // grey-bin the ROI's voxels; the background outside the ROI takes level 0, which pairs with nothing | ||
| SimpleCube<PixIntens> D; | ||
| Nyxus::bin_roi_3d (D, r, greyBinningInfo); | ||
|
|
||
| // calculate features for all the 13 directions | ||
| for (const ShiftToNeighbor & sh : shifts) | ||
|
|
@@ -340,10 +335,9 @@ void D3_GLCM_feature::calculateCoocMatAtAngle( | |
| PixIntens lvl_b = D.zyx(zslice, row, col), | ||
| lvl_a = D.zyx(zslice + dz, row + dy, col + dx); | ||
|
|
||
| // Skip 0-intensity pixels (usually out of mask pixels) | ||
| if (ibsi_grey_binning(greyInfo)) | ||
| if (lvl_a == 0 || lvl_b == 0) | ||
| continue; | ||
| // skip pairs with a background cell, which holds level 0 under every binning scheme | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: This comment and the one at
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Diverted The comments state what the code does now, by this repo's convention for changed lines; what was wrong is recorded in c42d6fa's message, which names the level-1 background pairing under MATLAB-style binning. |
||
| if (lvl_a == 0 || lvl_b == 0) | ||
| continue; | ||
|
|
||
| // 0-based grey tone indices, hence '-1' | ||
| int a = lvl_a, | ||
|
|
@@ -352,10 +346,6 @@ void D3_GLCM_feature::calculateCoocMatAtAngle( | |
| // raw intensities need to be modified for different grey binning paradigms (Matlab, PyRadiomics, IBSI) | ||
| if (radiomics_grey_binning(greyInfo)) | ||
| { | ||
| // skip zeroes | ||
| if (a == 0 || b == 0) | ||
| continue; | ||
|
|
||
| // index of 'a' | ||
| auto lower = std::lower_bound(I.begin(), I.end(), a); // enjoy sorted vector 'I' | ||
| a = int(lower - I.begin()); // intensity index in array of unique intensities 'I' | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocking: These lines move the default output of 3D GLRLM, GLSZM, GLDM and NGTDM from raw levels to 64 MATLAB-style levels, so every existing 3D run now returns different numbers for those four families. On top of that,
set_params(coarse_gray_depth=...)andset_environment_params(coarse_gray_depth=...)used to return and now raiseValueError(nyxus.py_without_coarse_gray_depth). Both changes break existing users. The commit is stillfix(binning): ..., with no!and noBREAKING CHANGE:footer (git log -1 --format=%B 1a6f5dcd), so release-please files it under Bug Fixes and bumps a patch version. The repo already marks breaking changes this way (feat(omezarr)!:with aBREAKING CHANGE:footer).Please make the commit and the PR title
fix(binning)!: ...and add aBREAKING CHANGE:footer that states three things:--coarseGrayDepth=0or3<family>/greydepth=0gives the old output;set_params/set_environment_paramsnow refuse a differentcoarse_gray_depth.