I have some 3D CT scan images. Some slices of that image contains unnecessary things. I want remove that things giving the intensity value -1000. How can I do that?
Asked
Active
Viewed 167 times
0
-
may I suggest numpy tutorials. -- how do you read and "handle" that data? what libraries do you use? – Christoph Rackwitz Nov 16 '21 at 10:29
-
I have used SimpleITK library to read image and convert to numpy array. – a_variable Nov 16 '21 at 11:08
-
If I understand it right, just compare the array with the value -1000, to get a mask with true or false, and then use the mask to remove the things you don't want. – Kaiwen Nov 17 '21 at 08:35
1 Answers
0
Since you're loading with SimpleITK, here's how you can do it with SimpleITK
import SimpleITK as sitk
ct_image = sitk.ReadImage("your_ct_scan_here")
# produce a binary mask image for all pixels>-1000
mask_image = (ct_image>-1000)
# apply the mask to make a new image
new_ct_image = ct_image * mask_image
sitk.WriteImage(new_ct_image, "masked_ct_image.nii.gz")

Dave Chen
- 1,905
- 1
- 12
- 18