Mrmr
Mrmr

Reputation: 35

Overlay contour to medical image

I am trying to plot the contour of an image and get it overlaid over the original image but without filling, I would like it to appear as an edge contour instead of a filled contour like the attached picture.

enter image description here

I used this command but the problem is when I used the LabelOverlay function the image contrast changed! while I need to keep the same image intensity, any idea of how to solve it? The code is : sitk_show(SimpleITK.LabelOverlay(imgOriginal1, SimpleITK.LabelContour(imgOriginal2)))

Upvotes: 0

Views: 324

Answers (1)

Robbie
Robbie

Reputation: 4882

I would encourage you to check out platipy - a software package for which I am a developer and have built some nice tools for visualisation.

Here is an example:

import SimpleITK as sitk
from platipy.imaging import ImageVisualiser

img = sitk.ReadImage("./CT.nii.gz")
mask = sitk.ReadImage("./MASK_LUNGS.nii.gz")

vis = ImageVisualiser(img)
vis.add_contour(mask)
fig = vis.show()

fig.savefig("example.jpeg", dpi=300)

enter image description here

This tool is highly customisable, check out the documentation on Github :-)

Upvotes: 0

Related Questions