Help on designing a workflow - Dividing a table and running BIN analysis on each partition.

Hi,

I am new to Knime, so apologies for the naive question.

I have a table which contains the y-coordinate of a nucelus in 50 independent images and I want to create a bin analysis for each image, independently. Ideally, if the output could be % of nuclei in each bin rather than number of nuclei.

Basically I am trying to create a workflow where the software first filters by the column imageID (labelled 1-50) then for each of those run a BIN analysis and finally re-write the data so that my output table had 50 columns (one per image) x 40 BINS (as i want all my data to be divided into 40).

How should I design this workflow?

I have Group Loop Start -->Auto-binner -> Value Counter --> loop end Column append

But my final table he doesn’t add a column telling me which BIN it is and also by Group Loop doesn’t it use the data that was just generated as input to the new iteration rather than the original table but going on to the next set of filtered data?

Many thanks,

Giulia

Hi @giulia_g, you probably want a result similar to this one?:

To get such a result you need to rename the columns after the Value Counter node using a Column Rename (Regex) node as follows:

See also the attached example workflow: Groop Loop start example.knwf (16.6 KB)


That is the behavior of the Recursive Loop nodes, the Group Loop Start outputs all columns that belong to a group per iteration, the group is defined as all rows that share the same value in the group column.

best,
Gabriel

Hi Gabriel,

Thanks for your help!!! It works really well. The only thing is that it sets the BIN boundaries based on the first iteration rather than recalculating the BIN based on each image independently.
THANKS!!!

BW,

Giulia

Do you want different bins start and ends for each image? This would make the resulting data not comparable with each other.
If you use Equal Width bins, they will be the same for each image anyway. You can set the Bin Naming scheme to Borders to see how the bins are defined.
best,
Gabriel

Thanks.

I need all my images to be divided into 40 BINS, irrespective of the image size. So the BIN width will be different.

I need this as a way to normalize my data. I am looking at sagittal sections of the cortex in the absence or presence of a protein and with this analysis I need to check that not only in the absence of the protein is the cortex thinner (this I know) but also the neurons are not distributed in the same way (what I am analyzing). So intrinsically the thickness of the cortex/image is different. If that makes sense.

Thanks

BW,
Giulia

Are you running the binning over the pixel values of the image? In that case you should use the Intensity Binner node from the KNIME Image Processing extension:
https://nodepit.com/node/org.knime.knip.base.nodes.proc.binner.IntensityBinnerNodeFactory%23Intensity%20Binner

Which is optimized for images.

best,
Gabriel

Hi,
thanks I will send it to you. Also with some data so it might be easier to understand. No it is not intensity. It is y-coordinates. As from an original image, I use a software to get the y-coordinates of my cells of interest.

Many thanks

Hi,
I actually thought I might post here in case other users need it as well.

So just to explain a bit better:
I haveimages of the cortex similar to this one:

I then use cell profiler and cell profiler analyst to identify the different cell types and their location on the Y axis. Eg. All the cells like the one circled in yellow above.
And get a spreadsheet like the one attached.

I want to divide the location center Y (column J) of each image (column A – Image number) into 40 Bins and then calculate the frequency of objects in each one. I manually did it for a couple of images so example columns N and O in the sheet labelled Data.

So as to get for all the images then a sheet similar to the one labelled Desired Output in the Excel sheet attached.
Astrocytes.xlsx (376.0 KB)

This is the Knime workflow that I haveAstro.knwf (9.7 KB)

Many thanks and apologies for my incompetence!

Hi @giulia_g,
The key component when you want to bin each image independently is the Domain Calculator node.


Usually every column in a KNIME table has bounds information attached, this is not modified by the Group Loop Start node.

I have attached a workflow where I used this node and some other tricks to create the table you wanted, extract the bin distribution per image and the bin widths.

Astro-modified-by-Gabriel.knwf (53.2 KB)

best,
Gabriel

Many thanks! :slight_smile: