Subtracting two dicom images

Operating system: Windows
Slicer version: 4.10.2
Expected behavior: Subtract two DICOM images
Actual behavior:

I just started using the 3D Slicer. I want to ask if I can subtract two DICOM images from each other using a user-defined equation. Specifically, to subtract the CT number (Hounsfield unit) If yes what and where should I start?

Can you help me, please?

Hi, you can do this via the Subtract Image filter ( Module list>All modules> Simple Filters> SubtractImageFilter), there is also an AddImageFilter, MultiplyImageFilter , DivideImageFilter(and DivideFloor)

2 Likes

Thank you very much Amine Azami.

But still it does not work with my case because I need to use a formula in subtracting not a simple case of subtraction like A-B. What I want is to subtract Ax-Bx where A and B are the HU values and x is a constant value. Hope you can help me again. Thank you

Hi Amine Azami,

Can you help me with how can I subtract two Dicom images, specifically to subtract their HU values or CT number? But before subtracting, I need to multiply constant value to the HU value of each image. For image 1 I need to multiply constant x while for image 2 I need to multiply constant y.

Thank you very much.

In the itk Simple Filters module, you could use the ShiftScaleImage filter on each of your images, and the scale factor would be x or y in your case, and shift would be zero. (This multiplies all voxels by constant value). Then you can use the subtract image
filter with the output images.

You can combine volumes with arbitrary mathematical formula using numpy. See for example this post: Is it possible to view more than two image volumes at the same time in slice viewers?

Hi!

Thank you very much for your help. I will reply to you as soon as I can execute it.

Until next time. Thanks again.