# How to find a default colorbar unit or calibrate in mm

**URL:** <https://discourse.slicer.org/t/how-to-find-a-default-colorbar-unit-or-calibrate-in-mm/22501>\
**Category:** SlicerCMF\
**Created:** [March 14, 2022, 4:19pm UTC](https://discourse.slicer.org/t/how-to-find-a-default-colorbar-unit-or-calibrate-in-mm/22501 "2022-03-14T16:19:57Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lexus\_H](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lexus_h/32/4110_2.png) [@Lexus\_H](https://discourse.slicer.org/u/Lexus_H)\
**Post date:** [March 14, 2022, 4:19pm UTC](https://discourse.slicer.org/t/how-to-find-a-default-colorbar-unit-or-calibrate-in-mm/22501/1 "2022-03-14T16:19:57Z")

</div>

Hi,

I have been able to colormap surface difference with ranges from -5 to 0 then differences from model 1 to model 2 ranging from 3mm to 9mm so I am wondering if the color bar ranges or values are based on mm or whatever that is set by an user.

It will be nice to know units or ways to calibrate it.

Thanks,

---

<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:** [March 14, 2022, 4:39pm UTC](https://discourse.slicer.org/t/how-to-find-a-default-colorbar-unit-or-calibrate-in-mm/22501/2 "2022-03-14T16:39:48Z")

</div>

Length unit is in millimeters by default. So, unless you have changed it in application settings / units (which is very unlikely), the values that you see are in millimeters.

---

<div class="post-metadata">

**Author:** ![Lexus\_H](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lexus_h/32/4110_2.png) [@Lexus\_H](https://discourse.slicer.org/u/Lexus_H)\
**Post date:** [March 14, 2022, 4:44pm UTC](https://discourse.slicer.org/t/how-to-find-a-default-colorbar-unit-or-calibrate-in-mm/22501/3 "2022-03-14T16:44:34Z")

</div>

Thanks!  
If so, why is it not depicting the difference between -9 and 0, since my samples vary from 0 to 9mm?  
It seems to show in color if I set the range from -5 to 0 not -9 to 0.  
Do you have any suggestion how to set range?  
Best,

---

<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:** [March 14, 2022, 8:20pm UTC](https://discourse.slicer.org/t/how-to-find-a-default-colorbar-unit-or-calibrate-in-mm/22501/4 "2022-03-14T20:20:33Z")

</div>

The sign indicates if the closest point on one model is inside or outside the other model. If you are not interested in the sign then you can choose `absolute_closest_point` in `Model to model distance` module.

---

<div class="post-metadata">

**Author:** ![Lexus\_H](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lexus_h/32/4110_2.png) [@Lexus\_H](https://discourse.slicer.org/u/Lexus_H)\
**Post date:** [March 15, 2022, 1:38am UTC](https://discourse.slicer.org/t/how-to-find-a-default-colorbar-unit-or-calibrate-in-mm/22501/5 "2022-03-15T01:38:04Z")

</div>

The changes are inside, so the sign helps, but the signed ranges are between -5 to 0.9 when the real changes range from -9 to 0. It only makes sense to double the colorbar value then it makes up for the difference(change). Is there a way to make it 1:1 ratio? Or does that mean that anything deeper than -5 is not picked up by the colormap? Is there a way to change the setting?  
Thanks

---

<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:** [March 15, 2022, 3:09am UTC](https://discourse.slicer.org/t/how-to-find-a-default-colorbar-unit-or-calibrate-in-mm/22501/6 "2022-03-15T03:09:04Z")

</div>

By default the color legend is set to the data range, so if it is set to -5 to 0.9 then it means that the maximum distance found was 5mm. Note that closest distance measurement is not symmetric, so if you get an unexpected result it might be due to that you switched up the source and target models.

Make sure you use the latest Slicer Preview Release. It should look something like this:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/a/3/a3e28f08694e7a51b9da5d5c2b2039615dd16bc2.png)

If you want to change the displayed range then change `Data scalar range (auto)` to `Manual` and set the range that you prefer.

---

<div class="post-metadata">

**Author:** ![Lexus\_H](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lexus_h/32/4110_2.png) [@Lexus\_H](https://discourse.slicer.org/u/Lexus_H)\
**Post date:** [March 16, 2022, 2:58am UTC](https://discourse.slicer.org/t/how-to-find-a-default-colorbar-unit-or-calibrate-in-mm/22501/7 "2022-03-16T02:58:37Z")

</div>

I downloaded the preview release then changed the displayed range up to -8 which is the end of range then I ran predefect model as target and registered model of both pre and post as source. I still get the same result. Also, shapepopulation viewer was unstable. What else can I try now? Thanks

---

<div class="post-metadata">

**Author:** ![Lexus\_H](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lexus_h/32/4110_2.png) [@Lexus\_H](https://discourse.slicer.org/u/Lexus_H)\
**Post date:** [March 16, 2022, 2:59am UTC](https://discourse.slicer.org/t/how-to-find-a-default-colorbar-unit-or-calibrate-in-mm/22501/8 "2022-03-16T02:59:54Z")

</div>

![Screen Shot 2022-03-15 at 10.44.12 PM](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/2/3/234c84a11d522badbe00acd1dde7e58d72e709b0.png)

---

<div class="post-metadata">

**Author:** ![Lexus\_H](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lexus_h/32/4110_2.png) [@Lexus\_H](https://discourse.slicer.org/u/Lexus_H)\
**Post date:** [March 16, 2022, 6:46pm UTC](https://discourse.slicer.org/t/how-to-find-a-default-colorbar-unit-or-calibrate-in-mm/22501/9 "2022-03-16T18:46:37Z")

</div>

The displayed range should from -9 to 0 but the data suggests -6 to 0.9 so I don’t know what I need to do. If I leave it auto then iit ranges from -5 to 0.9.

Also, Shapepopulationviiewer is not found to install as an extension on the newest preview version.

Thanks,

---

<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:** [March 16, 2022, 7:20pm UTC](https://discourse.slicer.org/t/how-to-find-a-default-colorbar-unit-or-calibrate-in-mm/22501/10 "2022-03-16T19:20:51Z")

</div>

> [@Lexus\_H](#):
>
> The displayed range should from -9 to 0 but the data suggests -6 to 0.9 so I don’t know what I need to do. If I leave it auto then iit ranges from -5 to 0.9.

If you set `Scalar Range Mode` → `Data scalar range (auto)` then the displayed range should be the same as the data range. If you find that the selected scalar’s range is not the same as the displayed data range then let us know.

> [@Lexus\_H](#):
>
> Shapepopulationviiewer is not found to install as an extension on the newest preview version

Thanks for reporting, we are aware of this issue. The problem is expected to be fixed within a few days. You can track the progress here:

> <https://github.com/Slicer/Slicer/issues/5269>
>
> It is expected that due to VTK and other library updates, extensions may need to… be updated, too. This ticket tracks these necessary updates.
> 
> Extensions that were considered to be fixed: https://docs.google.com/spreadsheets/d/1GC4DWDpOXhuDYdfYOjJ6PmjHTeMM3-K7SoiC5ZR1GYg/edit?usp=sharing
> 
> Extensions that were decided to fix before Slicer5 release:
> \- \[x\] Chest\_Imaging\_Platform (\[C++11/14 configuration mismatch\](https://github.com/acil-bwh/ChestImagingPlatform/pull/42) + \[VTK API change\](https://github.com/acil-bwh/SlicerCIP/pull/37))
> \- \[x\] SlicerRadiomics (https://discourse.slicer.org/t/slicerradiomics-error/14258, https://discourse.slicer.org/t/factory-build-of-python-extensions-conflicting-with-each-other/21935)
> \- \[x\] SlicerVirtualReality (https://github.com/KitwareMedical/SlicerVirtualReality/pull/90)
> \- \[x\] ShapePopulationViewer
> \- \[x\] ShapeVariationAnalyzer
> \- \[x\] SPHARM-PDM
> \- \[x\] ukftractography
> \- \[x\] ModelToModelDistance
> \- \[x\] SlicerVMTK - macOS packaging is broken (https://github.com/vmtk/SlicerExtension-VMTK/issues/37)
> \- \[x\] SlicerJupyter - linux build failed, Python and library updates fixed it
> \- \[x\] SlicerElastix
> \- \[x\] SlicerRT - linux build error due to ITK https://github.com/SlicerRt/SlicerRT/issues/206
> \- \[x\] PathReconstruction - linux build fails, probably due to SlicerRT failure
> \- \[x\] SegmentRegistration
> \- \[x\] CMFreg - Windows build fails
> \- \[x\] DCMQI (see https://github.com/QIICR/dcmqi/issues/446)
> \- \[x\] Slicer-AirwaySegmentation
> \- \[x\] SlicerOpenIGTLink
> \- \[x\] SlicerIGSIO (https://github.com/IGSIO/SlicerIGSIO/issues/17)
> \- \[x\] SlicerDMRI

---

<div class="post-metadata">

**Author:** ![Lexus\_H](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lexus_h/32/4110_2.png) [@Lexus\_H](https://discourse.slicer.org/u/Lexus_H)\
**Post date:** [March 16, 2022, 7:39pm UTC](https://discourse.slicer.org/t/how-to-find-a-default-colorbar-unit-or-calibrate-in-mm/22501/11 "2022-03-16T19:39:50Z")

</div>

It was in Auto then you told me to do it manually on the preview release. My data ranges from -9 to 0 but displayed range runs from -5 (auto) to 0.9/ -6(manual) to 0.9.

So I am letting you know. Is there other version that has a way to set the range manually with a working shapepopulationviewer?  
Thanks

---

<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:** [March 16, 2022, 7:58pm UTC](https://discourse.slicer.org/t/how-to-find-a-default-colorbar-unit-or-calibrate-in-mm/22501/12 "2022-03-16T19:58:33Z")

</div>

> [@Lexus\_H](#):
>
> My data ranges from -9 to 0 but displayed range runs from -5 (auto) to 0.9/ -6(manual) to 0.9.

How did you determine that your data ranges from -9 to 0?

---

<div class="post-metadata">

**Author:** ![Lexus\_H](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lexus_h/32/4110_2.png) [@Lexus\_H](https://discourse.slicer.org/u/Lexus_H)\
**Post date:** [March 16, 2022, 8:02pm UTC](https://discourse.slicer.org/t/how-to-find-a-default-colorbar-unit-or-calibrate-in-mm/22501/13 "2022-03-16T20:02:42Z")

</div>

-9 to 0 means the difference betweeen model 1 (predefect) model 2 (post defect)

Are you referring to something else when you said data range?

---

<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:** [March 16, 2022, 8:14pm UTC](https://discourse.slicer.org/t/how-to-find-a-default-colorbar-unit-or-calibrate-in-mm/22501/14 "2022-03-16T20:14:32Z")

</div>

How did you get the -9 and 0 numbers: did you save the .vtk/.vtp file and looked into the file, or loaded it into ParaView, typed a Python command to in Slicer, …?

---

<div class="post-metadata">

**Author:** ![Lexus\_H](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lexus_h/32/4110_2.png) [@Lexus\_H](https://discourse.slicer.org/u/Lexus_H)\
**Post date:** [March 16, 2022, 8:21pm UTC](https://discourse.slicer.org/t/how-to-find-a-default-colorbar-unit-or-calibrate-in-mm/22501/15 "2022-03-16T20:21:27Z")

</div>

none of that but my gold standards range from -9 to 0 which I believe it was depicted in the dicom files. I also measured in dicom format and measured it to be -9 (inside of pre model) tto 0.

---

<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:** [March 16, 2022, 8:32pm UTC](https://discourse.slicer.org/t/how-to-find-a-default-colorbar-unit-or-calibrate-in-mm/22501/16 "2022-03-16T20:32:07Z")

</div>

Maybe the “gold standard” data set computes something different. For example, distance between corresponding points in two meshes is entirely different than distance between closest surface points. How the that gold standard range was computed? Do you know where the 9mm distance was measured in the gold standard data set?

---

<div class="post-metadata">

**Author:** ![Lexus\_H](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lexus_h/32/4110_2.png) [@Lexus\_H](https://discourse.slicer.org/u/Lexus_H)\
**Post date:** [March 16, 2022, 8:49pm UTC](https://discourse.slicer.org/t/how-to-find-a-default-colorbar-unit-or-calibrate-in-mm/22501/17 "2022-03-16T20:49:05Z")

</div>

Maybe the “gold standard” data set computes something different. For example, distance between corresponding points in two meshes is entirely different than distance between closest surface points: How do I check this?

How the that gold standard range was computed? It was created to be exact on model 2 which is same model 1 with defects.

Yes, it was the floor of defect from the crestal bone around a given tooth.

---

<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:** [March 16, 2022, 9:47pm UTC](https://discourse.slicer.org/t/how-to-find-a-default-colorbar-unit-or-calibrate-in-mm/22501/18 "2022-03-16T21:47:34Z")

</div>

Probably you did not get the answer you expected because the closest point on surface is searched in every directions. For example, if you simulated a cylinder-shaped hole then closest distance will not give you the depth of the hole but the maximum distance will be the radius of the cylinder. Closest distance is also not symmetric. The result depends on which surface you choose as source and target.

If you want to quantify bone loss then it may be easier to segment the bone on the two CBCTs and subtract the one with bone loss from the other. You can then use Segment Statistics module to get robust metrics, such as volume and oriented bounding box size.

---

<div class="post-metadata">

**Author:** ![Lexus\_H](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lexus_h/32/4110_2.png) [@Lexus\_H](https://discourse.slicer.org/u/Lexus_H)\
**Post date:** [March 16, 2022, 11:36pm UTC](https://discourse.slicer.org/t/how-to-find-a-default-colorbar-unit-or-calibrate-in-mm/22501/19 "2022-03-16T23:36:04Z")

</div>

Colormap did depict the change in right color scheme but the deepest end, which is -9, shows as -5 with auto, -6 with manual. Is thatt all I can get?

Also, regarding the bone loss, please elaborate steps in details for me.

1. How to substract
2. how to get robust metrics
3. how to get actual measurements  
Thanks

---

<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:** [March 17, 2022, 12:31am UTC](https://discourse.slicer.org/t/how-to-find-a-default-colorbar-unit-or-calibrate-in-mm/22501/20 "2022-03-17T00:31:03Z")

</div>

If it the automatic scalar range is up to -5 then it means that the maximum distance in the entire mesh is 5mm.

If you want to understand how this was computed then for example you can check what the value is at a specific mesh position using [this code snippet](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#get-scalar-values-at-surface-of-a-model).

Or you can copy-paste this code snippet to visualize a selected point on the output mesh, closest distance at that point, and the closest point position in the 3D view:

```python
modelNode = getNode('VTK Output File')

modelPointValues = modelNode.GetPolyData().GetPointData().GetArray("PointToPointVector")
pointListNode = slicer.mrmlScene.GetFirstNodeByName("F")

if not pointListNode:
  pointListNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLMarkupsFiducialNode","F")

while pointListNode.GetNumberOfControlPoints() < 2:
  pointListNode.AddControlPoint(0,0,0)

pointsLocator = vtk.vtkPointLocator() # could try using vtk.vtkStaticPointLocator() if need to optimize
pointsLocator.SetDataSet(modelNode.GetPolyData())
pointsLocator.BuildLocator()

import numpy as np

def onMouseMoved(observer,eventid):
  ras=[0,0,0]
  crosshairNode.GetCursorPositionRAS(ras)
  closestPointId = pointsLocator.FindClosestPoint(ras)
  ras = modelNode.GetPolyData().GetPoint(closestPointId)
  closestPointValue = modelPointValues.GetTuple(closestPointId)
  closestPointPositionOnOtherMesh = [ras[0]-closestPointValue[0], ras[1]-closestPointValue[1], ras[2]+closestPointValue[2]]
  distance = np.linalg.norm(np.array(ras)-np.array(closestPointPositionOnOtherMesh))
  print(f"distance = {distance:.1f} point1 = {ras} point2 = {closestPointPositionOnOtherMesh}")
  pointListNode.SetNthControlPointPosition(0, ras)
  pointListNode.SetNthControlPointPosition(1, closestPointPositionOnOtherMesh)

crosshairNode=slicer.util.getNode("Crosshair")
observationId = crosshairNode.AddObserver(slicer.vtkMRMLCrosshairNode.CursorPositionModifiedEvent, onMouseMoved)

# To stop printing of values run this:
# crosshairNode.RemoveObserver(observationId)

```

> [@Lexus\_H](#):
>
> Also, regarding the bone loss, please elaborate steps in details for me.
> 
> 1. How to substract
> 2. how to get robust metrics
> 3. how to get actual measurements

[This page](https://slicer.readthedocs.io/en/latest/user_guide/image_segmentation.html) is a good starting point for learning about image segmentation. You can subtract two segments by using `Logical operators` effect. You can get segmentation metrics (volume, bounding box size, etc.) using `Segment statistics` module.

[Next page](https://discourse.slicer.org/t/how-to-find-a-default-colorbar-unit-or-calibrate-in-mm/22501.md?page=2)
