How to apply color profile + gamma correction in Psychotoolbox

I am conducting a visual stimulation experiment where I am using sinusoidal gratings.
Two requirements are necessary:

  1. Linearize the display, so that there is a linear relationship between pixel value and luminance. This should have in account the white and black levels, not just a power law transform.
  2. Ensure the white point temperature is 6500K, i.e., the D65 illuminant, to be sure real gray gratings are being used.

I have a SpyderX device. I have no clue how to use it with Psychotoolbox, and don’t even know if it is possible. Instead, I have been using the software DisplayCal and created a profile with my desired specs. Then I simply loaded it in the operative system, and used MATLAB normally (without Psychotoolbox, as my experiment did not require accurate timing).

I recognize this solution is not ideal. I would prefer using Psychotoolbox. So what I would like to ask is the following:

  • Is there any way to import my color profile from DisplayCal into Psychotoolbox? I have both a “.icm” file and a “.cal” file, both exported from DisplayCal.
  • Alternatively, is there any way I can use a SpyderX (requires a colorimetric correction which I have available!!!) to fulfill the two requirements I listed above, using Psychotoolbox directly?
  • I have also a file I send in attachment, which contains some uncalibrated profile information, exported from DisplayCal. Does that file contain enough information for Psychotoolbox to do what I listed above? If that is the case, how can I do it in the most precise way?

Attachment:
Report on uncalibrated profile:
14:05:27,799 Setting up the instrument
14:05:27,799 Instrument Type: Datacolor SpyderX
14:05:27,799 Serial Number: 61076384
14:05:27,799 Hardware version: 4.91
14:05:27,799 Uncalibrated response:
14:05:27,799 Black level = 0.1306 cd/m^2
14:05:27,799 50% level = 32.44 cd/m^2
14:05:27,799 White level = 166.80 cd/m^2
14:05:27,799 Aprox. gamma = 2.36
14:05:27,799 Contrast ratio = 1278:1
14:05:27,799 White chromaticity coordinates 0.3114, 0.3310
14:05:27,799 White Correlated Color Temperature = 6559K, DE 2K to locus = 6.6
14:05:27,799 White Correlated Daylight Temperature = 6559K, DE 2K to locus = 2.5
14:05:27,799 White Visual Color Temperature = 6313K, DE 2K to locus = 6.4
14:05:27,799 White Visual Daylight Temperature = 6475K, DE 2K to locus = 2.4
14:05:27,799 Effective Video LUT entry depth seems to be 8 bits

I have also a specrophotometer available, which I used for the SpyderX colorimetric correction, but I prefer not having to use it, as I need to request permissions for use. Please don’t tell me that SpyderX sucks and I should buy another device, I already know that. But this is what I have.

As a simple search on this forum for the term “SpyderX” shows, there is a whole 3rd party open-source toolbox called PsyCalibrator for use with Psychtoolbox to use the SpyderX and similar models for calibration:
Software: GitHub - yangzhangpsy/PsyCalibrator: PsyCalibrator
Article: OSF

So that’s one way to do it. Wrt. to applying gamma correction curves, that was already answered in a similar question of yours a couple of months ago. Wrt. white-point etc., PTB’s imaging pipeline has functions to apply 4x4 color conversion matrices, which may help with gamut / white-point adjustments etc. help PsychColorCorrection and demos like RenderDemo.m. No premade demos specific to white-point setting though.

I think as long as you only need a standard SDR framebuffer, that might also work with Psychtoolbox, ie. setting it in the operating system, although I never tried it explicitely. At least the gamma tables set in the operating system via some color profile should peacefully coexist with PTB.

Wrt. your remaining questions I don’t have any ready answers, only that I don’t think we have any code to read .icm files or similar as far as I know, but Matlab’s image processing toolbox has iccread() which might help. Others would have to chime in…