# Thresholding for DICOM images

**URL:** https://discourse.itk.org/t/thresholding-for-dicom-images/2704
**Category:** Beginner Questions
**Created:** [February 11, 2020, 11:11pm UTC](https://discourse.itk.org/t/thresholding-for-dicom-images/2704 "2020-02-11T23:11:16Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![ShaneKirkbride](https://discourse.itk.org/user_avatar/discourse.itk.org/shanekirkbride/32/1225_2.png) [@ShaneKirkbride](https://discourse.itk.org/u/ShaneKirkbride)
#### Post date: [February 11, 2020, 11:11pm UTC](https://discourse.itk.org/t/thresholding-for-dicom-images/2704/1 "2020-02-11T23:11:16Z")

</div>

I’m trying to render an isoSurface with a series of dicom images. However I’d like to threshold this surface because some of the data isn’t good. Is there a way to threshold? In VTK I do something like this:

```
  vtkSmartPointer<vtkMarchingCubes> surface = vtkSmartPointer<vtkMarchingCubes>::New();
  surface->SetInputData(volume);
  surface->ComputeNormalsOn();
  surface->SetValue(0, isoValue);

```

Where isoValue is some number thresholding I set. is there something like this in ITK?  
Thanks,  
~Shane

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [February 12, 2020, 1:33pm UTC](https://discourse.itk.org/t/thresholding-for-dicom-images/2704/2 "2020-02-12T13:33:40Z")

</div>

Yes. Use [BinaryThreshold](https://itk.org/Doxygen/html/classitk_1_1BinaryThresholdImageFilter.html) followed by [BinaryMask3DMeshSource](https://itk.org/Doxygen/html/classitk_1_1BinaryMask3DMeshSource.html) or [CuberilleImageToMeshFilter](https://itk.org/Doxygen/html/classitk_1_1CuberilleImageToMeshFilter.html) (Cuberille is a remote module which needs to be turned on during ITK’s configure step).

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.itk.org/user_avatar/discourse.itk.org/lassoan/32/27_2.png) [@lassoan](https://discourse.itk.org/u/lassoan)
#### Post date: [February 13, 2020, 8:01pm UTC](https://discourse.itk.org/t/thresholding-for-dicom-images/2704/3 "2020-02-13T20:01:19Z")

</div>

> [@ShaneKirkbride](#):
>
> I’d like to threshold this surface because some of the data isn’t good

Simple global thresholding is always a good start but except extreme cases (e.g., segmenting bone on very high quality CT), segmentation is more complicated than that. What would you like to segment on what kind of images? Can you post a few screenshots?

---

<div class="post-metadata">

### Author: ![ShaneKirkbride](https://discourse.itk.org/user_avatar/discourse.itk.org/shanekirkbride/32/1225_2.png) [@ShaneKirkbride](https://discourse.itk.org/u/ShaneKirkbride)
#### Post date: [February 13, 2020, 8:09pm UTC](https://discourse.itk.org/t/thresholding-for-dicom-images/2704/4 "2020-02-13T20:09:40Z")

</div>

I’m taking CT scans of a left ventricle (of course this is a non-human heart):  
 ![image](https://discourse.itk.org/uploads/default/original/2X/c/cae8cc5350b6e49bdf7b079137f7a4d29654a657.png) This is with the isoValue = 150 (correct result)

This is with the isoValue=10  
 ![image](https://discourse.itk.org/uploads/default/original/2X/4/41e3f4237ce840cfe6622a59bb9ead039224c73c.png)

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.itk.org/user_avatar/discourse.itk.org/lassoan/32/27_2.png) [@lassoan](https://discourse.itk.org/u/lassoan)
#### Post date: [February 16, 2020, 6:02pm UTC](https://discourse.itk.org/t/thresholding-for-dicom-images/2704/5 "2020-02-16T18:02:10Z")

</div>

In general, you cannot segment the left ventricle from cardiac CT using simple global thresholding because there are several structures that has the same intensity range. You can combine a few simple steps, such as thresholding or cutting, or competing region growing methods - see for example this complete heart segmentation workflow using 3D Slicer:

With some more effort, you can create fully automated segmentation methods either using classic or deep learning based methods - there are lots of papers about this topic that you can get inspiration from.

---

<div class="post-metadata">

### Author: ![ShaneKirkbride](https://discourse.itk.org/user_avatar/discourse.itk.org/shanekirkbride/32/1225_2.png) [@ShaneKirkbride](https://discourse.itk.org/u/ShaneKirkbride)
#### Post date: [February 16, 2020, 7:27pm UTC](https://discourse.itk.org/t/thresholding-for-dicom-images/2704/6 "2020-02-16T19:27:34Z")

</div>

@lassoan Thanks for the info. It was my _hope_ our customer would provide this for us 🙂 but for my first dataset they did not. We’ll just do some simple cutting for now so they can see this work and move forward from there.  
~Shane
