There is a new KNIME forum. You can still browse and read content from our old forum but if you want to create new posts or join ongoing discussions, please visit our new KNIME forum: https://forum.knime.com

Segment Cropper Background Color

Member for

3 years 7 months joshuahoran

Hi all,

I am using the Segment Cropper to generate cropped sub-sections of a larger image based on circular labelings. In the Segment Cropper options I choose to set the background to "Max Value of Result". What I observe is that the node always selects 255 (for unsignedbyte image) even when 255 is not the max value in the circular region. I attach one such outcome image below. Using the image Features node I calculate that the max value within the circle is 233, not 255.

It appears to pick 255 for all inputs -- as if it was incorrectly hardcoded. Is there a way to make it use the max value in the image segment as the background color? This is important for subsequent image normalization steps.

Comments
Sun, 02/25/2018 - 02:04

Member for

6 years

gab1one

HI Joshua,

I am sorry for the misleading labeling of the option, the minimum refers to the min/max values of the image type. Which is 0 / 255 respectably, if you would convert the image to an different image type you would get a different result.

Mon, 02/26/2018 - 03:55

Member for

3 years 7 months

joshuahoran

Ah, okay I understand the behavior now. Thank you.

I was able to fix the background of the segment cropper node by running the output images through a python snippet with the following code ('IMAGE_COLUMN' is the name of the column containing the image to fix):

output_table = input_table.copy()

for index, row in output_table.iterrows():
    img = row['IMAGE_COLUMNl'].array
    img[img==255] = max(img[img!=255])

 

This replaces all white values with the next brightest value in the image. 

Files