# DICOM scalar volume load: irregular geometry warning overly stringent?

**URL:** <https://discourse.slicer.org/t/dicom-scalar-volume-load-irregular-geometry-warning-overly-stringent/3761>\
**Category:** Development\
**Tags:** dicom\
**Created:** [August 13, 2018, 3:30pm UTC](https://discourse.slicer.org/t/dicom-scalar-volume-load-irregular-geometry-warning-overly-stringent/3761 "2018-08-13T15:30:15Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [August 13, 2018, 3:30pm UTC](https://discourse.slicer.org/t/dicom-scalar-volume-load-irregular-geometry-warning-overly-stringent/3761/1 "2018-08-13T15:30:15Z")

</div>

I noticed that geometry mismatch reporting is overly stringent in reporting errors:

```auto
Irregular volume geometry detected, but maximum error is within 
   tolerance (maximum error of 5.17578e-08 mm, tolerance 
   threshold is 0.001 mm).

```

I suggest that if the error is less than the limit, there should be no notification at all.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [August 13, 2018, 4:57pm UTC](https://discourse.slicer.org/t/dicom-scalar-volume-load-irregular-geometry-warning-overly-stringent/3761/2 "2018-08-13T16:57:28Z")

</div>

I think it’s helpful to know if there’s a nonzero geometry issue, even when it is below the threshold. It could make sense to define an epsilon to account for numerical issues, but it can be hard to pick a valid value for that so letting the user look at the value and, as in this case, ignore it because it’s small.

To put it another way, the Examine step should probably generate some kind of “report” or “assessment” data structure that would describe how well the data matches the requirements of the reader. The user could choose to look at this or not.

Currently it’s true that the 0.001 mm threshold is very arbitrary and not exposed to the user.

---

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [August 13, 2018, 5:24pm UTC](https://discourse.slicer.org/t/dicom-scalar-volume-load-irregular-geometry-warning-overly-stringent/3761/3 "2018-08-13T17:24:52Z")

</div>

> [@pieper](#):
>
> I think it’s helpful to know if there’s a nonzero geometry issue

There will always be a nonzero (ie, machine precision) geometry issue, which means there will always be that warning/error message. If we report warning/error every time, chances are it will be ignored, and important issues may be un-noticed. I am not sure it is helpful to know that there is an error of 5e-08. That is not an error.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [August 13, 2018, 5:41pm UTC](https://discourse.slicer.org/t/dicom-scalar-volume-load-irregular-geometry-warning-overly-stringent/3761/4 "2018-08-13T17:41:46Z")

</div>

What I’m saying is that there are really two thresholds of interest - one is the tolerance for “effectively zero” and once is the tolerance for non-zero but not significant. Would you want to ignore all values less than 1e-6? Perhaps we should add preference settings for both values.

---

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [August 13, 2018, 5:50pm UTC](https://discourse.slicer.org/t/dicom-scalar-volume-load-irregular-geometry-warning-overly-stringent/3761/5 "2018-08-13T17:50:30Z")

</div>

Yes, I agree, it makes sense to have 2 thresholds. I guess the difference between the 2 would be warning in the console, or warning in the loadables list?

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [August 13, 2018, 6:08pm UTC](https://discourse.slicer.org/t/dicom-scalar-volume-load-irregular-geometry-warning-overly-stringent/3761/6 "2018-08-13T18:08:55Z")

</div>

> [@fedorov](#):
>
> I guess the difference between the 2 would be warning in the console, or warning in the loadables list?

Yes, that’s what I would think. I guess the only question is the best default values for these, since most people wouldn’t be expected to change them in normal practice.

---

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [August 13, 2018, 6:21pm UTC](https://discourse.slicer.org/t/dicom-scalar-volume-load-irregular-geometry-warning-overly-stringent/3761/7 "2018-08-13T18:21:05Z")

</div>

I think adding the second threshold and setting it to 1e-6 should be harmless, even if it is not exposed in the preferences. All it will do is reduce the amount of red in the python console.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [August 13, 2018, 6:41pm UTC](https://discourse.slicer.org/t/dicom-scalar-volume-load-irregular-geometry-warning-overly-stringent/3761/8 "2018-08-13T18:41:36Z")

</div>

Okay - I’ll add that.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [August 13, 2018, 7:00pm UTC](https://discourse.slicer.org/t/dicom-scalar-volume-load-irregular-geometry-warning-overly-stringent/3761/9 "2018-08-13T19:00:06Z")

</div>

Committed:

[http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=27350](http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=27350)

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [August 14, 2018, 6:56am UTC](https://discourse.slicer.org/t/dicom-scalar-volume-load-irregular-geometry-warning-overly-stringent/3761/10 "2018-08-14T06:56:39Z")

</div>

Are these tolerances exposed in the application settings GUI? Tolerances may be different for a microCT or pre-clinical data sets, so it would be better if the user had control over it. We already expose some DICOM settings in the application settings, it should not be difficult to add some more parameters.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [August 14, 2018, 1:50pm UTC](https://discourse.slicer.org/t/dicom-scalar-volume-load-irregular-geometry-warning-overly-stringent/3761/11 "2018-08-14T13:50:34Z")

</div>

It could make sense to add them to the settings under the choice of applying the regularization or not. In reality the setting is more dataset-specific than global. We might think about expanding the concept of the DICOMPlugins to include a small user interface to select interpretation options as an alternative to generating a long list of loadables to select among.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [August 14, 2018, 1:51pm UTC](https://discourse.slicer.org/t/dicom-scalar-volume-load-irregular-geometry-warning-overly-stringent/3761/12 "2018-08-14T13:51:50Z")

</div>

For now the tolerances are optional at the python class level, so maybe it’s enough to provide an example of how to use it from the scripting level.

---

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [November 1, 2018, 2:40pm UTC](https://discourse.slicer.org/t/dicom-scalar-volume-load-irregular-geometry-warning-overly-stringent/3761/13 "2018-11-01T14:40:40Z")

</div>

Not a huge deal, but I just noticed that somehow the tolerance warning is also reported as CRITICAL in the log:

```auto
[WARNING][Python] 01.11.2018 10:19:02 [Python] (/Applications/Slicer.app/Contents/lib/Slicer-4.9/qt-scripted-modules/DICOMScalarVolumePlugin.py:681) - Irregular volume geometry detected, but maximum error non-zero but is within tolerance (maximum error of 0.000165356 mm, tolerance threshold is 0.001 mm).
[CRITICAL][Stream] 01.11.2018 10:19:02 [] (unknown:0) - Irregular volume geometry detected, but maximum error non-zero but is within tolerance (maximum error of 0.000165356 mm, tolerance threshold is 0.001 mm).

```

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [November 2, 2018, 1:32am UTC](https://discourse.slicer.org/t/dicom-scalar-volume-load-irregular-geometry-warning-overly-stringent/3761/14 "2018-11-02T01:32:51Z")

</div>

Looks to me like it’s calling logging.warning - why is it coming up as critical?

> **[Search · Irregular volume geometry detected · Slicer/Slicer](https://github.com/Slicer/Slicer/search?q=Irregular%2Bvolume%2Bgeometry%2Bdetected&unscoped_q=Irregular%2Bvolume%2Bgeometry%2Bdetected)**
>
> Multi-platform, free open source software for visualization and image computing. - Search · Irregular volume geometry detected · Slicer/Slicer

[https://github.com/Slicer/Slicer/blob/b0443c748cb51904dfd82fa603b4353a335e3364/Modules/Scripted/DICOMPlugins/DICOMScalarVolumePlugin.py#L669-L681](https://github.com/Slicer/Slicer/blob/b0443c748cb51904dfd82fa603b4353a335e3364/Modules/Scripted/DICOMPlugins/DICOMScalarVolumePlugin.py#L669-L681)

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [November 2, 2018, 3:20pm UTC](https://discourse.slicer.org/t/dicom-scalar-volume-load-irregular-geometry-warning-overly-stringent/3761/15 "2018-11-02T15:20:11Z")

</div>

> [@pieper](#):
>
> Looks to me like it’s calling logging.warning - why is it coming up as critical?

logging.warning messages are stored in the application log correctly as a warning.

However, the warning message is also printed on the console as standard error. Anything that is printed as standard error is stored in the application log as critical error (we have no way of knowing what kind of error was that or it was just a warning).

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [November 2, 2018, 3:45pm UTC](https://discourse.slicer.org/t/dicom-scalar-volume-load-irregular-geometry-warning-overly-stringent/3761/16 "2018-11-02T15:45:21Z")

</div>

Okay - makes sense - maybe the dicom loadables should have the option to return both warnings and errors, and then they would be printed to stdout and stderr respectively.
