Open klezm opened 4 years ago
Hi @klezm ,
Thanks a lot for your detailed and orderly pull request. Looks very good already. I will have a more detailed look next week after tuesday for merging :)
May I ask what type of image is your input in the pictures above? Just curiosity :)
I found some open datasets on http://www.informatik.uni-leipzig.de/~wiebel/public_data/index.html where I picked the "Abdominal MRI" dataset.
But for my purpose I used your tools to analyse microscopy images.
Btw. I would recommend you to look at the commits separately since most of the changes are from pyupgrade
That's the code i used to convert a numpy array to the nifti format.
import nibabel
import numpy as np
ims = np.arange(3*5*5).reshape((3, 5, 5))
print(ims.shape) # 3 Images of shape (5, 5)
ims = np.moveaxis(ims, 0, -1) # segmentator has a "cylce" button to move the axes as well
nii = nibabel.Nifti1Image(ims, affine = np.eye(4))
print(nii.dataobj.shape)
nibabel.save(nii, "test.nii")
# nii.to_filename("test.nii") # equivalent to the command above
Maybe I could implement the functionality to load folders as well.
Hey @klezm , cool. I did not work with microscopy images but I am happy to hear that Segmentator is being used on images other than MRI brains :).
If you would like to add functionality to load such images, I would be happy to have it as another pull request. Though, your code seems perfect for a quick nifti conversion. I also have similar scripts to generate synthetic images etc.
Sorry I was a bit late responding, had a paper came back for revision recently. Probably I will only have time to inspect the pull requests around a month or so. But I really appreciate your contribution, and do feel free to add the additional image loading capability if you wish so :)
Overall there are 4 changes to the code
Reds
towhite
andmagenta
Examples:
The same as above, but now with a bright image and a more transparent mask: