Reconstruction of shape with Zernike parameter


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 . Is this by intention and what is the background.


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 “” example plugin might be of interest to you: …

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 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,
(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”.



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: … -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.

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,