Beginner Questions - GroupBy Median - Performance - Split and Recombine of Image Stack

What am i doing:

I have a stack of images fluorescence and brigth field containing cells (Imaging Flow Cytgometry). At the end i want to do object detection, classification and tracking. But at the Moment i struggle with the pre-processing.

1. Split and recombine

The image series i use contains alternating bright field and fluorescence images.

Is it possible to split the stack by group every second image to the same group?

The second question, for devignetting and background substraction i use the partitioning node to take out n - images for calculation the devignetting matrix and bg matrix. Is it possible to recombine both partions so i dont lose n images for my analysis?

2. Median

I use the GroupBy Node for calculating the mean of n images. But cant figure out how to calculate the median?

3. Last Question. A lot of nodes have some image view options do they have any influence to the performance and is it possible to turn them off?


Thank you

Hi Eiby,

1. Yes, you can use the Column to Grid node to do this, select the column you want to split up and set the Grid Column Count

1b) To recombine a table you split with the Partition node, you can use the Concatenate node,

2. I attached an example workflow that shows how you can use the Image Features node to calculate the median (Quantil 50) of a series of images.

3. The image view does not influence the performance of the node at all, it only uses resources when you actually open a view.



PS: Did you have a look at our example workflows yet? You can find them at: and on the example server.

Thank you for your helpful response. Just one more question. I do not need the median value of the merged image what i want is a median image for background substraction. My images are taken in continuous flow, when i take the mean image for background substraction i have artefacts of the flowing cells from each single image in the mean image. When i use a median image i should get rid of this artefacts.



PS: is there reason you  swapping the rows and columns in your example?

Hi Andy,

To generate the median image, you just need to swap out the Image calculator node with a Projector node (see attached workflow), important is that you select the correct projection direction, it must be the same as the merge dimension in the Merger node.

The rows and columns are swapped because the merger operates on images row by row.




first, thank you gabriel for your help. Finally i found some time to continue working with knime. The Problem i now have is to substract the median image from a stack of images. I tried using the joiner in combination with the image calculator. I think that failed because of the row missmatch? So i tried to use a chunk loop in front of the "joiner" node for the stack-images with only one row per chunk but it`s still not working.



Hi Andy

The Joiner node requires a join predicate (a common property) to perform a join. In your case, of joining one row with many others, you might want to use the Cross Joiner node, which does not need a predicate.



Thank you again...i got the segmentation and the feature extraction running. But now i face two more thinks i cant figure out how to do.

I use the segment Cropper node to have each object as a single image file. Two things i want to do, first, i want to have them all in the same size. It looks like i can´t divine the ROI size and as second i want to draw the contours lines into the croped image to verify the detection quality. At the moment i use the interactive segmentation but i it looks like you can only overlay the image with the bounding box and the whole segmented area and not just the contour lines.

A quick introduction what i want to do (i`m not asking for a solution just for hints):

I have images which show the autofluorescence of algeas. I want to detected the single algeas and do some feature extraction for later classification. The Problem i face is that the fluorescence signals are very diverse depending on their conditions. What makes it quit hard to detected all of them with the same quality. When i make the detection to sensitiv the contour area of the bright ones is to large and the other way around the weak object are hardly detected. What i want to do is, doing a first rough detection and then run a second edge detection over the croped images.




Hi Elby,

I hope I can help you out with the following tips:

  • You can use the Labeling Resizer and the Image Resizer node to resize segments and labelings to a  desired size.
  • You can use the Extract Outline Labeling node to create a contour line.

I wish you lots of success with your analysis task, if you have any more questions, feel free to ask them anytime.



Hi Gabriel,

actually i dont get the resizer. It looks like it just scales up the whole image to the desired size. What i'm looking for is to enlarge the ROI size around my object which is used for the segment cropper to have all the images in the same size. It looks like, the ROI size is always the minimum area around the detected contours. 

The second part with the outline labeling works well.



A new day a new question. As i said, i run the whole segmentation process again over the cropped images. When it comes to the "Image Segment Features" node i get an error massage ("ArrayIndexOutOfBoundsException"). I figured out that it has something to do witrh the cropped images. When i just use segment geometry features it works (i gues it only runs over the labeling input data). When i choose some intesity based features i get the error massage. When i use the binary image instead of the cropped images as imput image than i works.

Any ideas?

Best Andreas

Hi Andreas,

To resize labeling you can use the Labeling Resizer node, to create labelings from the binary img column you can use the Connected Component Analysis node.

can you send me the workflow where you get the ArrayIndexOutOfBoundsException? That should not happen, so I will look into fixing it.



i have got two more questions.

1. I have a large number of images to process. It looks like im running out of memory when analysing all images at onces ( around 500). Is it possible to load all images and then process them in substack of 100 images per stacks ?


2. Second questions. i would like to have the raw images with the contour outlines. I can show them with the interactive segmentatiion viewer, but how to save them?


Best Andreas

Hi Eiby,

First question: You can make use of two patterns here:

a) "List Files -> Chunk Loop Start -> Image Reader (Table) -> ... - Loop End"

b) Use the streaming executor.

Both  patterns are explained in tutorials on our example server.

Second question: You can use the Labeling to RGB node and select the images as a background. Then you can use the Image Writer and write the images e.g. as PNG. 

I hope this helps!