Spatial analysis 2D/3D

Hi,
Does anyone has experience using the spatial analysis 2D/3D plugin? I have tried to use it on randomly distributed objects and on well defined clusters but in both cases I get SDI equal 1 (using F and G functions). I would really appreciate your help

Thanks,
Reinat

@Reinat

Are you referring to this Spatial Statistics 2D/3D plugin by @ThomasBoudier and Philippe Andrey (just invited to this thread)?

eta

Yes by ThomasBoudier and Philippe Andrey

Dear @Reinat,

Can you please provide the image you are testing? Perhaps that way we’ll manage to help you a bit faster.

Best

Oli

Thanks for your help
The black mask represent the area, I have also attached two example of masks, one is almost random where as the other one has two clusters.
Thanks,
Reinat

So the first thing is that your images should have the mask and spots be white on a black background. At least for me. Otherwise the mask is going to be the whole image minus your area.

I tried with both images. And I get an F value of 0.0 and of 1.0 as expected, as the two cases you gave me are extreme.

// Clustered Spots
Segmenting image...
mask not calibrated, calibrating ...
Computing spatial statistics, please wait ...
Nb Spot=84
Volume mask=38933.0
Density=0.002157552718773277
--- F Function ---
SDI F=1.0
--- G Function ---
SDI G=1.0

// Almost Random
Segmenting image...
mask not calibrated, calibrating ...
Computing spatial statistics, please wait ...
Nb Spot=189
Volume mask=38933.0
Density=0.0048544936172398735
--- F Function ---
SDI F=0.0
--- G Function ---
SDI G=1.0

So try inverting the images you have and try again. Let me know if that works!

Oli

1 Like

Dear Oburri,

Frankly I am confused. Yes when using the jpeg files I had to invert the images as you have suggested but in those images I do not get the correct number of spots as you got. When using my original TIF files, which I do not need to invert I get the correct number of spots but bot the F and the G functions (in both random and cluster) are zero.

Thanks for your help,
Reinat

Hi again.
Odd indeed. Might i suggest you share the exact files (tifs) you are using for the test. Perhaps through Dropbox or in a zip file here if they’re not too big.

Best

Dear Oburri

Here is a dropbox link:

Thanks again,
Reinat

Dear Reinat,

Sorry I did not notice your post earlier. It did not show up on my updates. If you want to make sure that your correspondent gets a notification, add an @ before the user name like @oburri, that way I will receive a message.

I think I have it figured out. It would appear that for some reason having a set scale is causing issues. with the calculation of the F

\\ With Calibration, almost random spots
Segmenting image...
Computing spatial statistics, please wait ...
Nb Spot=84
Volume mask=147627.6222443798
Density=5.689992070789305E-4
--- F Function ---
SDI F=1.0
--- G Function ---
SDI G=1.0

\\ Without Calibration, almost random spots
Segmenting image...
Computing spatial statistics, please wait ...
Nb Spot=189
Volume mask=147627.6222443798
Density=0.0012802482159275938
--- F Function ---
SDI F=1.0
--- G Function ---
SDI G=1.0
Segmenting image...
mask not calibrated, calibrating ...
Computing spatial statistics, please wait ...
Nb Spot=189
Volume mask=38933.0
Density=0.0048544936172398735
--- F Function ---
SDI F=0.0
--- G Function ---
SDI G=1.0

It seems that the mask volume is in pixels, but the density calculation takes the pixel size into consideration, so perhaps that is what is screwing with the SDI calculation.

So the easiest is to remove your calibration before running the plugin… worked for me.
go to Image > Properties… and set the unit to pixel and all values to 1.0
image

Hopefully @ThomasBoudier can update the code, or somehow make it available so someone can fix this.

Again sorry for the delay

1 Like

Hi @Reinat and @oburri,

Note that your data must be correctly labelled, meaning that the background should have a value of 0. In your case the background is white but its value is 0, because your are using an inverted lut visualisation.

In your case the particles are quite big in diameter so an important parameter to take into account is the hard core distance. This distance refers to the minimal distance between two particles. In your experiment a value of 8 seems appropriate.

I will look into the problem of calibrated distances and hope to come back to you soon.

Best,

Thomas

1 Like

Hi @oburri @ThomasBoudier

THANK YOU!!!
The scaling did solve the problem. Thank you both for all the suggestions, this is really really helpful!!!
Have a great day,
Reinat

Hi @Reinat,

The calibration problem should be fixed in latest version in Fiji.

Best,

Thomas

1 Like

@ThomasBoudier

Great, Thanks!

Hi @oburri @ThomasBoudier ,

I today tried running the plugin in Fiji and got a SDI of either 0 or 1 for all images I tried so far. I was expecting to also get SDI values of 0.8 or 0.2… The paper Andrey et al. 2010 which described the method has a range of SDI values.
So, I was thinking, I am doing something wrong. Is there somewhere I can read up what all the options (Nb points, samples, error and multi thread) mean or some images with known SDI? Also, are there some things to consider when adjusting the hard core distance?

Attached a screenshot on some images

Thx Carola


Hi @Caro_007,

Yes I think you need to carefully adjust the hard-core distance to the diameter of your particles. You can see the result of this distance with the random image generated by the plugin. You can also test the plugin by using this random image as input so you should get SDI values different from 0 or 1.

You can also check the average values between particles using the SimpleAnalysis plugin that comes with the SpatialAnalysis plugin.

Hope this helps

Best

Thomas

1 Like