Screen GetClut question

 

 

Hello everyone,

 

I am trying to use Psychtoolbox version 1.0.1 with OS X on matlab 6.5. Earlier I was working with matlab 5.2. The ‘GetClut’ and ‘SetClut’ preferences seem to be missing from the new version. I have gone through all possible documentation I was aware of and also looked at sample code, but I am unable to figure out what preferences to use which would satisfy this functionalilty in the new version. This also raises the generic question for me as to whether there is any documentation for the way in which Screen preferences are changing across versions and the new syntax to be used.  I found some people’s code (on the forum and other places) in specific contexts that was not applicable to me, so I thought I would ask you. Below is a sample of my code…

 

%         screenInits.m

%

%         Initiate some lookup tables (CLUTs) and variabless for PsychToolbox SCREEN calls.

%         This is the matlab 5.2 version code

 

if doExperiment == 0  % Do nothing if not running an experiment

            gammaClut = (0:255)'*[1 1 1]; % Default color LUT

 

            % Open the experiment screen

            whichScreen = 0;

            [window,screenRect] = SCREEN(whichScreen,'OpenWindow',0,[]);

            offClut = whiteLum * ones(256,3);                        % Off means white screen

%         offClut = blackLum * ones(256,3);                        % Off means black screen

 

            if gammaCorrection==1                  

                        if color==0

                                    load LTProjector;    % Loading the luminance values for the experimental projector            

                                    luminance=interpolate(lum,16);     

                                    theClut=gammaCorrect(luminance);   

                                    onClut=theClut;      % This is the color look up table that I desire to use while running the experiment                

 

                        end

 

            matlabClut = SCREEN(whichScreen,'GetClut'); %

            SCREEN(window,'SetClut',offClut);

 

            % Set up text style for user interface.

 

           SCREEN(window,'TextFont','Helvetica');

            SCREEN(window,'TextSize',20);

            SCREEN(window,'TextStyle',0);

            SCREEN(window,'TextMode','srcOr');

 

………………………..

 

            [cmdDx,cmdDy,bufferWindow] = CmdWinToUpperLeft(window,matlabClut);

 

          % Bring up screen window to show images.

 

            SCREENWinToFront(window,bufferWindow,cmdDx,cmdDy,offClut);

            HideCursor;

 

            SCREEN(window,'SetClut',onClut);

 

            Ask(window,'Click mouse to proceed', 255, 0);

 

            respString = ' ';

 

            abort = 0;

 

            HideCursor;

 

            SCREEN(window,'FillRect',[170 170 170],screenRect)       % this is the intensity of the padding area of stimChar, also the max of input E.

 

            End

 

          

   ……………

 

 

         It would be great if you could give me some pointers to a place where there is an API in reference to earlier-version syntaxes.

 

         Thank you

         Sowmya Ravikumar,

         Graduate student, School of optometry, Indiana University .

 

 

 

 

 

On Feb 16, 2005, at 12:41 PM, Sowmya Ravikumar wrote:
> I am trying to use Psychtoolbox with OS X ... The 'GetClut' and
> 'SetClut'
> preferences seem to be missing.


dear sowmya

that's right. the roadmap indicates that CLUT control will appear
shortly:
18 February 2005 Adds LoadClut and Screen('Gamma')

http://psychtoolbox.org/osx.html#roadmap

we are all waiting with bated breath.

best

denis
Yes, afaics your method should be correct. origLUT will contain the
current hardware lookup-tables for your display. If you save origLUT
to some file and later reload it via
Screen('LoadNormalizedGammaTable', screenNumber, origLUT); you should
be able to set the calibrated LUT from Matlab.

You can see how origLUT changes whenever you change the color profile
settings in the SystemPreference->Display control panel...

For checking you can also display a linear intensity gradient with
Psychtoolbox and then use a photometer to see how well your display is
linearized...

-mario

--- In psychtoolbox@yahoogroups.com, "visschek98" <visscher@...> wrote:
>
> Perhaps this is a naive question, but where are you getting your
luminance calibration
> table?
> I have been using an eye-one display2 screen calibration device from
gretagmacbeth. (you
> stick it to the monitor and it calibrates the monitor for you).
Then, in matlab, using the
> line
> 'origLUT=Screen('ReadNormalizedGammaTable', screenNumber);'
> (see CLUTAnimDemoOSX psychtoolbox function) I download the clut from
the newly
> calibrated monitor.
> Is this an acceptable LUT? What other tests should I do to make sure?
>
> Thanks!
> Kristina
>
> --- In psychtoolbox@yahoogroups.com, "Daniel Shima" <danielshima@>
wrote:
> >
> > Look into this:
> >
> > >> Screen LoadNormalizedGammaTable?
> >
> > It definitely can be used to apply a luminance calibration table and
> > might be able to be used for CLUT animation. There was a mention in a
> > message last summer:
> >
> > "CLUTAnimDemo shows how one can do CLUT-Animation via
> > Screen('LoadNormalizedGammaTable')."
> >
> > Daniel Shima
> > Vanderbilt Vision Research Center
> >
> >
> > On 3/23/06, nicobonniernico <nicobonniernico@> wrote:
> > > Hi Everybody,
> > >
> > > I am also trying to use Psychtoolbox with OS X ... The
'GetClut' and
> > > 'SetClut' preferences seem to be still missing.
> > > Any suggestion on how to either use IccProfile, SetClut or any other
> > > way to calibrate my monitor with Mac Os X would be more than
welcome.
> > > Thanks,
> > >
> > > Nicolas
> > >
> > > nbonnier 'at' gmail.com
> > >
> > >
> > > --- In psychtoolbox@yahoogroups.com, Denis Pelli <denis.pelli@>
wrote:
> > > >
> > > > On Feb 16, 2005, at 12:41 PM, Sowmya Ravikumar wrote:
> > > > > I am trying to use Psychtoolbox with OS X ... The 'GetClut' and
> > > > > 'SetClut'
> > > > > preferences seem to be missing.
> > > >
> > > >
> > > > dear sowmya
> > > >
> > > > that's right. the roadmap indicates that CLUT control will appear
> > > > shortly:
> > > > 18 February 2005 Adds LoadClut and Screen('Gamma')
> > > >
> > > > http://psychtoolbox.org/osx.html#roadmap
> > > >
> > > > we are all waiting with bated breath.
> > > >
> > > > best
> > > >
> > > > denis
> > > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > Post your message to: psychtoolbox@yahoogroups.com
> > > Please indicate OS9, OSX, or WIN version, and include your full
name.
> > > Denis Pelli, David Brainard, and Allen Ingling.
> > > http://psychtoolbox.org
> > >
> > > Yahoo! Groups Links
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
>
Hi Daniel,

I've been reading this thread with interest, as I need to get my
projectors calibrated. I was very pleased to see your example code.
However, I seem to get stupid values when I try to read in your
gamma_CLUT. The code in gammaLinearizationExample.m says:
fid = fopen('myGammaTable', 'r');
gamma_CLUT = fread(fid, [256 3], 'float64');
fclose(fid);
but that gives me tiny values - for example the first row,
gamma_CLUT(1,:), is
1.0e-318 *
0.30386557445085 0.30386557445085 0.30386557445085.

I can see from the line gamma_CLUT = (gamma_CLUT - 1)/255 that this is
not what the values are meant to be! Any idea what might be going wrogn?
Could you maybe send the file in a different format, e.g. ascii?

I'm using Matlab 7 and PTB OSX version 1.0.6.

Thanks,

Jenny


--
Jenny Read Office: +44 191 222 7559
Royal Society University Research Fellow Mobile: +44 794 401 5796
Henry Wellcome Building for Neuroecology, Fax: +44 191 222 5622
University of Newcastle, Framlington Place mailto:J.C.A.Read@...
Newcastle upon Tyne, NE2 4HH, UK. http://www.staff.ncl.ac.uk/j.c.a.read



Daniel Shima wrote:

> Mario Kleiner wrote:
> >> * Could somebody else on the list tell us if
> >> LoadNormalizedGammaTable worked for him for
> >> linearizing the display? And maybe give some input?
>
> Absolutely. Attached you should find "myGammaTable" and
> "gammaLinearizationExample.m" which are to be placed in the same
> folder. Run the M-file _after_ you examine it and read my comments.
>
> "myGammaTable" was created using a Minolta CA-100 color analyzer for
> 256x3 pure luminance readings for each individual level the RGB guns
> and a series of custom M-files I inherited which perform a polynomial
> fit on each gamma curve and then compute the linearization curve which
> gets converted into a 256x3 matrix of discrete levels between 0 and
> 255.
>
> For convenience, I imagine that anyone following this thread would
> just examine the matrix "gamma_CLUT" in "gammaLinearizationExample.m"
> to see what the values in "myGammaTable" look like. That's the
> easiest way.
>
> Commentary overall on applying linearized CLUT in OSX and using
> Screen('LoadNormalizedGammaTable'):
>
> 1. As I learned quickly when I first did this, CLUTs in OSX are real
> numbers between 0 and 1. CLUTs in OS9 are integers between 0 and 255.
>
> 2. As noted in the attached M-file and as you should see if you run
> it, I seem to be able to change the color of the screen with just
> Screen('LoadNormalizedGammaTable') and no subsequent Screen('Flip')
> which is why I hypothesized before that CLUT animation is possible in
> OSX. But I have never programmed any full CLUT animation.
>
> 3. I find my luminance linearizations in OSX to be acceptable. That
> is, while the steps in the CLUT become much, much, much closer to
> being equal in cd/m^2 output and the stimuli created with it is quite
> useful, it is hardly perfect. For the most part, if the luminance
> doubles close enough from gun level 10 to 20, 20 to 40, 30 to 60,
> etc., I consider it a successful calibration. And to date, I have
> only used this in OSX stimuli in which the screen changes from a
> middle gray to black and white noise patterns, and the applied
> linearized gamma table most definitely prevents the noticeable flash
> of global luminance change observed without it.
>
> But any imperfections were the case in OS9 too, and so I suspect the
> same issues like monitor consistency from day to day or in different
> stages of warming up, variability of a single color on different parts
> of the screen, accuracy and precision of my luminance meter,
> inaccuracies when linearization curve is rounded to whole numbers
> between 0 and 255, etc. In all, aside from very local and particular
> issues related to porting my whole monitor calibration/linearization
> routine from OS9 to OSX, in the end, the experience is the same.
> Create the linearized gamma tables, load them up shortly after
> Screen('OpenWindow'), and then forget about them and code everything
> else as usual. For different stimuli on the same computer and
> monitor, cut and paste the gamma table stuff between programs.
>
> Daniel Shima
> Vanderbilt Vision Research Center
>
>
> On 3/29/06, Mario Kleiner <mario.kleiner@...> wrote:
> > Hi,
> >
> > a couple of comments before someone starts too much work:
> >
> > * Kristina, could you verify if your display is linearized *after*
> > calibration with your software and *before* loading the CLUT? --> Just
> > create images with increments and measure with the photometer
> > *without* calling 'LoadNormalizedGammaTable'? Maybe it has nothing to
> > do with PTB but something is going wrong with your calibration
> > procedure. The meaning of Gammatables is pretty well defined, so i
> > doubt that OS-X color management is interfering in some magic way,
> > although i'm not an expert in display calibration at all.
> >
> > * Could somebody else on the list tell us if LoadNormalizedGammaTable
> > worked for him for linearizing the display? And maybe give some input?
> >
> > * I just browsed through the source code of the OS-X 10.4.5 operating
> > system kernel and IOKit device drivers and had a look at the lower
> > level interfaces to gamma tables and their specific implementation in
> > the drivers (IOFramebuffer, IONDRVFramebuffer) and from everyhting i
> > read i think that CGSet/GetDisplayTransferByTable() is the best we can
> > get -- and at the same time all we need. I could not find any
> > interface even at the lower/lowest levels of the system (IOKit
> > low-level access via MachServicePorts, kernel level drivers, ...)
> > that would allow to retrieve the real hardware gamma tables. To get
> > them you'd probably have to understand and hack the lowest level
> > device drivers by NVidia and ATI -- which is difficult given their
> > implementation is a well kept secret. Also, the system itself does not
> > seem to cache the gamma tables anywhere. There are low-level calls in
> > IOKit to set the gamma tables as 16-bit unsigned int arrays, bypassing
> > CoreGraphics, see FBSetGamma (which is probably called by
> > CoreGraphics) in
> >
> <http://gemma.apple.com/documentation/Darwin/Reference/IOKit/IOGraphicsLib/CompositePage.html#//apple_ref/c/func/IOFBSetGamma>
> > which calls IOFramebuffer::extSetGammaTable in
> >
> <http://www.opensource.apple.com/darwinsource/10.4.5.ppc/IOGraphics-179.2/IOGraphicsFamily/IOFramebuffer.cpp>
> > which calls IONDRVFramebuffer::SetGammaTable in
> >
> <http://www.opensource.apple.com/darwinsource/10.4.5.ppc/IOGraphics-179.2/IONDRVSupport/IONDRVFramebuffer.cpp>
> > which calls the low-level functions of the NVidia/ATI drivers...
> >
> > looking at their implementation, they either update the hw-tables
> > immediately or (optionally) at the next vertical retrace, but after
> > the update they trhow away their copy of the gamma table.
> >
> > The information about DAC precision also doesn't show up anywhere at
> > the system level, so there's probably really no system interface to
> > query DAC precision.
> >
> > Therefore i assume that any portable and well behaved application has
> > to go through CoreGraphics to set the display calibration and the
> > changes should affect the tables returned by ReadNormalizedGammaTable.
> >
> > But as a side effect, i found a few other IOKit low-level interfaces
> > that could be useful for other purposes in PTB ;-)
> >
> > best,
> > -mario
> >
> >
> >
> >
> > --- In psychtoolbox@yahoogroups.com, allen.ingling@... wrote:
> > >
> > > > On Mar 29, 2006, at 11:45 AM, Kristina Visscher wrote:
> > > >> On Mar 29, 2006, at 12:36 AM, Ingling Allen wrote:
> > > >> Secondly, it is important to validate a calibration within the
> > > >> Psychtoolbox by loading the linear table and stepping the
> > > >> luminance while metering the display; test that supposed equal
> > > >> luminance increments really are equal.
> > > > I validated the calibration within Psychtoolbox -- loaded the CLUT,
> > > > and stepped the luminance in increments of 10 units (on a 1 to 256
> > > > scale, much like that done in CLUTAnimDemoOSX). We used a
> > > > photometer to measure luminance at each step and it's definitely
> > > > not linear! An increment of 10 units gives a luminance difference
> > > > of about 2 candles/m^2 at the low end of the spectrum. At the high
> > > > end, this increment gives a luminance difference about 20!
> > >
> > > Dear Kristina,
> > >
> > > Well it looks as if copying the gamma table set after the new
> > > calibration and reloading it using LoadNormalizedGammaTable/
> > > CGSetDisplayTransferByTable() does not set a linearized gamma table.
> > > That method relied on some guesses about how color management works
> > > in OS X and maybe those guesses are incorrect.
> > >
> > > One way to proceed is:
> > > 1. Port the IccProfile function from the OS 9 PTB to the OS X PTB
> > > and then use that to read into MATLAB the profile file stored by your
> > > gretagmacbeth eye-one display2.
> > > 2. Use the profile loaded in step 1 to generate a linear gamma table
> > > to be passed to LoadClut.
> > > 3. Port LoadClut from OS 9 to OS X. To do that, find out if
> > > CGSetDisplayTransferByTable() transforms values before loading the
> > > hardware CLUT. If it does not transform values, then LoadClut could
> > > be implemented on OS X by using LoadNormalizedGammaTable. If it does
> > > transform values, then that needs to be either switched off somehow
> > > or undone by applying the inverse transform before using
> > > LoadNormalizedGammaTable. Here looks like the place to start for
> > > understanding color management in OS X.
> > >
> > > On the one hand, that all requires some work. On the other hand, the
> > > results would be generally useful to anyone needing a calibrated
> > > display, which makes it more likely that others will help.
> > >
> > > best,
> > >
> > > Allen
> > >
> > >
> > >
> > > On Mar 29, 2006, at 11:45 AM, Kristina Visscher wrote:
> > >
> > > > Thanks, Allen and Mario!
> > > > I appreciate the help!
> > > >
> > > >> To test that gamma tables set by your gretagmacbeth display2 are
> > > >> read back by ReadNormalizedGammaTable, you could generate to two
> > > >> substantially different calibrations using the gretagmacbeth
> > > >> display2 and then compare tables returned by
> > > >> ReadNormalizedGammaTable. Changing the brightness&contrast
> > > >> settings on your monitor should produce different calibrations and
> > > >> ReadNormalizedGammaTable should return different tables, if your
> > > >> method works.
> > > >
> > > > I did this, and get different tables returned by
> > > > ReadNormalizedGammaTable. So, it seems that I'm actually getting
> > > > the table correctly, since the two tables are different.
> > > >
> > > >> Secondly, it is important to validate a calibration within the
> > > >> Psychtoolbox by loading the linear table and stepping the
> > > >> luminance while metering the display; test that supposed equal
> > > >> luminance increments really are equal.
> > > > I validated the calibration within Psychtoolbox -- loaded the CLUT,
> > > > and stepped the luminance in increments of 10 units (on a 1 to 256
> > > > scale, much like that done in CLUTAnimDemoOSX). We used a
> > > > photometer to measure luminance at each step and it's definitely
> > > > not linear! An increment of 10 units gives a luminance difference
> > > > of about 2 candles/m^2 at the low end of the spectrum. At the high
> > > > end, this increment gives a luminance difference about 20!
> > > >
> > > >> Is the gretagmacbeth eye-one display2 useful for metering
> > > >> alone? Or will it only meter in conjunction with setting a gamma
> > > >> table and there is no way to obtain single readings on demand?
> > > >
> > > > As far as I know the gretagmacbeth eye-one display2 is useful only
> > > > in conjunction with setting a gamma table. I use software that
> > > > comes with it -- perhaps with different software one could obtain
> > > > single readings on demand.
> > > >
> > > >
> > > > So I seem to be missing some step here. Any suggestions?
> > > >
> > > > Thanks so much!!
> > > >
> > > > Kristina
> > > >
> > > >
> > > > On Mar 29, 2006, at 12:36 AM, Ingling Allen wrote:
> > > >
> > > > On Mar 28, 2006, at 4:48 PM, visschek98 wrote:
> > > >
> > > >
> > > >> I have been using an eye-one display2 screen calibration device
> > > >> from gretagmacbeth. .... Then, in matlab, using the
> > > >> line
> > > >> 'origLUT=Screen('ReadNormalizedGammaTable', screenNumber);'
> > > >> ... I download the clut from the newly
> > > >> calibrated monitor.
> > > >> Is this an acceptable LUT?
> > > >>
> > > >
> > > > Maybe. Even though ReadNormalizedGammaTable() does not read the
> > > > hardware gamma table, it is nonetheless possible that your
> > > > gretagmacbeth display2 calibration loaded a linear gamma table
> > > > which was stored by Core Graphics and then successfully read back
> > > > by the Psychtoolbox's ReadNormalizedGammaTable.
> > > >
> > > >
> > > >> What other tests should I do to make sure?
> > > >
> > > > To test that gamma tables set by your gretagmacbeth display2 are
> > > > read back by ReadNormalizedGammaTable, you could generate to two
> > > > substantially different calibrations using the gretagmacbeth
> > > > display2 and then compare tables returned by
> > > > ReadNormalizedGammaTable. Changing the brightness&contrast
> > > > settings on your monitor should produce different calibrations and
> > > > ReadNormalizedGammaTable should return different tables, if your
> > > > method works.
> > > >
> > > > Secondly, it is important to validate a calibration within the
> > > > Psychtoolbox by loading the linear table and stepping the luminance
> > > > while metering the display; test that supposed equal luminance
> > > > increments really are equal. Is the gretagmacbeth eye-one
> > > > display2 useful for metering alone? Or will it only meter in
> > > > conjunction with setting a gamma table and there is no way to
> > > > obtain single readings on demand?
> > > >
> > > >> origLUT=Screen('ReadNormalizedGammaTable', screenNumber);'
> > > >>
> > > >
> > > > A warning to everyone about ReadNormalizedGammaTable:
> > > >
> > > > ReadNormalizedGammaTable does NOT read back the gamma table from
> > > > the video board. You can test this by writing then reading back the
> > > > table: Use LoadNormalizedGammaTable to load a table with increments
> > > > smaller than 1/2 bit. For example, for a video card with 10-bit
> > > > DACS, set luminance steps in your table of less than 1/2048 but
> > > > greater than the precision of a float. Then read back the table
> > > > using ReadNormalizedGammaTable. I found that
> > > > ReadNormalizedGammaTable returns a table identical to the one
> > > > previously loaded, including the false precision. If it were
> > > > actually reading back from the hardware gamma table, then you would
> > > > expect it to read back a table with 1-bit steps between increments.
> > > >
> > > > LoadNormalizedGammaTable and ReadNormalizedGammaTable call Apple
> > > > Core Graphics functions CGSetDisplayTransferByTable() and
> > > > CGGetDisplayTransferByTable(), respectively. What appears to be
> > > > going on is that CGSetDisplayTransferByTable() caches the table of
> > > > floats which it is passed, converts it to 16-bit ints, and then
> > > > passes that to the video driver. The video driver and video board
> > > > load the int values, ignoring some of the least-significant bits,
> > > > depending on the precision of the DAC. CGGetDisplayTransferByTable
> > > > () returns the float table cached by CGSetDisplayTransferByTable(),
> > > > it does not read back the hardware table from the video board and
> > > > normalize that to the interval [0,1].
> > > >
> > > > It is remotely possible Apple has fixed CGGetDisplayTransferByTable
> > > > () so that it actually reads back the hardware gamma table from the
> > > > video board. I have not tested it recently. Someone could repeat
> > > > the read/write test using LoadNormalizedGammaTable and
> > > > ReadNormalizedGammaTable to check for that. If
> > > > ReadNormalizedGammaTable seems to read back the actual table, then
> > > > that could be used to detect the precision of video card DACs.
> > > >
> > > > The Psychtoolbox calls Apple's CoreGraphics functions (in
> > > > conjuction with OpenGL and CoreOpenGL) to do its work and usually
> > > > that's ok. There were two outstanding problems with CoreGraphics
> > > > though: It will not report the precision of video DACS and it does
> > > > not read back the gamma table from the video board. Within the
> > > > Psychtoolbox source, supplementing calls to CoreGraphics with calls
> > > > to IOKit to talk more directly to the video hardware would be
> helpful.
> > > >
> > > > best,
> > > >
> > > > Allen
> > > >
> > > >
> > > >
> > > > On Mar 28, 2006, at 4:48 PM, visschek98 wrote:
> > > >
> > > >> Perhaps this is a naive question, but where are you getting your
> > > >> luminance calibration
> > > >> table?
> > > >> I have been using an eye-one display2 screen calibration device
> > > >> from gretagmacbeth. (you
> > > >> stick it to the monitor and it calibrates the monitor for you).
> > > >> Then, in matlab, using the
> > > >> line
> > > >> 'origLUT=Screen('ReadNormalizedGammaTable', screenNumber);'
> > > >> (see CLUTAnimDemoOSX psychtoolbox function) I download the clut
> > > >> from the newly
> > > >> calibrated monitor.
> > > >> Is this an acceptable LUT? What other tests should I do to make
> > > >> sure?
> > > >>
> > > >> Thanks!
> > > >> Kristina
> > > >>
> > > >> --- In psychtoolbox@yahoogroups.com, "Daniel Shima"
> > > >> <danielshima@> wrote:
> > > >>>
> > > >>> Look into this:
> > > >>>
> > > >>>>> Screen LoadNormalizedGammaTable?
> > > >>>
> > > >>> It definitely can be used to apply a luminance calibration
> table and
> > > >>> might be able to be used for CLUT animation. There was a mention
> > > >>> in a
> > > >>> message last summer:
> > > >>>
> > > >>> "CLUTAnimDemo shows how one can do CLUT-Animation via
> > > >>> Screen('LoadNormalizedGammaTable')."
> > > >>>
> > > >>> Daniel Shima
> > > >>> Vanderbilt Vision Research Center
> > > >>>
> > > >>>
> > > >>> On 3/23/06, nicobonniernico <nicobonniernico@> wrote:
> > > >>>> Hi Everybody,
> > > >>>>
> > > >>>> I am also trying to use Psychtoolbox with OS X ... The
> > > >>>> 'GetClut' and
> > > >>>> 'SetClut' preferences seem to be still missing.
> > > >>>> Any suggestion on how to either use IccProfile, SetClut or any
> > > >>>> other
> > > >>>> way to calibrate my monitor with Mac Os X would be more than
> > > >>>> welcome.
> > > >>>> Thanks,
> > > >>>>
> > > >>>> Nicolas
> > > >>>>
> > > >>>> nbonnier 'at' gmail.com
> > > >>>>
> > > >>>>
> > > >>>> --- In psychtoolbox@yahoogroups.com, Denis Pelli <denis.pelli@>
> > > >>>> wrote:
> > > >>>>>
> > > >>>>> On Feb 16, 2005, at 12:41 PM, Sowmya Ravikumar wrote:
> > > >>>>>> I am trying to use Psychtoolbox with OS X ... The
> 'GetClut' and
> > > >>>>>> 'SetClut'
> > > >>>>>> preferences seem to be missing.
> > > >>>>>
> > > >>>>>
> > > >>>>> dear sowmya
> > > >>>>>
> > > >>>>> that's right. the roadmap indicates that CLUT control will
> appear
> > > >>>>> shortly:
> > > >>>>> 18 February 2005 Adds LoadClut and Screen('Gamma')
> > > >>>>>
> > > >>>>> http://psychtoolbox.org/osx.html#roadmap
> > > >>>>>
> > > >>>>> we are all waiting with bated breath.
> > > >>>>>
> > > >>>>> best
> > > >>>>>
> > > >>>>> denis
> > > >>>>>
> > > >>>>
> > > >>>>
> > > >>>>
> > > >>>>
> > > >
> > > >
> > > >
> > > > Post your message to: psychtoolbox@yahoogroups.com
> > > > Please indicate OS9, OSX, or WIN version, and include your full
> name.
> > > > Denis Pelli, David Brainard, and Allen Ingling.
> > > > http://psychtoolbox.org
> > > >
> > > >
> > > >
> > > >
> > > > SPONSORED LINKS
> > > > Truck toolboxes Pickup truck toolboxes Toolbox
> > > > Uws toolboxes Craftsman toolboxes
> > > >
> > > > YAHOO! GROUPS LINKS
> > > >
> > > > Visit your group "psychtoolbox" on the web.
> > > >
> > > > To unsubscribe from this group, send an email to:
> > > > psychtoolbox-unsubscribe@yahoogroups.com
> > > >
> > > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service.
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Post your message to: psychtoolbox@yahoogroups.com
> > > > Please indicate OS9, OSX, or WIN version, and include your full
> name.
> > > > Denis Pelli, David Brainard, and Allen Ingling.
> > > > http://psychtoolbox.org
> > > >
> > > >
> > > >
> > > > YAHOO! GROUPS LINKS
> > > >
> > > > Visit your group "psychtoolbox" on the web.
> > > >
> > > > To unsubscribe from this group, send an email to:
> > > > psychtoolbox-unsubscribe@yahoogroups.com
> > > >
> > > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service.
> > > >
> > > >
> > >
> >
> >
> >
> >
> >
> > Post your message to: psychtoolbox@yahoogroups.com
> > Please indicate OS9, OSX, or WIN version, and include your full name.
> > Denis Pelli, David Brainard, and Allen Ingling.
> > http://psychtoolbox.org
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
>
>
> Post your message to: psychtoolbox@yahoogroups.com
> Please indicate OS9, OSX, or WIN version, and include your full name.
> Denis Pelli, David Brainard, and Allen Ingling.
> http://psychtoolbox.org
>
>
>
>
> SPONSORED LINKS
> Truck toolboxes
> <http://groups.yahoo.com/gads?t=ms&k=Truck+toolboxes&w1=Truck+toolboxes&w2=Pickup+truck+toolboxes&w3=Toolbox&w4=Uws+toolboxes&w5=Craftsman+toolboxes&c=5&s=106&.sig=38wskw1QvO5vNFbDpylDhg>
> Pickup truck toolboxes
> <http://groups.yahoo.com/gads?t=ms&k=Pickup+truck+toolboxes&w1=Truck+toolboxes&w2=Pickup+truck+toolboxes&w3=Toolbox&w4=Uws+toolboxes&w5=Craftsman+toolboxes&c=5&s=106&.sig=Uo8QGlL28vXOl4wY8DzHhQ>
> Toolbox
> <http://groups.yahoo.com/gads?t=ms&k=Toolbox&w1=Truck+toolboxes&w2=Pickup+truck+toolboxes&w3=Toolbox&w4=Uws+toolboxes&w5=Craftsman+toolboxes&c=5&s=106&.sig=xsknyX96ZD5gxYuYhZhTEA>
>
> Uws toolboxes
> <http://groups.yahoo.com/gads?t=ms&k=Uws+toolboxes&w1=Truck+toolboxes&w2=Pickup+truck+toolboxes&w3=Toolbox&w4=Uws+toolboxes&w5=Craftsman+toolboxes&c=5&s=106&.sig=vu6i0bw4YBZwU-UlokJcRQ>
> Craftsman toolboxes
> <http://groups.yahoo.com/gads?t=ms&k=Craftsman+toolboxes&w1=Truck+toolboxes&w2=Pickup+truck+toolboxes&w3=Toolbox&w4=Uws+toolboxes&w5=Craftsman+toolboxes&c=5&s=106&.sig=oBKiGXPG6n_8uHLrT3ofmQ>
>
>
>
> ------------------------------------------------------------------------
> YAHOO! GROUPS LINKS
>
> * Visit your group "psychtoolbox
> <http://groups.yahoo.com/group/psychtoolbox>" on the web.
>
> * To unsubscribe from this group, send an email to:
> psychtoolbox-unsubscribe@yahoogroups.com
> <mailto:psychtoolbox-unsubscribe@yahoogroups.com?subject=Unsubscribe>
>
> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/>.
>
>
> ------------------------------------------------------------------------
>
>------------------------------------------------------------------------
>
>% N.B. Most likely, what I call the default CLUT below is _NOT_ the CLUT that
>% your screen was using originally, but if your computer is like mine,
>% that CLUT will be restored when you eventually quit MATLAB and the Mac OS restores
>% its working CLUT.
>
>% If you are worried about not being able to reverse CLUT changes, then carefully save
>% "initial_CLUT" below the first time you run the program.
>
>clear all;
>
>apply_linearization_table = 1; % Zero or one.
>apply_default_table = 0; % Zero or one.
>screen_used = 0;
>
>Screen('Preference', 'VisualDebugLevel', 0);
>[window, screenRect] = Screen(screen_used, 'OpenWindow');
>
>% Display a middle grey using whatever CLUT was last loaded, and wait one second.
>Screen(window, 'FillRect', [127 127 127], screenRect);
>Screen( window, 'Flip');
>WaitSecs(1.000);
>
>% Make whatever CLUT changes according to flag settings above.
>% In this sample program, to observe any change, run with one of the "apply" flags set to zero
>% and the other set to one. Then run again with the reverse settings.
>
>if (apply_linearization_table)
> fid = fopen('myGammaTable', 'r');
> gamma_CLUT = fread(fid, [256 3], 'float64');
> fclose(fid);
> gamma_CLUT = (gamma_CLUT - 1)/255; % OSX CLUT need to be real number range between 0 and 1. OS9 CLUT needed to be integer range between 0 and 255.
> initial_CLUT = Screen('ReadNormalizedGammaTable', window);
> Screen('LoadNormalizedGammaTable', window, gamma_CLUT);
>end
>
>if (apply_default_table)
> gamma_CLUT = [0:255; 0:255; 0:255]';
> gamma_CLUT = gamma_CLUT/255; % OSX CLUT need to be real number range between 0 and 1. OS9 CLUT needed to be integer range between 0 and 255.
> initial_CLUT = Screen('ReadNormalizedGammaTable', window);
> Screen('LoadNormalizedGammaTable', window, gamma_CLUT);
>
>end
>
>% Observer any color changes due to new CLUT loading for one second.
>% This is also a very minimal example of CLUT animation as no subsequent
>% Screen('Flip') is done.
>WaitSecs(1.000);
>
>Screen('CloseAll');
>
>
>
>
>
>
>
>
>
>
If you solved step 1 then there's no reason to do step 2, instead you
should calculate your gamma-table and upload it with
Screen('LoadNormalizedGammatable',...). It would look like this:

for i=0:255
mylut(i, :)=(i/255)^(1/gamma);
end;
Screen('LoadNormalizedGammaTable', screenid, mylut);

This does the same as your step 2, but:

a) Its faster - you don't need to remap each of your images.

b) Its easier - Your gamma applies to all drawing operations, without
needing you to implement the mapping for each color, think about
movies, other drawing commands, ...

c) Its potentially more accurate: Many gfx-cards have >=10-Bit DAC's,
loading the hardware lookup tables takes advantage of the >=2 extra
bits, giving you a better linearization of your display. Your method
is always limited to 8-Bit, so your stims suffer more degradation due
to the remapping with low accuracy.

Another way to get the gamma-table from your software would be
probably to simply load & apply the .icc profile that your software
created, using Apple's display settings panel. Then you can read out
the table that corresponds to that profile with the
Screen('ReadNormalizedGammaTable',...) command.

best,
-mario

--- In psychtoolbox@yahoogroups.com, Kristina Visscher <visscher@...>
wrote:
>
> Hi, everyone
> Thanks tremendously for all the help with determining and setting a
> gamma table! After lots of advice from Josef Fizer and Pete Bex,
> here's one solution that I'd like to run past you to see if it makes
> sense. This solution alleviates the need for a separate gamma table
> for psych toolbox scripts, and allows one to calibrate using quick
> and simple routines from available hardware.
> Step 1: Determine gamma
> If you have calibration software and hardware, set gamma using this
> hardware to a particular value. The Eye-One Display 2 hardware by
> Gretagmacbeth will calibrate your screen (and create a *.icc file) to
> have a particular gamma.
> Otherwise, you can calculate gamma for your monitor by testing with
> a photometer, and fitting the output to output =x^gamma, where x goes
> from 0 to 1, and is the scaled look up table value
>
> Step 2: scale stimuli by gamma
> Knowing the gamma value for your monitor, use this information to
> scale images to make them linear onscreen!
> newimage= 255*(image/255).^(1/gamma)
> This changes the luminance of each pixel according to the gamma for
> your screen.
>
> This is a really simple method, but I understand it could have some
> drawbacks, for example, if you use color images. However, I think
> it's pretty simple to understand, and simple and fast to implement.
> Does anyone have any comments about this procedure?
>
> Thanks!
> Kristina
>
> Kristina Visscher
>
> Postdoctoral Fellow
> Brandeis University
> Waltham, MA 02454-9110
> (781) 736 - 3266 - lab
> (314) 369 - 6588 - cell
> visscher@...
>
>
>
> On Mar 30, 2006, at 12:51 AM, allen.ingling@... wrote:
>
>
> Dear Kristina, Mario and Dan,
>
> Kristina's method of linearizing failed probably because the Eye-One
> Display 2 calibration software did not set a linear gamma table. It
> is extremely unlikely to have set a linear table by default because
> everybody except vision researches uses non-linear gamma.
>
> Assuming that to be true, considering Dan's evidence for
> LoadNormalizedGammaTable not transforming values and modifying my
> previous advice accordingly, the minimal effort to linearize the OS X
> Psychtoolbox display using the Eye-One Display 2 calibrator would be
> this:
>
> 1. Port the IccProfile function from the OS 9 PTB to the OS X PTB
> and then use that to read into MATLAB the profile file stored by your
> Eye-One Display 2.
> 2. Use the profile loaded in step 1 to generate a linear gamma table.
> 3. Load the linearized gamma table from step 2 using Screen
> ('LoadNormalizedGammaTable').
>
> Any comments on whether that would work? And did anyone ever
> actually use the IccProfile function in OS 9 to read a profile and
> generate a linear table set by LoadClut?
>
> Some comments on other, non-immediate objectives:
>
> - Though not necessary, it is nonetheless desirable to implement
> LoadClut in OS X using LoadNormalizedGammaTable so to match the OS 9
> PTB which provides LoadClut.
>
> - Mario is correct, IOKit, the layer under CoreGraphics, turns out
> not to provide any way to read back the gamma table. Here is a
> concise description of what graphics functions IOKit provides. The
> next layer down is the video driver, which should present a
> documented interface to the kernel. It is the other end of the video
> driver, the end which interacts with the video card, which is
> secret. So if we really wanted to read back the gamma table from the
> video board, it might be possible to write a kernel extension, using
> the documented interface to the video driver, which reads and
> returns the gamma table back to user space. I am assuming here that
> the video driver provides a function to read back the gamma table.
> The advantages of doing that would be A) We could detect DAC
> resolutions programmatically. B) We could check what
> CGSetDisplayTransferByTable() is doing, in case there is any
> lingering doubt. C) We could check for bugs in loading the gamma table.
>
> - The Psychtoolbox should know the DAC resolution even if it can not
> detect that programmatically by reading back the gamma table. The
> easiest way to do that is to write a function which detects the model
> of video card, looks up its DAC resolution in a table, and returns
> the result.
>
> best,
>
> Allen
>
>
>
>
> On Mar 29, 2006, at 7:15 PM, Daniel Shima wrote:
>
> > Mario Kleiner wrote:
> >>> * Could somebody else on the list tell us if
> >>> LoadNormalizedGammaTable worked for him for
> >>> linearizing the display? And maybe give some input?
> >
> > Absolutely. Attached you should find "myGammaTable" and
> > "gammaLinearizationExample.m" which are to be placed in the same
> > folder. Run the M-file _after_ you examine it and read my comments.
> >
> > "myGammaTable" was created using a Minolta CA-100 color analyzer for
> > 256x3 pure luminance readings for each individual level the RGB guns
> > and a series of custom M-files I inherited which perform a polynomial
> > fit on each gamma curve and then compute the linearization curve which
> > gets converted into a 256x3 matrix of discrete levels between 0 and
> > 255.
> >
> > For convenience, I imagine that anyone following this thread would
> > just examine the matrix "gamma_CLUT" in "gammaLinearizationExample.m"
> > to see what the values in "myGammaTable" look like. That's the
> > easiest way.
> >
> > Commentary overall on applying linearized CLUT in OSX and using
> > Screen('LoadNormalizedGammaTable'):
> >
> > 1. As I learned quickly when I first did this, CLUTs in OSX are real
> > numbers between 0 and 1. CLUTs in OS9 are integers between 0 and 255.
> >
> > 2. As noted in the attached M-file and as you should see if you run
> > it, I seem to be able to change the color of the screen with just
> > Screen('LoadNormalizedGammaTable') and no subsequent Screen('Flip')
> > which is why I hypothesized before that CLUT animation is possible in
> > OSX. But I have never programmed any full CLUT animation.
> >
> > 3. I find my luminance linearizations in OSX to be acceptable. That
> > is, while the steps in the CLUT become much, much, much closer to
> > being equal in cd/m^2 output and the stimuli created with it is quite
> > useful, it is hardly perfect. For the most part, if the luminance
> > doubles close enough from gun level 10 to 20, 20 to 40, 30 to 60,
> > etc., I consider it a successful calibration. And to date, I have
> > only used this in OSX stimuli in which the screen changes from a
> > middle gray to black and white noise patterns, and the applied
> > linearized gamma table most definitely prevents the noticeable flash
> > of global luminance change observed without it.
> >
> > But any imperfections were the case in OS9 too, and so I suspect the
> > same issues like monitor consistency from day to day or in different
> > stages of warming up, variability of a single color on different parts
> > of the screen, accuracy and precision of my luminance meter,
> > inaccuracies when linearization curve is rounded to whole numbers
> > between 0 and 255, etc. In all, aside from very local and particular
> > issues related to porting my whole monitor calibration/linearization
> > routine from OS9 to OSX, in the end, the experience is the same.
> > Create the linearized gamma tables, load them up shortly after
> > Screen('OpenWindow'), and then forget about them and code everything
> > else as usual. For different stimuli on the same computer and
> > monitor, cut and paste the gamma table stuff between programs.
> >
> > Daniel Shima
> > Vanderbilt Vision Research Center
> >
> >
> > On 3/29/06, Mario Kleiner <mario.kleiner@...> wrote:
> >> Hi,
> >>
> >> a couple of comments before someone starts too much work:
> >>
> >> * Kristina, could you verify if your display is linearized *after*
> >> calibration with your software and *before* loading the CLUT? -->
> >> Just
> >> create images with increments and measure with the photometer
> >> *without* calling 'LoadNormalizedGammaTable'? Maybe it has nothing to
> >> do with PTB but something is going wrong with your calibration
> >> procedure. The meaning of Gammatables is pretty well defined, so i
> >> doubt that OS-X color management is interfering in some magic way,
> >> although i'm not an expert in display calibration at all.
> >>
> >> * Could somebody else on the list tell us if LoadNormalizedGammaTable
> >> worked for him for linearizing the display? And maybe give some
> >> input?
> >>
> >> * I just browsed through the source code of the OS-X 10.4.5 operating
> >> system kernel and IOKit device drivers and had a look at the lower
> >> level interfaces to gamma tables and their specific implementation in
> >> the drivers (IOFramebuffer, IONDRVFramebuffer) and from everyhting i
> >> read i think that CGSet/GetDisplayTransferByTable() is the best we
> >> can
> >> get -- and at the same time all we need. I could not find any
> >> interface even at the lower/lowest levels of the system (IOKit
> >> low-level access via MachServicePorts, kernel level drivers, ...)
> >> that would allow to retrieve the real hardware gamma tables. To get
> >> them you'd probably have to understand and hack the lowest level
> >> device drivers by NVidia and ATI -- which is difficult given their
> >> implementation is a well kept secret. Also, the system itself does
> >> not
> >> seem to cache the gamma tables anywhere. There are low-level calls in
> >> IOKit to set the gamma tables as 16-bit unsigned int arrays,
> >> bypassing
> >> CoreGraphics, see FBSetGamma (which is probably called by
> >> CoreGraphics) in
> >> <http://gemma.apple.com/documentation/Darwin/Reference/IOKit/
> >> IOGraphicsLib/CompositePage.html#//apple_ref/c/func/IOFBSetGamma>
> >> which calls IOFramebuffer::extSetGammaTable in
> >> <http://www.opensource.apple.com/darwinsource/10.4.5.ppc/
> >> IOGraphics-179.2/IOGraphicsFamily/IOFramebuffer.cpp>
> >> which calls IONDRVFramebuffer::SetGammaTable in
> >> <http://www.opensource.apple.com/darwinsource/10.4.5.ppc/
> >> IOGraphics-179.2/IONDRVSupport/IONDRVFramebuffer.cpp>
> >> which calls the low-level functions of the NVidia/ATI drivers...
> >>
> >> looking at their implementation, they either update the hw-tables
> >> immediately or (optionally) at the next vertical retrace, but after
> >> the update they trhow away their copy of the gamma table.
> >>
> >> The information about DAC precision also doesn't show up anywhere at
> >> the system level, so there's probably really no system interface to
> >> query DAC precision.
> >>
> >> Therefore i assume that any portable and well behaved application has
> >> to go through CoreGraphics to set the display calibration and the
> >> changes should affect the tables returned by
> >> ReadNormalizedGammaTable.
> >>
> >> But as a side effect, i found a few other IOKit low-level interfaces
> >> that could be useful for other purposes in PTB ;-)
> >>
> >> best,
> >> -mario
> >>
> >>
> >>
> >>
> >> --- In psychtoolbox@yahoogroups.com, allen.ingling@ wrote:
> >>>
> >>>> On Mar 29, 2006, at 11:45 AM, Kristina Visscher wrote:
> >>>>> On Mar 29, 2006, at 12:36 AM, Ingling Allen wrote:
> >>>>> Secondly, it is important to validate a calibration within the
> >>>>> Psychtoolbox by loading the linear table and stepping the
> >>>>> luminance while metering the display; test that supposed equal
> >>>>> luminance increments really are equal.
> >>>> I validated the calibration within Psychtoolbox -- loaded the CLUT,
> >>>> and stepped the luminance in increments of 10 units (on a 1 to 256
> >>>> scale, much like that done in CLUTAnimDemoOSX). We used a
> >>>> photometer to measure luminance at each step and it's definitely
> >>>> not linear! An increment of 10 units gives a luminance difference
> >>>> of about 2 candles/m^2 at the low end of the spectrum. At the high
> >>>> end, this increment gives a luminance difference about 20!
> >>>
> >>> Dear Kristina,
> >>>
> >>> Well it looks as if copying the gamma table set after the new
> >>> calibration and reloading it using LoadNormalizedGammaTable/
> >>> CGSetDisplayTransferByTable() does not set a linearized gamma table.
> >>> That method relied on some guesses about how color management works
> >>> in OS X and maybe those guesses are incorrect.
> >>>
> >>> One way to proceed is:
> >>> 1. Port the IccProfile function from the OS 9 PTB to the OS X PTB
> >>> and then use that to read into MATLAB the profile file stored by
> >>> your
> >>> gretagmacbeth eye-one display2.
> >>> 2. Use the profile loaded in step 1 to generate a linear gamma
> >>> table
> >>> to be passed to LoadClut.
> >>> 3. Port LoadClut from OS 9 to OS X. To do that, find out if
> >>> CGSetDisplayTransferByTable() transforms values before loading the
> >>> hardware CLUT. If it does not transform values, then LoadClut could
> >>> be implemented on OS X by using LoadNormalizedGammaTable. If it
> >>> does
> >>> transform values, then that needs to be either switched off somehow
> >>> or undone by applying the inverse transform before using
> >>> LoadNormalizedGammaTable. Here looks like the place to start for
> >>> understanding color management in OS X.
> >>>
> >>> On the one hand, that all requires some work. On the other hand,
> >>> the
> >>> results would be generally useful to anyone needing a calibrated
> >>> display, which makes it more likely that others will help.
> >>>
> >>> best,
> >>>
> >>> Allen
> >>>
> >>>
> >>>
> >>> On Mar 29, 2006, at 11:45 AM, Kristina Visscher wrote:
> >>>
> >>>> Thanks, Allen and Mario!
> >>>> I appreciate the help!
> >>>>
> >>>>> To test that gamma tables set by your gretagmacbeth display2 are
> >>>>> read back by ReadNormalizedGammaTable, you could generate to two
> >>>>> substantially different calibrations using the gretagmacbeth
> >>>>> display2 and then compare tables returned by
> >>>>> ReadNormalizedGammaTable. Changing the brightness&contrast
> >>>>> settings on your monitor should produce different calibrations and
> >>>>> ReadNormalizedGammaTable should return different tables, if your
> >>>>> method works.
> >>>>
> >>>> I did this, and get different tables returned by
> >>>> ReadNormalizedGammaTable. So, it seems that I'm actually getting
> >>>> the table correctly, since the two tables are different.
> >>>>
> >>>>> Secondly, it is important to validate a calibration within the
> >>>>> Psychtoolbox by loading the linear table and stepping the
> >>>>> luminance while metering the display; test that supposed equal
> >>>>> luminance increments really are equal.
> >>>> I validated the calibration within Psychtoolbox -- loaded the CLUT,
> >>>> and stepped the luminance in increments of 10 units (on a 1 to 256
> >>>> scale, much like that done in CLUTAnimDemoOSX). We used a
> >>>> photometer to measure luminance at each step and it's definitely
> >>>> not linear! An increment of 10 units gives a luminance difference
> >>>> of about 2 candles/m^2 at the low end of the spectrum. At the high
> >>>> end, this increment gives a luminance difference about 20!
> >>>>
> >>>>> Is the gretagmacbeth eye-one display2 useful for metering
> >>>>> alone? Or will it only meter in conjunction with setting a gamma
> >>>>> table and there is no way to obtain single readings on demand?
> >>>>
> >>>> As far as I know the gretagmacbeth eye-one display2 is useful only
> >>>> in conjunction with setting a gamma table. I use software that
> >>>> comes with it -- perhaps with different software one could obtain
> >>>> single readings on demand.
> >>>>
> >>>>
> >>>> So I seem to be missing some step here. Any suggestions?
> >>>>
> >>>> Thanks so much!!
> >>>>
> >>>> Kristina
> >>>>
> >>>>
> >>>> On Mar 29, 2006, at 12:36 AM, Ingling Allen wrote:
> >>>>
> >>>> On Mar 28, 2006, at 4:48 PM, visschek98 wrote:
> >>>>
> >>>>
> >>>>> I have been using an eye-one display2 screen calibration device
> >>>>> from gretagmacbeth. .... Then, in matlab, using the
> >>>>> line
> >>>>> 'origLUT=Screen('ReadNormalizedGammaTable', screenNumber);'
> >>>>> ... I download the clut from the newly
> >>>>> calibrated monitor.
> >>>>> Is this an acceptable LUT?
> >>>>>
> >>>>
> >>>> Maybe. Even though ReadNormalizedGammaTable() does not read the
> >>>> hardware gamma table, it is nonetheless possible that your
> >>>> gretagmacbeth display2 calibration loaded a linear gamma table
> >>>> which was stored by Core Graphics and then successfully read back
> >>>> by the Psychtoolbox's ReadNormalizedGammaTable.
> >>>>
> >>>>
> >>>>> What other tests should I do to make sure?
> >>>>
> >>>> To test that gamma tables set by your gretagmacbeth display2 are
> >>>> read back by ReadNormalizedGammaTable, you could generate to two
> >>>> substantially different calibrations using the gretagmacbeth
> >>>> display2 and then compare tables returned by
> >>>> ReadNormalizedGammaTable. Changing the brightness&contrast
> >>>> settings on your monitor should produce different calibrations and
> >>>> ReadNormalizedGammaTable should return different tables, if your
> >>>> method works.
> >>>>
> >>>> Secondly, it is important to validate a calibration within the
> >>>> Psychtoolbox by loading the linear table and stepping the luminance
> >>>> while metering the display; test that supposed equal luminance
> >>>> increments really are equal. Is the gretagmacbeth eye-one
> >>>> display2 useful for metering alone? Or will it only meter in
> >>>> conjunction with setting a gamma table and there is no way to
> >>>> obtain single readings on demand?
> >>>>
> >>>>> origLUT=Screen('ReadNormalizedGammaTable', screenNumber);'
> >>>>>
> >>>>
> >>>> A warning to everyone about ReadNormalizedGammaTable:
> >>>>
> >>>> ReadNormalizedGammaTable does NOT read back the gamma table from
> >>>> the video board. You can test this by writing then reading back the
> >>>> table: Use LoadNormalizedGammaTable to load a table with increments
> >>>> smaller than 1/2 bit. For example, for a video card with 10-bit
> >>>> DACS, set luminance steps in your table of less than 1/2048 but
> >>>> greater than the precision of a float. Then read back the table
> >>>> using ReadNormalizedGammaTable. I found that
> >>>> ReadNormalizedGammaTable returns a table identical to the one
> >>>> previously loaded, including the false precision. If it were
> >>>> actually reading back from the hardware gamma table, then you would
> >>>> expect it to read back a table with 1-bit steps between increments.
> >>>>
> >>>> LoadNormalizedGammaTable and ReadNormalizedGammaTable call Apple
> >>>> Core Graphics functions CGSetDisplayTransferByTable() and
> >>>> CGGetDisplayTransferByTable(), respectively. What appears to be
> >>>> going on is that CGSetDisplayTransferByTable() caches the table of
> >>>> floats which it is passed, converts it to 16-bit ints, and then
> >>>> passes that to the video driver. The video driver and video board
> >>>> load the int values, ignoring some of the least-significant bits,
> >>>> depending on the precision of the DAC. CGGetDisplayTransferByTable
> >>>> () returns the float table cached by CGSetDisplayTransferByTable(),
> >>>> it does not read back the hardware table from the video board and
> >>>> normalize that to the interval [0,1].
> >>>>
> >>>> It is remotely possible Apple has fixed CGGetDisplayTransferByTable
> >>>> () so that it actually reads back the hardware gamma table from the
> >>>> video board. I have not tested it recently. Someone could repeat
> >>>> the read/write test using LoadNormalizedGammaTable and
> >>>> ReadNormalizedGammaTable to check for that. If
> >>>> ReadNormalizedGammaTable seems to read back the actual table, then
> >>>> that could be used to detect the precision of video card DACs.
> >>>>
> >>>> The Psychtoolbox calls Apple's CoreGraphics functions (in
> >>>> conjuction with OpenGL and CoreOpenGL) to do its work and usually
> >>>> that's ok. There were two outstanding problems with CoreGraphics
> >>>> though: It will not report the precision of video DACS and it does
> >>>> not read back the gamma table from the video board. Within the
> >>>> Psychtoolbox source, supplementing calls to CoreGraphics with calls
> >>>> to IOKit to talk more directly to the video hardware would be
> >>>> helpful.
> >>>>
> >>>> best,
> >>>>
> >>>> Allen
> >>>>
> >>>>
> >>>>
> >>>> On Mar 28, 2006, at 4:48 PM, visschek98 wrote:
> >>>>
> >>>>> Perhaps this is a naive question, but where are you getting your
> >>>>> luminance calibration
> >>>>> table?
> >>>>> I have been using an eye-one display2 screen calibration device
> >>>>> from gretagmacbeth. (you
> >>>>> stick it to the monitor and it calibrates the monitor for you).
> >>>>> Then, in matlab, using the
> >>>>> line
> >>>>> 'origLUT=Screen('ReadNormalizedGammaTable', screenNumber);'
> >>>>> (see CLUTAnimDemoOSX psychtoolbox function) I download the clut
> >>>>> from the newly
> >>>>> calibrated monitor.
> >>>>> Is this an acceptable LUT? What other tests should I do to make
> >>>>> sure?
> >>>>>
> >>>>> Thanks!
> >>>>> Kristina
> >>>>>
> >>>>> --- In psychtoolbox@yahoogroups.com, "Daniel Shima"
> >>>>> <danielshima@> wrote:
> >>>>>>
> >>>>>> Look into this:
> >>>>>>
> >>>>>>>> Screen LoadNormalizedGammaTable?
> >>>>>>
> >>>>>> It definitely can be used to apply a luminance calibration
> >>>>>> table and
> >>>>>> might be able to be used for CLUT animation. There was a mention
> >>>>>> in a
> >>>>>> message last summer:
> >>>>>>
> >>>>>> "CLUTAnimDemo shows how one can do CLUT-Animation via
> >>>>>> Screen('LoadNormalizedGammaTable')."
> >>>>>>
> >>>>>> Daniel Shima
> >>>>>> Vanderbilt Vision Research Center
> >>>>>>
> >>>>>>
> >>>>>> On 3/23/06, nicobonniernico <nicobonniernico@> wrote:
> >>>>>>> Hi Everybody,
> >>>>>>>
> >>>>>>> I am also trying to use Psychtoolbox with OS X ... The
> >>>>>>> 'GetClut' and
> >>>>>>> 'SetClut' preferences seem to be still missing.
> >>>>>>> Any suggestion on how to either use IccProfile, SetClut or any
> >>>>>>> other
> >>>>>>> way to calibrate my monitor with Mac Os X would be more than
> >>>>>>> welcome.
> >>>>>>> Thanks,
> >>>>>>>
> >>>>>>> Nicolas
> >>>>>>>
> >>>>>>> nbonnier 'at' gmail.com
> >>>>>>>
> >>>>>>>
> >>>>>>> --- In psychtoolbox@yahoogroups.com, Denis Pelli <denis.pelli@>
> >>>>>>> wrote:
> >>>>>>>>
> >>>>>>>> On Feb 16, 2005, at 12:41 PM, Sowmya Ravikumar wrote:
> >>>>>>>>> I am trying to use Psychtoolbox with OS X ... The
> >>>>>>>>> 'GetClut' and
> >>>>>>>>> 'SetClut'
> >>>>>>>>> preferences seem to be missing.
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> dear sowmya
> >>>>>>>>
> >>>>>>>> that's right. the roadmap indicates that CLUT control will
> >>>>>>>> appear
> >>>>>>>> shortly:
> >>>>>>>> 18 February 2005 Adds LoadClut and Screen('Gamma')
> >>>>>>>>
> >>>>>>>> http://psychtoolbox.org/osx.html#roadmap
> >>>>>>>>
> >>>>>>>> we are all waiting with bated breath.
> >>>>>>>>
> >>>>>>>> best
> >>>>>>>>
> >>>>>>>> denis
> >>>>>>>>
> >>>>>>>
>
>
>
> Post your message to: psychtoolbox@yahoogroups.com
> Please indicate OS9, OSX, or WIN version, and include your full name.
> Denis Pelli, David Brainard, and Allen Ingling.
> http://psychtoolbox.org
>
>
>
> YAHOO! GROUPS LINKS
>
> Visit your group "psychtoolbox" on the web.
>
> To unsubscribe from this group, send an email to:
> psychtoolbox-unsubscribe@yahoogroups.com
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
>