[Neuroimaging] 2 questions about Image processing on nifti images
PLANTIN Baptiste
baptiste.plantin at altran.com
Mon Mar 2 10:57:38 EST 2020
Hi again !
OK I get a bit more why I can't do that so easily : I extracted the slices of the NIFTI image ("img_sobel_data"), filtered them, but I wasn't change the NIFTI image itself !!!
img = nib.load(im_path)
img_sobel = nib.load(im_path)
# Name the interested data
img_data = img.get_fdata()
img_sobel_data = img_sobel.get_fdata()
header = img.header
nb_img = header.get_data_shape()
nb_img_h = nb_img[2] #Hauteur
for sl in range(0,nb_img_h):
slice_h = img_data[:, :, sl]
#Sobel
sx = ndimage.sobel(slice_h, axis=0, mode='constant')
sy = ndimage.sobel(slice_h, axis=1, mode='constant')
sobel_h = np.hypot(sx, sy)
img_sobel_data[:, :, sl] = sobel_h #Change the image slice to the sobel one
# Save Sobel:
nib.save(img_sobel,imSobel_path)
So my question now : How to change the NIFTI image get from img_sobel.get_fdata() ?
Have a nice week !
De : PLANTIN Baptiste
Envoyé : vendredi 28 février 2020 15:22
À : 'neuroimaging at python.org' <neuroimaging at python.org>
Objet : 2 questions about Image processing on nifti images
Hello team,
Looking recently about MRI, I'm starting to work using your tool and I have two questions, one relative to a method and one about dataset nii.gz :
- I'm actually use the Sobel filter on a .nii slices. If the process is successfully done, I don't know how to create a new nifty image as a Sobel version of the original one. I tried this method:
· Load the original nifty image as "img"
· Load again the original image as "Sobel"
· Use the Sobel filtering on each slices
· For each slices (for loop), replace the slice in "Sobel" to the new filtered slice
· Save the new Sobel image in the file as "imSobelNumX"
This method don't work, it seems the slices are not replaced. It is due to the particular format or it is due to Python compiler ?
- Is there are a nii.gz dataset of the entire (And healthy) body somewhere in order to use it as reference for detection ? I found only a GIF in internet actually (http://www.madsci.org/~lynn/VH/Transverse.gif)
Thank you and best regards,
Cordialement,
Baptiste PLANTIN
Ingénieur Consultant
ALTRAN IDF
baptiste.plantin at altran.com<mailto:baptiste.plantin at altran.com>
[cid:image003.jpg at 01D2E8E2.CBD89F30]
2, rue Paul Dautier
78457 Vélizy Villacoublay
FRANCE
www.altran.com/fr<http://www.altran.com/fr%0d>
[cid:image004.jpg at 01D2E8E2.CBD89F30]<https://twitter.com/AltranFR> [cid:image005.jpg at 01D2E8E2.CBD89F30] <https://www.facebook.com/AltranFrance> [cid:image006.jpg at 01D2E8E2.CBD89F30] <https://www.linkedin.com/company-beta/3124/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20200302/9dfbf042/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 1892 bytes
Desc: image001.jpg
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20200302/9dfbf042/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.jpg
Type: image/jpeg
Size: 759 bytes
Desc: image002.jpg
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20200302/9dfbf042/attachment-0001.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.jpg
Type: image/jpeg
Size: 718 bytes
Desc: image003.jpg
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20200302/9dfbf042/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.jpg
Type: image/jpeg
Size: 745 bytes
Desc: image004.jpg
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20200302/9dfbf042/attachment-0003.jpg>
More information about the Neuroimaging
mailing list