Reconstruction of shape with Zernike parameter

Hi

I would like to get the actual shape which results from the calculated zernike parameters.
I have some code which does the reconstruction but it does not look like anything it should be. There was also the problem that there are only even Zernike polynoms (+m,+n) and no odd ones (-m,+n), referring to en.wikipedia.org/wiki/Zernike_polynomials . Is this by intention and what is the background.

Thanks
Erwin

I have some code in the tutorial modules that can do this. We throw away the phase information with the Zernikes and only retain the magnitude - thus, something that has a high Zernike 1, 1 is bilaterally asymmetric, but you can’t tell in which direction.

Our “measurementtemplate.py” example plugin might be of interest to you: github.com/CellProfiler/CellPro … emplate.py

You can dump it in your plugins folder (look at the preferences for how to set it). Look at the bottom - you can just take the function, get_image_from_features and it will give you what you want. If you just want shape, feed it an image of all 1’s, I think that will work.

Great, I’ll try it as soon as possible!

Hi again

Unfortunately I was not successful to get anything useful.
First I am using Cellprofiler with Debian Linux and have a running version of Cellprofiler of “Revision: 11537” from 2011/12. Using this version and putting the measurementtemplate.py file into the plugins folder did not show me any more modules.
So I tried to compile the newest git version with the Makefile.CP2.ubuntu.64 as a starting point, but after about one day of Makefile debugging and compiling I ended up with the Cellprofiler logo shortly showing up and exiting without error message.
In parallel I tried to take the Zernike numbers into a dictionary like:

zd = {(0,0):0.593143300108,
(1,1):0.0338168287485,
(2,0):0.185615754213,(2,2):0.0926163256287,
(3,1):0.00920012481609,(3,3):0.0136786347676,
(4,0):0.00201653684284,(4,2):0.0304850592246,(4,4):0.0312133381174,
(5,1):.0111217946943,(5,3):.0143042594876,(5,5):.0113484215571,
(6,0):0.0216267366911,(6,2):.0170716117507,(6,4):.00803745407435,(6,6):.0183519945888,
(7,1):.00523258199308,(7,3):.00280905290222,(7,5):.0090147736752,(7,7):.00474419192939,
(8,0):.00411202968954,(8,2):.0161147752203,(8,4):.0119644521842,(8,6):.00351559431943,(8,8):0.0093667990466,
(9,1):.00476193054988,(9,3):.00673382623806,(9,5):.00486530164136,(9,7):.00666531440094,(9,9):.00396599153489 }

and tried to get something out of “get_image_from_features(50,zd)”. But it doesn’t look like the original, what did I do wrong?
I tried to attach original and zernike, but “Could not upload attachment”.

Regards
Erwin

Hi

OK, sorry, I now understand the plugin system, first I put it into the wrong plugin directory (not the one of the preferences).
I am able now to create Zernike values from the measurementtemplate plugin, but these are of different magnitude and these are complete with the negative values. I think I have to read code and understand more of the background to see the actual relationship to the MeasureObjectSizeShape results.

But maybe one question in advance: is it possible to create the actual shape without the negative azimuthal degrees which are missing in the MeasureObjectSizeShape module?

Nope - it’s not possible. We are throwing away the phase information so it can’t be reconstructed.

If I remember right, the Zernikes from MeasureObjectSizeShape are missing a constant normalization factor. That will make the magnitudes different from the ones in measurementtemplate. I think that you might do best disregarding the Zernikes in MeasureObjectSizeShape if you want to be able to reconstruct them later in your analysis. Most machine learning and statistical algorithms should be able to create classifiers that use the positive and negative azimuthal degrees in tandem to delineate equivalent volumes in feature space to those using the Zernikes from MeasureObjectSizeShape. I’ve tried some prinicpal component analysis using the Zernikes from measurementtemplate and you get some convincing “eigenshapes”. I think it’s worth trying an analysis with them.

Regarding Debian, I am not an expert, but you might want to follow option # 2 on this page: github.com/CellProfiler/CellPro … -for-Linux. I saw this work twice last week.
Alternatively, if you can run Centos 6, the directions are very easy and work for me every time.

Just a quick note: The attachment functionality seems to be back online, so feel free to upload a file directly if need be.
-Mark

Hi Erwin.

How did you get on with reconstructing shaped from the Zernike parameters? Any tips you could give me to get me started?

I’ve got the MeasurementTemplate module installed so can get the full Zernike features out - how did you go about reconstructing objects, and did they look as expected in the end?

Thanks in advance,
Paul