Presenting stimuli of absolute sizes (e.g. in cm)


Author
Message
katbo
katbo
Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)Expert (1.1K reputation)
Group: Moderators
Posts: 7, Visits: 68
Sometimes it is necessary to make sure all presented stimuli are of the same absolute size (e.g. a square with width/height of 4cm) on different monitors. In order to accomplish this, a calibration procedure is needed to calculate the pixel to (e.g.) mm  ratio on the monitor a script runs on.

Attached to this message is such a calibration script (Inquisit 4). The zip-file includes one script "AbsoluteSizing.iqx" with the actual calibration procedure and an example script "SizingDemo.iqx" to demonstrate how to use the calibration script to produce a square of a particular size (e.g. 5cm).

Here is an overview of how the calibration procedure works (the same information is also included in the scripts themselves):

(1) <include> script "AbsoluteSizing.iqx"
The code of the calibration script "AbsoluteSizing.iqx" can be be included into any other script (e.g. SizingDemo.iqx) using:
<include>
/file = "AbsoluteSizing.iqx"
</include>


All the elements of "AbsoluteSizing.iqx" are then accessible to the script (e.g. SizingDemo.iqx) and do not have to be re-written.

(2) Calibration Procedure: Underlying idea
The general idea of the calibration procedure itself is to adjust a given line on the monitor screen to be as long as the short side of a US letter-sized piece of paper (8 1/2 inches or ~21.6cm ).  The calibration instructions on the screen read as follows:

<item instructions>
/1 = "Take an 8 1/2 x 11 inch paper (US Letter Size) and
adjust the line on your screen to be 8 1/2 inches (~21.6cm) long.

To increase the line: press '>' on your keyboard
To decrease the line: press '<' on your keyboard

When you are done, press <ENTER>."

</item>


(3) Calculation of 'pixel per mm' ratio
This calibration procedure results in calculating the ratio of pixels per mm on the current monitor:

<expressions>
/ratio_pxpermm = values.linelength_px/215.9
</expressions>

Values.linelength_px is the final length of the comparison line in pixels when it measured 8 1/2 inches or 215.9mm.

NOTE: If the pixel to inches ratio should be calculated instead, the expression would need to be edited to: /ratio_pxperinch = values.linelength_px/8.5

(4) Definition of stimuli of absolute sizes
To present a stimulus of a certain size, the stimulus sizes need to be explicitly coded in pixels.

Take, for example, the square of "SizingDemo.iqx".
Under Editable values, the size of the square is defined as:
<values>
/squaresize = 50
</values>


with values.squaresize setting the desired size of the square to 50mm (5cm). Because the calibration script calculates the pixel/mm ratio it is necessary to set the absolute sizes in mm (and not inches or cm or anything else). If the calibration script calculates the pixel/inch ratio instead, the absolute sizes need to be coded in inches.

The square itself is coded as follows. Note the width and height definitions: they are written explicitly in pixel units (px). The product of (values.squaresize x expressions.ratio_pxpermm) calculates the pixel length that a square of 50mm requires on the current monitor.

<shape square>
/shape = rectangle
/width = 1px * values.squaresize * expressions.ratio_pxpermm
/height = 1px * values.squaresize * expressions.ratio_pxpermm
/color = blue
/position = (50%, 50%)
</shape>


And that's it. More information is included into the demo scripts. If you have any further questions, please, let us know.

cheers,
katja from Millisecond Software
Attachments
AbsoluteSizing.zip (1.3K views, 3.00 KB)
Edited 10 Years Ago by katbo
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View

Reading This Topic

Explore
Messages
Mentions
Search