CLIJ Assistant- Manual threshold and Analyze particles

Hi all! Just starting to dig into the uses of CLIJ and CLIJ assistant after #I2K2020. I am working on getting a workflow into CLIJ assistant so that I can look at a few different options in almost real time.
Workflow in a nutshell:
Load image
Subtract background
Manually set threshold (3,255 in 8bit images)
Convert to mask and Analyze particles to remove small mask bits
Smooth the image
Run skeletonization and save results.

I am a little bit stuck in the middle with how to work a manual threshold and an Analyze particles… type effect within CLIJ Assistant. I do not exactly need Analyze particles specifically, but I do want something to the effect of “remove every non-touching masked object below 5000 um^2.” There are a ton of options within CLIJ, but I think I have gotten lost in them, even with the search options. Maybe I would need to make a plugin just for that step using many other steps, but that might be a bit overkill for a show and tell.
image

These are all 2D images, and my current progress looks a bit like this, though I couldn’t remember how to make the processing intensive lines connecting the various windows appear (would it be less intensive if they just showed arrows indicating the direction and the color changed when “updating”).

I have everything working by script, and can process whole folder trees of time lapse images (though I am only using CLIJ for the skeletonization at this point)! I was just wondering if I could visualize the steps and hopefully demonstrate to collaborators why certain aspects of image collection could be important to improve upon. Especially if I can update a manual threshold from 3 to 4 and to 5 within CLIJ Assistant and show the impact downstream when the signal is so faint :stuck_out_tongue:

It really seems like a great tool for communicating analysis issues with biologists, in addition to the impressive speed-up times.

Is my best option having an intermediate step outside of CLIJ and loading each manually thresholded image into a CLIJ plugin?

1 Like

@smcardle has reminded me that the Visualize connections option is under the “Info” sub-tab in CLIJ2 after right clicking on a CLIJ (green bordered) version of an image.

I would say my memory is not what it used to be… but it never was. As far as I can recall.

1 Like

Hi @Mike_Nelson,

glad to hear you enjoyed the #clij demo at #i2k2020.

Check out the “Binarize” category of operations. It contains ImageJs classic thresholding methods and simpler versions such as “Greater constant” which corresponds to a manual threshold:

The basic algorithm behind ImageJs Particle Analyser is called Connected Component Labeling which you find in the “Label” category:

Operations which take a label image and produce a new label image can be found in the “Label processing” category. You are searching for “Exclude labels outside size range”. Please note, CLIJ doesn’t take physical units into account. You need to enter the corresponding number of pixels:

You find this option in the right-click menu as well:

You may want to give SimpleITKs “Binary thinning” a try. It might be faster way of Skeletonization:

During this mind-blowing conference, many of us lost some brain cells :wink:

Let me know if you need anything else :slight_smile:

Cheers,
Robert

1 Like

Neat! Exploring the Binary thinning also led me to the functions to convert image type since Binary thinning doesn’t handle the 32bit images that result from Connected components, while the BoneJ skeletonization does.

Ok, now this is getting to the insane I want the world levels, but is there any way to insert a step into an early point in an Assistant workflow? :smiling_imp:

1 Like

By no means perfect, but not CLIJ’s fault :slight_smile:

1 Like

Hm “Greater constant” and “Gaussian blur” is maybe not a good idea on a label image. What do you want to achieve with the lower half of the workflow? :upside_down_face:

1 Like

Not yet. But I put it on the wishlist as this request makes a lot of sense

2 Likes

Ah, I was trying to get back to a point where all of my masks have the same value, so that my blur step could be run after the removal of the “small bits.” In my original (slow, nonGPU) script I could perform the gaussian blur directly on the mask output of Analyze Particles (I think it ends up being 255 vs 0), but here I needed a higher value than 1 vs zero. Greater constant returns everything over 0 as 1, and then I can multiply that by a scalar, followed by the gaussian blur.

If the data were cleaner, I wouldn’t need such terrible work arounds. I could potentially do a mask-AND with the original image and perform the blur on the resulting image, but low intensities in the original image are really the problem. Or, incorrect connections are far less likely than broken connections, due to the acquisition settings.

1 Like

Ah ok, yes, then it makes perfectly sense! The LUT is just wrongly selected. A tiny bug I can fix :slightly_smiling_face:

1 Like