WCHN / CTseg

Brain CT image segmentation, normalisation, skull-stripping and total brain/intracranial volume computation.
GNU General Public License v3.0
55 stars 17 forks source link

HOW to produce final coloful CTSeg? #27

Closed xinnvY closed 4 months ago

xinnvY commented 4 months ago
ct

I have reproduced code using docker,final dirout including c[1-6],wc[1-6],mwc[1-6],y~, I want to asked that is all the output imaging?but how i form the colorful CTSeg as you gaved the example. thanks.

brudfors commented 4 months ago

Hi @xinnvY, That colorful image was created with code not available in CTseg. To reproduce, simply stack the c[1-6] (or wc[1-6]) images and do an argmax along the segmentation class dimension. You can then use some visualization function, like imshow in MATLAB.

xinnvY commented 4 months ago

Thank you for your reply, I wonder if you can share your implementation code of this part, I would appreciate greatly!

---- Replied Message ---- | From | Mikael @.> | | Date | 03/12/2024 16:59 | | To | @.> | | Cc | @.>@.> | | Subject | Re: [WCHN/CTseg] HOW to produce final coloful CTSeg? (Issue #27) |

Hi @xinnvY, That colorful image was created with code not available in CTseg. To reproduce, simply stack the c[1-6] (or wc[1-6]) images and do an argmax along the segmentation class dimension. You can then use some visualization function, like imshow in MATLAB.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

xinnvY commented 4 months ago
code10

Hi@brudfors, i have tried to implement the stack of wc[1-6], stacked shape as image shows [181,217,181,6].I then do an argmax by command 'segmentation = np.argmax(stacked_image, axis=-1)',but i cant open correctly segmenting.nii using itk-SNAP.i wonder if i hava made mistakes in the step of do an argmax ,i really dont understand this detail step as you said along the segmentation class dimesion. looking forward to your answer,thanks!

brudfors commented 4 months ago

I am not sure why you want to open segmenting.nii? The below snippet is more or less what I did, where you have to adjust the colour palette to your liking:

import numpy as np
import matplotlib.pyplot as plt

x = np.random.rand(181, 217, 181, 6)  # this should be the segmentations stacked
y = np.argmax(x, axis=-1)
c = plt.imshow(y[..., 4])
xinnvY commented 4 months ago

Thanks! i see. Actually, i just want to implement the segment task of CT brain image.With best wishes!