Automated PSF Measurement with IJ/KNIME

Hi everyone

I am working on a collaboration with Mia Cellavie where we are trying to figure out the best way to measure the PSF of a microscope from a collection of beads. We want to measure and collect 3D statistics for all beads in the image, and output them in a table.

We are aware of two existing plugisn that may be helpful MetroloJ and the other is [PSFJ] ( .

We also have been looking into potentially using KNIME for this task, as it would make it easier to analyze many images, with multiple channels.

I’ve been having trouble getting some KNIME nodes to work on 3D images. And it looks to me that a specialized work flow is needed for 3D measurements. For example the thresholding and connected components nodes seem to only process the first slice of an image. Or am I missing something?

Should I just look to ImageJ2 and ops for 3D processing? I was thinking I could modify the Ops_Threshold_Measure into a command, then integrate it with KNIME. Or is there an easy way to do it in the current KNIME?

Anyway for the next couple of days we are going to be brain storming approaches to this project. We anticipate being able to share work that gets developed. If anyone has any suggestions on any tools we should look at, please let me know.



I think I figured it out. It looks like you have to select the ‘z’ option in the
dimensions section, after that thresholding and connected components work in 3D.


Hi all

In the end it was surprisingly easy to get MetroJ, into KNIME. I looked over the MetroJ code, and found that the key class was called PSFProfiler. Ater that I just had to create a new java project, link it to MetroJ, wrap PSFProfiler with a command, and follow these instructions to add the new IJ2 jar to KNIME

The command I wrote was as follows:

@Plugin(type = Command.class, headless = true, menuPath = "Plugins>MetroJ")
public class MetroloJCommand implements Command {
	ImgPlus img;
	@Parameter(type = ItemIO.OUTPUT)
	Double xres;
	@Parameter(type = ItemIO.OUTPUT)
	Double yres;

	@Parameter(type = ItemIO.OUTPUT)
	Double zres;

	public void run() {
		ImagePlus imp=ImageJFunctions.wrap(img, "wrapped");
		// fix dimensions
		imp.setDimensions(1, (int)img.dimension(2), 1);

		PSFprofiler profiler=new PSFprofiler(imp);

I haven’t found a way to share the final KNIME project. After exporting and checking “exclude data” the project is still 300 MB, and too big to attach on a forum post. This seems strange, unless it is somehow still saving image data.

Some random thoughts…

The good: It was easy to integrate an arbitrary IJ plugin by wrapping it in a command. The thresholding and connected components components worked well in 3D, once I discovered that I had to select the Z axis.

Pitfalls: I have used KNIME a lot for smaller 2D images. This was the first time I attempted to process larger 3D images. Biggest pitfall was that it took forever to save data. As well, if the thresholding failed, you could potentially detect thousands of noise objects, and everything would slow to a crawl, and potentially run out of memory.

Googling solutions to the first issue leads here. It looks like I need to investigate streaming. Any other suggestions??



1 Like

:thumbsup: I fully agree, the KNIME ImageJ2 integration helped me build a few nodes relatively quickly when I needed additional functionality. I’ll link them here in case you find them useful or need some inspiration:

So you used the Image Writer node to save some images? As it uses SCIFIO in the backend, it suffers from its current slowness, as you surely know, judging from this:

It seems that this is not restricted to large image series only. The only format that is written with an acceptable speed is ICS/IDS at the moment. (@dietzc and @gab1one might have more input on this.)

See also:

You can add some checks before continuing to process, e.g. using the IF Switch node or some others from the Workflow Control category.

That is strange, exporting without data should really only save the nodes with configuration settings, unless you manually put some data into (subfolders of) your workflow directory (in your KNIME workspace).
You can inspect the exported .knwf file by renaming it to .zip and using any tool to inspect zip files.

Pitfalls: I have used KNIME a lot for smaller 2D images. This was the first time I attempted to process larger 3D images. Biggest pitfall was that it took forever to save data.

Oh yes. I agree and I hope we’ll soon have a solution for that. Here are some best practices:

  • Chunk Loop Start / End
  • Parallel Chunk Loop Start / End
  • Simple Streaming Executor
  • Don’t save start / end

Maybe that helps.