quokka79 / GPcalc

ImageJ macro to calculate general polarization (GP) values
MIT License
2 stars 2 forks source link

Histograms from GPcalc #1

Open dschr opened 5 years ago

dschr commented 5 years ago

Thank you very much for this nice macro, I quite like it, especially the images! However I do have some trouble understanding the histograms, given as tsv-files. Although the calculated images are ok (please see my attached example), the tsv-file lists always (tested several times) 0 entries for all but 3 GP-values. I also attached the tsv-file to the corresponding image.

Bildschirmfoto vom 2019-11-19 07-49-27 G13-13  in parallel 70uW czi_HSB by Sum of ordered + disordered

dschr commented 5 years ago

I am using Fiji, imagej v 1.52p on a 64bit Linux machine. I downloaded GPcalc from this github repository.

quokka79 commented 5 years ago

Hi, Thanks for raising this!

I get the same problem as well on Fiji with IJ 1.52.

This macro was last working back in 2017 so I have tried it with the Fiji 'Life-Line' version from May 30 2017. Interestingly, this version has the description "Just prior to a sweeping update to nearly all components".

If you open a Masked GP image created with v1.52 and just mouse around over your image (or press H for the histogram) then you can see all the pixels have a very restricted range of values (either 0, 1, or 2) compared to the same image from the macro run in 2017 Life-Line Fiji (which uses IJ v1.51n). The limited range of values in the newer IJ is also what you see in the histograms file. This is probably due to how the masking is done in the macro as, at the time, IJ didn't correctly apply a LUT/colormap to an image with NaN values in it.

I will look in to fixing this for the newest version of ImageJ but, while that is going on, I would suggest that you try using either the Life-Line version or downgrading your ImageJ version to 1.51n and then check that it is giving a more sensible spread of values for the masked-image histograms.

Cheers, Dave

dschr commented 5 years ago

Thank you!

quokka79 commented 5 years ago

I've pushed an update which works with ImageJ v1.52p (and latest available Fiji version). The change since v1.51n (i.e. Fiji Life-line 2017) seems to be in the way masks are used, which is why the histogram data was going wrong with more recent versions of ImageJ. I have also tidied up the histogram output so it's a little more intuitive. Can you let me know if this works for your data?

dschr commented 5 years ago

Thank you very much Dave, with this update the masking as well as the histogram works now! Bildschirmfoto vom 2019-11-21 12-59-48

...I guess I am doing something wrong: although I see a nice phase-separation in the masked image, I cannot see two peaks at the histogram. For now, I tried to use the 1px-median filter.

quokka79 commented 5 years ago

I think this might still be ok ... the distribution you get is for all the pixels in the masked area so although you can see an obvious spatial separation in the image, there might not be an overall distinct pair of peaks in the histogram.

You would expect to see distinct peaks if you have a really strong separation in the intensity between the two channels for the reporter. In reality, for dyes like Laurdan and di-4-ANEPPDHQ anyway, the difference in intensity between the two channels is usually not super amazing so as to give you such a strong separation of the resulting GP values. There's usually a lot of overlap between the two channels, plus there are ways you can get fuzzing of the GP values, e.g. from actual mixing of the phases in the sample (mixing at boundaries) or apparent mixing due to slow imaging of very dynamic phases, or the 2D projection of what is ultimately a 3D imaged volume (if there's a sharp phase boundary running parallel to your imaging plane you'll see it as 'mixed'), etc.

Drawing ROIs over the two areas and producing a histogram for each ROI should show the separation you are looking for. For example, below is one of the demo images with three regions drawn on. The histogram was generated with 50 bins to smooth things out a bit (I've pushed a new version which lets you set the number of bins beforehand). The difference in GP between these areas is clear (but not huge) when they are plotted separately and it's lost when looking at the overall (Region 1) distribution. With enough images and ROIs, these differences would come out from the stats readily enough.

Screenshot_2019-11-25_17-19-47

For your GUVs (I guess?) you could look at intensity profiling, e.g. do a polar transform with a linear intensity profile. Or the BeanShell script given here works to get an linear intensity profile from a circular path. By manually separating the two peaks you may then be able to fit functions to each and use those to inform a subsequent two-component fit for the overall histograms generated by the macro.

Cheers, Dave

PS the 1 pixel median filter is only used when saving the 'HSB images' to make them look a bit less gritty (and with a pretty LUT applied, e.g. for presentations). The real data are in the 'GP images' and 'Masked ...' folders and contain only the 32-bit whole-image or masked GP values; no median filters are applied there.

dschr commented 5 years ago

Thank you very much Dave for your kind and comprehensive answer, this is most helpful!

StefBio commented 4 months ago

Hi, I'm having problems interpreting histograms. When processing the data package, in the HSB images with the scale, the difference in the GP values ​​is noticeable, however when graphing the histogram values, they overlap (as if they had the same GP values). I attach the images. I don't know if there is any way to select an ROI, because despite processing the images before running the plugin, the background still has a GP value. 1PCHOP oib_HSB(medianfiltered) by Sum of ordered + disordered All Images - LUT annotated POPC_11 oib_HSB(medianfiltered) by Sum of ordered + disordered Sin título

dschr commented 3 months ago

Hello StefBio, I noticed in your pictures that the areas with a higher GP value have a uniform orientation. In your first picture, for example, they are all aligned north-south. We initially had the same problem with our GUVs and found that this was a measurement error. Due to the linear polarization of the excitation laser light along with the orientation of the labeled phospholipids in the GUVs, the excitation efficiency of the dyes varies depending on the angle. The solution for us was to use circular polarized excitation light. If you are using a Zeiss microscope, I can send you the corresponding part number for the waveplate. Furthermore, the differences in value between the two phases are usually very small, so the results are set relative to each other in order to visualise them. For the ROI-selection, I used the according ij-tools.

Best Daniel