Why is the exported simpel segmentation so blocky compared with simple segmentation in preview?

Hi,

I very recently started to look into using ilastik for more advanced segmentations. We do not use image formats as hd5 etc and need therefore need to convert results to image formats like jpg or tif. My source image is a color 2752 x 2208, 3, uint8 image. I have changed export settings to source simple segmentaion and tried to convert to image formats like uint8 jpg or tif. However, the exported image is very blocky compared with the image in preview mode. How can I avoid that?

Kind regards

Fredrik

Hi @Fredrik,

that sounds like an interesting effect that you are seeing there (which is absolutely note intended). Would it be possible for you to share the results, so that we can better understand the blockiness of the output?

On a side note: exporting to jpg is often not a good idea, jpg adds lossy compression, which in turn means that you loose data. Tif should be fine.

I have just tested the jpeg export. I think the problem in the case of the simple segmentation really is the jpeg compression that blockifies it. The problem is that the simple segmentation will assign 0 values to pixels of the first label, 1 to pixels of the second label, 2 to the pixels that are classified the third label, and so on. So the jpeg compression was more designed for natural images with higher dynamic range, and produces these kind of artifacts here, where all the information is distributed in only low pixel values, that are mostly organized in larger areas. Can you maybe try exporting to tiff, or png to check the result? Those don’t add lossy compression.
Alternatively you could export to hdf5 :slight_smile:

edit: added image:
is this the kind of blocking you are seeing?
blah

Hi,

Thank you for your answer! Yes, I got these blocky images. However, as you mentioned the problem seems to be limited to the jpg conversion algoritm which does not really manage these sharp pixel value boundaries. But tiff works as expected both directly when viewed in the ilastik applet area (simple segmentation - exported) and when I look on the exported image in a different viewer after equalization of the histogram. I did not really expect this very bad jpg result although I of course know its a lossy format. But in a world of producing hundreds of images each day, of which many are stored in databases, you do sometimes need to stick to formats such as jpg… :slight_smile:

So my conclusion is then: avoid jpg for these conversions of segmention images.

Kind regards
Fredrik

Hi @Fredrik,

great that it sort of sorted your problem.

Would PNGs be an alternative for you? Those compress lossless (and those segmentations usually compress very well).