Color particles in 3D depending on their volume

fiji
imagej
plugin

#1

Hello everyone!

I have stacks of binarized files containing particles. I can plot those particles in 3D using the 3D viewer (or Volume viewer, or object counter…), and measure their volume and several other characteristics using all the tools in Fiji.
However, I didn’t find any way to generate a 3D plot that colors the particles depending on their volume?

I managed to get a colored 3D plot using the Analyse>3D Object counter, but it just colors particles on a pre determined color scale, only depending on their number.

3D_volume
Here is an example of the reconstructed 3D stack using the 3D viewer, but all the particles are green. How can I color them depending on their volume?


#2

You can do that with MorphoLibJ using the Assign Measure to Label plugin (under Plugins > MorphoLibJ > Label Images).


#3

Hello,

Thanks for your answer! Could you be a little more specific?
I know assign measure to label needs a table to work. I tried generating a table using Analyse>analyse particle 3D but it only finds ONE particle out of the 63 (inverting the black and white does not help).
The input file is a tiff stack in black and white (binarized). It looks like all particles are only considered as one.

I can also get a table with the volumes listed with the 3D Object Counter, but then the Assign measure to label plugin returns me a fully black stack.

What input should I give the Assign Measure To Label in order to obtain my particles in 3D colorized depending on their volume?


#4

Hello @almenia ,

You need to label first all your objects using the Connected Component Labeling plugin (under Plugins > MorphoLibJ > Binary Images). That way you will get a label image with a different voxel value for each of your 63 particles. Then you will continue with the Particle Analysis 3D plugin to extract the measures of each particle, and finally the Assign Measure to Label plugin to obtain a new image where each particle will contain your selected measure as voxel intensity.

I hope everything is more clear now!


#5

Hi @almenia,

The solution proposed by @iarganda is very elegant and generic, just for sake of being complete on this forum, note that you have a alternative tool that do will do the same using macro programming using 3D Manager, check the sample macros.

Best,

Thomas


#6

Thank you very much, it’s much more clear now :slight_smile:

One remaining issue is that one of the particles is so big that it totally overshadows the color of the smallest ones once I assign them values equal to their volumes. Only the biggest particle is visible once i assign them their volume and use a colormap.
This can be countered by using a log scale (or square root) on the image stack after assigning measures to the labels, so that the values are closer to each other.


#7

You can also remove the largest label automatically (Plugins > MorphoLibJ > Label Images > Remove Largest Label). I use it a lot to remove the background label if needed :wink:


#8

Hi Ignacio,

Is there a way to use the label assignment in IJ macro - with the setting of the values?

when I record the command I get the user interface and my selection of values is not recorded:

run("Assign Measure to Label");

Is there a way to set the choice of table,column and min/max values in a macro (IJ macro language) ?

Thanks
Ofra


#9

Hello @Ofra_Golani,

I can replicate the problem. Let me work on it and I will be back to you.

Thanks for reporting!

ignacio


#10

That part of the code was written by @dlegland and it seems correct. The GenericDialog is properly created so I’m not sure what is happening. It might be related to the dialog listener by I am struggling to make it work.

Maybe @imagejan or @ctrueden run into this problem before?