dicom2stl icon indicating copy to clipboard operation
dicom2stl copied to clipboard

What is the threshold?

Open Kobe972 opened this issue 2 years ago • 6 comments

Does the threshold equal to the CT value? For example, the thresholds of bones are [200., 800., 1300., 1500.], but the CT value of a bone is often less than 1000. If not, how to get the threshold given the range of the CT value?

Kobe972 avatar Mar 22 '22 14:03 Kobe972

For CT bone it is using SimpleITK's DoubleThreshold filter:

https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1DoubleThresholdImageFilter.html

So the inner, narrow threshold (800-1300) is used as a starting point that is dilated but constrained to remain within the outer threshold (200-1500).

You can choose your own double threshold values yourself with the '--double' option. Of if you prefer the more traditional iso-value, you can use the '--isovalue' flag.

dave3d avatar Mar 22 '22 14:03 dave3d

For CT bone it is using SimpleITK's DoubleThreshold filter:

https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1DoubleThresholdImageFilter.html

So the inner, narrow threshold (800-1300) is used as a starting point that is dilated but constrained to remain within the outer threshold (200-1500).

You can choose your own double threshold values yourself with the '--double' option. Of if you prefer the more traditional iso-value, you can use the '--isovalue' flag.

There are two problems:

  • I read the url given above and I thought I have misunderstood something. I replaced [200., 800., 1300., 1500.] with [200., 800., 800., 1500.], and got the same result. But if I use BinaryThreshold and set the threshold as (200,1500), something extraneous are included. Why is that?
  • How to convert Hu range to your double threshold value?

Kobe972 avatar Mar 22 '22 16:03 Kobe972

Yeah, using [200., 800., 1300., 1500.] would probably get you the same results as the default set. As far as the extraneous stuff when using BinaryThreshold, that's the nature of it. They came up with the DoubleThreshold algorithm to avoid the extraneous stuff that can arise.

The numbers I'm using are unitless. So if your image is CT with Hounsfield units, then that's what threshold values are. I chose those numbers just based on experimenting with some CT images in Hounsfield units that I had. They seemed to work well for me, and corresponded with the Hounsfield units I saw in the literature.

dave3d avatar Mar 22 '22 18:03 dave3d

Yeah, using [200., 800., 1300., 1500.] would probably get you the same results as the default set. As far as the extraneous stuff when using BinaryThreshold, that's the nature of it. They came up with the DoubleThreshold algorithm to avoid the extraneous stuff that can arise.

The numbers I'm using are unitless. So if your image is CT with Hounsfield units, then that's what threshold values are. I chose those numbers just based on experimenting with some CT images in Hounsfield units that I had. They seemed to work well for me, and corresponded with the Hounsfield units I saw in the literature.

  • Double thresholding means preserving data ranging from 200 to 1500 but exclude[830...1300]. For example,double thresholding [1,2,...,1600] will get [200,201,...,829,1301,...,1500], so if I change the thresholds to [200,800,800,1500] will get a different result(almost nothing excluded), which is contradictory to the fact.
  • You said "and corresponded with the Hounsfield units I saw in the literature", but I found they are not corresponding. For example, the Hu value of soft tissue is 30 to 50, but the double thresholds, i.e., [-15., 30., 58., 100.],which means -15<=Hu<(=)30 or 58<=Hu<(=)100 just blocked it.
  • So what each element stored in img is? The pixel?

Kobe972 avatar Mar 23 '22 00:03 Kobe972

Here is the description of ITK's DoubleThreshold filter:

Double threshold uses the narrow threshold image as a marker image and the wide threshold image as a mask image in the geodesic dilation. Essentially, the marker image (narrow threshold) is dilated but constrained to lie within the mask image (wide threshold). Thus, only the objects of interest (those pixels that survived the narrow threshold) are extracted but the those objects appear in the final image as they would have if the wide threshold was used.

It seems that your understanding of double thresholding does not correspond with that.

You might try to implement your own segmentation approach using the variety of filters ITK/SimpleITK. Then once you have a binary segmentation image, you can pass that to my script, with an iso-value of 0.5, and extract out an STL surface of your segmentation.

dave3d avatar Mar 23 '22 19:03 dave3d

I've read the full document of DoubleThreshold but still misunderstanding. Could you please explain what the marker image and the mask image exactly means? For example, could you rewrite [20,800,1300,1500] in a sort of formal mathimatical manner? Normal threshold [20,1500] can be rewritten as 20<=x<=1500.

Kobe972 avatar Mar 24 '22 02:03 Kobe972