# Generating pupil size (mm) values using pixel data and corneal reflex data

Hi there,

I have been having an issue with my SMI RED-m device. Occasionally and seemingly at random, all "mapped pupil diameter" (mm) data is missing from the .idf files for a given condition. I am trying to figure out what is going wrong (I posted on here a few weeks ago) but failing that -- I am wondering if anyone is aware of a way to convert to mm diameter data using the pixel data and the corneal reflex data...

If I were to use a headrest for my experiment, and then to place a dummy head with a pupil (black circle of which I know the diameter) on the headrest in front of the RED-m, I might then be able to calculate a conversion value (how many mm is one pixel)...

But I am wondering if corneal reflex data could be used instead of this (potentially crude?) method?

Any advice is greatly appreciated, and please check my last post if you would like more information on the missing data issue.

Thanks in advance!

## Comments

Hi Jennifer,

I suspect that the 'mapped' pupil diameter is lost when the SMI fails to determine the camera-to-head distance, which it needs to convert pupil size in pixels to pupil size in millimeters.

What I would do is take all samples for which you do have both the px and mm values for pupil size, and do a linear regression to determine how you can go from px to mm. If px refers to pupil diameter, you can do a regression like so:

If px refers to pupil area (i.e. pixel count), you can do regression like so:

Does that make sense? Once you have established that relationship, you can simply calculate the mapped pupil size for samples where it's missing.

Cheers!

Sebastiaan

There's much bigger issues in the world, I know. But I first have to take care of the world I know.

cogsci.nl/smathot

Hi Sebastiaan,

Yes, it does! Thanks so much for your reply and this suggestion. I have managed to generate the mm data using this method! There was a slight nonlinear relationship between mm and px.

I have attached a chart of two traces - orange is the pupil diameter (mm) data from the SMI output and blue is the pupil diameter (mm) data generated from the pixel data.

Do you think the difference between these two traces suggests that the SMI output is smoothed as part of their calculation, as my generated trace seems much noisier? or would this have something to do with the regression method?

Thanks again!

Jen

It's certainly not the regression method, because that's something that happens for individual samples.

So yes, I suspect they're doing something like smoothing, but not

justsmoothing, because you see that they also detect missing data (blinks perhaps) a bit more accurately than your regression line does. So there's probably some logic built into their method to deal with missing data.I would say, though, that your regression is good enough to replace those samples where the SMI mm data is missing. Don't you think?

There's much bigger issues in the world, I know. But I first have to take care of the world I know.

cogsci.nl/smathot

Yeah, I think it is quite good. However, the regression result varies between conditions and when this problem occurs, the mm data is missing for the whole condition.

The use of the headrest makes the variation in the regression result much less so I think my best way forward may be to make use of a headrest in case this problem creeps up. I will be confident that the regression result will be adequate for use across conditions then.

Just in case it is of interest, I have attached a graph pupil traces with the pupil diameter (mm) from the idf file of a condition with no missing data, the regenerated mm using the pixel data and regression result of this condition and then 2 more traces using the same pixel data from that condition but using the regression results from 2 other conditions (L15, L18). All conditions used for this had the same participant using a headrest during the same test session.