Skip to content
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

Hypersensitive "Non unform sampling or missing slices detected" warning #1607

Open
lassoan opened this issue Feb 12, 2020 · 7 comments
Open

Hypersensitive "Non unform sampling or missing slices detected" warning #1607

lassoan opened this issue Feb 12, 2020 · 7 comments
Assignees
Labels

Comments

@lassoan
Copy link

@lassoan lassoan commented Feb 12, 2020

Description

ITK's new non-uniform "sampling" detection (actually, slice spacing) is so sensitive that it is useless. It also generates so many warnings that it floods the log and slows down DICOM loading.

Example:

WARNING: In c:\d\s42d\itk\modules\io\imagebase\include\itkImageSeriesReader.hxx, line 440
ImageSeriesReader (000001F94F144440): Non unform sampling or missing slices detected , expected 0.3 got: 0.3

The compared values are 0.29999999999999716 and 0.29999999999999999 (absolute difference is 2.8310687127941492e-15).

Steps to Reproduce

Load any DICOM series - but to give a specific example:
https://wiki.cancerimagingarchive.net/display/Public/QIN-HEADNECK
TCGA-BA-4074

Expected behavior

Only give a warning when spacing variation is non-negligible.

If the difference is magnitudes lower then the expected slice spacing then I definitely don't want to see any warning and don't want the image to be considered as having varying slice spacing.

Actual behavior

A warning is logged for each slice.

Reproducibility

100%

Versions

Latest ITK 5.0.1rc01

Environment

Windows.

@vfonov

This comment has been minimized.

Copy link
Contributor

@vfonov vfonov commented Feb 12, 2020

didn't we address this in #1476 ?

@dzenanz

This comment has been minimized.

Copy link
Member

@dzenanz dzenanz commented Feb 12, 2020

Perhaps instead of AlmostEquals use FloatAlmostEqual with some medium tolerance (1e-6)?

@vfonov

This comment has been minimized.

Copy link
Contributor

@vfonov vfonov commented Feb 12, 2020

I suppose it will depend on the context?

@dzenanz

This comment has been minimized.

Copy link
Member

@dzenanz dzenanz commented Feb 12, 2020

Perhaps use a more strict tolerance (e.g. 1e-14)?

@vfonov

This comment has been minimized.

Copy link
Contributor

@vfonov vfonov commented Feb 12, 2020

we can also disable the warning completely and keep metadata information only

@dzenanz

This comment has been minimized.

Copy link
Member

@dzenanz dzenanz commented Feb 12, 2020

Yes, that is one way too.

@lassoan

This comment has been minimized.

Copy link
Author

@lassoan lassoan commented Feb 12, 2020

I use the latest release candidate (ITK v5.1-rc01), which does not have this yet.

I've cherry-picked the content of #1476 but it did not help much. It still pollutes the log with hundreds of these messages (but at least it now shows the "deviation", too):

WARNING: In c:\d\s42rdi\itk\modules\io\imagebase\include\itkImageSeriesReader.hxx, line 444
ImageSeriesReader (0000025699395090): Non uniform sampling or missing slices detected , expected 0.3 got: 0.3 Deviation of:2.8310687127941e-15

Things that still need to be fixed:

  1. The current implementation still does not detect significant spacing variability correctly. If difference of slice spacing is less than 1% of the expected slice spacing then we should not report this (because if computed interpolated values at the real slice position then such small difference in slice position would not make any difference in the resulting voxel value). If we want to be very strict then we can make the threshold 0.1%; or if we suspect that there are paranoid ITK users then make this % threshold value configurable with a member variable.

  2. Showing a warning message for each slice is not useful (maybe add a verbose flag, default off, to enable it). One log message at the end could tell that "Variation of slice spacing is above the permitted threshold for x of N slices. Expected slice spacing is y, average difference is z, maximum difference is w".

  3. Terms are somewhat confusing:

  • "Non uniform sampling or missing slices detected" => I'm not sure what "sampling" this message is talking about; I think it should be "Non uniform slice spacing or missing slices detected"
  • "expected 0.3 got: 0.3 Deviation of:2.8310687127941e-15" => this suggests that we compute some kind of "standard deviation", while this is actually a simple "difference" or "error"; this would be better: "expected 0.3, got: 0.3, difference: 2.8310687127941e-15"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.