by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Ghost
@ghost~565b49ee16b6c7089cbc9b44
Hi! :) Are there any libraries to read/write binary .bmp files in Python ecosystem?
Davis Bennett
@d-v-b
Ghost
@ghost~565b49ee16b6c7089cbc9b44
@d-v-b imageio doesn't work with booleans, as far as I remember.
Davis Bennett
@d-v-b
ah sorry, i misread "binary"
Mark Harfouche
@hmaarrfk
@soupault you can try to add the functionality you need https://github.com/hmaarrfk/redpil
Juan Nunez-Iglesias
@jni
@soupault my very vague understanding of these things is that bmp is a pretty simple format. Perhaps you should extend imageio to support binary bmps? =)
Mark Harfouche
@hmaarrfk
@jni, yeah redpil does alot of reading the metadata and builds the infrastructure you would need to support these images.
I actually think I implemented reading boolean images. I have a test for it:
https://github.com/hmaarrfk/redpil/blob/master/redpil/tests/test_bmp.py#L76
The hard thing to understand is that boolean images are forced to be palletted, so even though there are only 2 possible values, those values will have RGB values assigned to them.
but the test also seems to indicated that pillow is also able to read the same image
Juan Nunez-Iglesias
@jni
@hmaarrfk why did you decide to write redpil independently rather than contribute to imageio?
Mark Harfouche
@hmaarrfk
just faster development cycle. imageio also stated that it was a frontend to other plugins
Mark Harfouche
@hmaarrfk
eventually, i guess I didn't care for a few reasons:
  1. bitmaps force your data to be 4 byte aligned. Seems like an unecessary limitation for RGB or gray data.
  2. imageio got the pillow settings correct so as to write images at (native?) speeds
Juan Nunez-Iglesias
@jni
@hmaarrfk what do you mean you didn't care? Are you saying the redpil bmp code is bit-rotting/unmaintained? I don't have much skin in this game, just want to get an accurate view of the image io landscape in Python
Mark Harfouche
@hmaarrfk
I think to displace Pillow would take a lot of work. Putting some experimental code in imageio would be dangerous. Originally, i thought there would be a speed advantage. And there was, but I submitted some patches to imageio that helped in that regard. Now redpil supports a different subset of bmp than Pillow so that might be a plus. There were a few examples in some BMP library that I wanted to get to really complete coverage of the BMP standard.
That is an issue I opened up in Pillow for them to expand support for bmp
Ghost
@ghost~565b49ee16b6c7089cbc9b44

@soupault my very vague understanding of these things is that bmp is a pretty simple format. Perhaps you should extend imageio to support binary bmps? =)

I'll consider this :). Need some sample data first...

@hmaarrfk thanks for your link. Looks like a nice place to contribute experimental code :).
Ghost
@ghost~565b49ee16b6c7089cbc9b44
Have you seen this early-alpha GitHub Workflow thing - https://user-images.githubusercontent.com/527589/46967252-9d15c200-d075-11e8-886f-19af1cf545fd.gif ? Perhaps, we should think about moving our infra (CI backend, releasing, ASV hooks, etc) to this platform once it's made public.
Kira Evans
@kne42
whoah that looks super cool!
E | M
@ewuramaminka

I have loaded CT dicom images. I want to segment the tissue within the CT. E.g. I want to determine there is 30% soft tissue 45% bone tissue, 20% air etc ... based on hounsefield units.

Anyone an expert in biomedical image analysis with scikit image?
Any useful libraries?

Looking for help. Thanks ☺️

Curtis Rueden
@ctrueden
@ewuramaminka I would encourage you to start a thread on https://forum.image.sc with an example of your images, and tagged with scikit-image.
E | M
@ewuramaminka
@ctrueden sure. Doing this now. Thanks
E | M
@ewuramaminka
for a frame of image slices --> fig, axes=plt.subplots(nrows=2, ncols=36) how can I maximize the frame ? I have tried ==> mng = plt.get_current_fig_manager()
mng.resize(*mng.window.maxsize()) but i get AttributeError: 'FigureManagerBase' object has no attribute 'window'. please assist.
Mark Harfouche
@hmaarrfk
you want to maximize the window?
E | M
@ewuramaminka

Yes. Because i made over 70 subplots and figure is so small as shown in console

Can my subplot frame be created in a window which can be maximized ?

Mark Harfouche
@hmaarrfk
making 70 subplots seems like a bad idea, do you have a 20k screen that is 60 inches wide?
Kevin Mader
@kmader
@ewuramaminka for processing medical CT images using skimage, a great starting resource is the Data Science Bowl 2017 with a large number of Jupyter Notebooks (called Kaggle Kernels) on how to preprocess the data, segment lungs, and ultimately train models: https://www.kaggle.com/gzuidhof/full-preprocessing-tutorial and https://www.kaggle.com/ankasor/improved-lung-segmentation-using-watershed are a good start. They also deal directly with the DICOM data and show how that can be opened, rescaled, etc. The kernels page is here: https://www.kaggle.com/c/data-science-bowl-2017/kernels and the competition also has a large number of discussions which can provide useful starting points.
E | M
@ewuramaminka
@kmader thanks a lot!
Tanim Islam
@tanimislam
Hi all, can scikit-image save an M×NM \times N integer numpy array into a 16-bit grayscale image?
Juan Nunez-Iglesias
@jni
yep, if you do from skimage import io; io.imsave('filename.png', arr.astype(np.uint16)), it should work. I'm assuming of course that you don't have any integers larger than 65535
Tanim Islam
@tanimislam
thanks @jni
and yes, no integers larger than 65535 (numpy array represents 16-bit grayscale data)
Stefan van der Walt
@stefanv

Hi everyone; we're going to try something new for the chat forum. Please direct your browsers to:

https://skimage.zulipchat.com

(or download the app)

We'll try this forum for a few weeks to see how it goes!

Sreekar Reddy
@sreekar2307
Any non-intelligent algorithms for image classification?
E | M
@ewuramaminka
How do I load a nifty image ? I want to use threshold otsu to separate composition

I used nibabel to load it fine but it’s a 3D and I threshold it using threshold_otsu

The error I’m getting is “Nifti1Image’ object has no attribute min

Please assist
Curtis Rueden
@ctrueden
@ewuramaminka Are you able to post a link to a sample non-working NIFTI image?
E | M
@ewuramaminka
Sure
Curtis Rueden
@ctrueden
@ewuramaminka Is this image all zeroes?
Nevermind, I see that it is not.
@ewuramaminka I got it working by opening the image through ImageJ using pyimagej. :-)
Curtis Rueden
@ctrueden
I will post a gist shortly.
This gets you a numpy array from your NIFTI data, which is presumably what you want? Then you can analyze it with skimage (and/or ImageJ) as per usual.
Curtis Rueden
@ctrueden
@ewuramaminka I checked your code and saw you using SimpleITK. Is that working? If so, you could also stick with that.
You mention nibabel above… your error suggests to me the object you get back isn’t an numpy array, but a Nifti1Image object. There is probably a function you can call on it that will give you a numpy array? Sorry, I don’t know that library.