Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation obtained doesn't seem to be right #23

Open
marin-combeau opened this issue Mar 27, 2023 · 14 comments
Open

Segmentation obtained doesn't seem to be right #23

marin-combeau opened this issue Mar 27, 2023 · 14 comments

Comments

@marin-combeau
Copy link

Hello, I applied the algorithm to a CT scan that I have, and the resulting segmentation in itself seems to be good, it looks like a nice brain, but it doesn't seem to fit my the CT scan that was in input. Indeed, first I have to translate the segmentation because it is far away from where the head is on the CT scan, and secondly the shapes and the size don't fit, it seems like it is showing the results from another head.
I used the line docker run --rm -it -v "/home/labeyrie/Téléchargements/CTseg":/data ubuntu:ctseg function spm_CTseg '/data/patient_001_S1.nii'
and here are the results, displaying the input CT scan:
Capture d’écran de 2023-03-27 10-00-09
wc version:
Capture d’écran de 2023-03-27 09-58-20
mwc version:
Capture d’écran de 2023-03-27 10-27-28
Am I doing something wrong?

@gllmflndn
Copy link
Collaborator

Hi @marin-combeau, you should use the c* files (the wc* and mwc* files are normalised segmentations). Are they not present in your output directory?

@marin-combeau
Copy link
Author

Hi, I had tested it and I thought it was worse than the others, but with more observation I realised that it seems to be better, but still too large compared to the scan and not in the right position (I had to do a translation and a rotation), is it a problem in the header information, like voxel dimension or something like that?
here are the pictures:
Capture d’écran de 2023-03-30 12-00-41
Capture d’écran de 2023-03-30 12-02-40
I also notice that the skin segmentation is taking some of the background in addition to the actual skin:
Capture d’écran de 2023-03-30 12-06-17
Capture d’écran de 2023-03-30 12-07-48

@gllmflndn
Copy link
Collaborator

It might create other problems but could you try again with correct_header set to false:

docker run --rm -it -v "/home/labeyrie/Téléchargements/CTseg":/data ubuntu:ctseg eval "spm_CTseg('/data/patient_001_S1.nii','',true,true,false)"

@marin-combeau
Copy link
Author

Now the segmentations 1, 2 and 3 are empty, and the 4, 5 and 6 give this:
Capture d’écran de 2023-04-04 10-30-55

@gllmflndn
Copy link
Collaborator

So it did indeed create other problems ☹️ At this stage, it's best waiting for @brudfors's comment as I don't know what the issues with CT headers are and I might be looking in the wrong direction anyway.

@marin-combeau
Copy link
Author

Okay, thanks

@JohnAshburner
Copy link

It looks to me like the registration part of the algorithm is struggling to register the adult head tissue priors to the CT of a baby's head. Unfortunately, I don't have a good fix for this - other than for someone to generate a set of baby tissue priors.

@marin-combeau
Copy link
Author

Thanks for your answer, but the scan I am feeding the algorithm with is the one of an adult, but indeed the segmentation obtained seems like the one of a baby, I guess because of the differences in the dimensions.
I am also checking the nifti header of the CT scan to search for problem that could explain this, I have this result (it could be different from the ones used for the training of the algorithm, which could cause problems I guess):

<class 'nibabel.nifti1.Nifti1Header'> object, endian='<'
sizeof_hdr      : 348
data_type       : b''
db_name         : b''
extents         : 0
session_error   : 0
regular         : b'r'
dim_info        : 0
dim             : [  3 320 320 160   1   1   1   1]
intent_p1       : 0.0
intent_p2       : 0.0
intent_p3       : 0.0
intent_code     : none
datatype        : int16
bitpix          : 16
slice_start     : 0
pixdim          : [-1.    0.76  0.76  0.99  1.    1.    1.    1.  ]
vox_offset      : 0.0
scl_slope       : nan
scl_inter       : nan
slice_end       : 0
slice_code      : unknown
xyzt_units      : 10
cal_max         : 0.0
cal_min         : 0.0
slice_duration  : 0.0
toffset         : 0.0
glmax           : 0
glmin           : 0
descrip         : b'Time=200837.748;mb=159'
aux_file        : b''
qform_code      : scanner
sform_code      : scanner
quatern_b       : 0.0
quatern_c       : 1.0
quatern_d       : 0.0
qoffset_x       : 204.47557
qoffset_y       : -32.717865
qoffset_z       : 199.90698
srow_x          : [ -0.76  -0.     0.   204.48]
srow_y          : [  0.     0.76   0.   -32.72]
srow_z          : [  0.     0.     0.99 199.91]
intent_name     : b''
magic           : b'n+1'

@brudfors
Copy link
Contributor

I think the header looks OK, and setting correct_header=true should take care of any affine matrix related issues regardless.

Are you sure the scan is not of a young child? Your 3D Slicer screenshot above (#23 (comment)) suggests it is; from looking at the 3D rendering and the fact that the head in the scan is small compared to the predicted segmentation.

@marin-combeau
Copy link
Author

Hi, thanks for your answer, yes I am sure that the scan in the screenshot is the one of an adult (24yo), and the 3D rendering is showing the predicted segmentation, which I think gives the impression of a baby/young child skull since the height seems good, but the width and length are higher.

@JohnAshburner
Copy link

JohnAshburner commented Apr 17, 2023 via email

@JohnAshburner
Copy link

JohnAshburner commented Apr 17, 2023 via email

@marin-combeau
Copy link
Author

I used dcm2niix to convert to nifti, through the software MRIcroGL, with the line

/home/labeyrie/Téléchargements/MRIcroGL_linux1804/MRIcroGL/Resources/dcm2niix -f "%f_%p_%t_%s" -p y -z n -o "/home/labeyrie/Documents/Marin/essai dicom to nifti" "/home/path/of/dicom/to/convert"

and I believe Guillaume Flandin told me that the conversion should be okay using this

@gllmflndn
Copy link
Collaborator

One thing you could do is to display the images within SPM to see if they look the same than within the software you are currently using. To do so, you can use the instructions below to open the SPM interface:
https://en.wikibooks.org/wiki/SPM/Docker#SPM_Containers
where you replace spmcentral/spm fmri by ubuntu:ctseg.
You can then use the Display or CheckReg buttons to display one or several images.
You will now also see the DICOM Import button allowing you to do the DICOM to NIfTI conversion with SPM instead of dcm2niix, as discussed above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants