psychWithJava
Class Extras

java.lang.Object
  extended by psychWithJava.Extras

public class Extras
extends java.lang.Object

Contains methods for some common tasks and purposes

Since:
2012-03-14
Author:
boyaci

Constructor Summary
Extras()
           
 
Method Summary
static void beep(int hz, int msecs)
          Generates a tone
static java.awt.image.BufferedImage gabor(int mean, double cpp, double contrast, double phase, int sigma, double orientation)
          Generates a Gabor patch
static java.io.PrintWriter setOutputFile(java.lang.String prefix)
          Opens an output file with the specified prefix followed by the date.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Extras

public Extras()
Method Detail

gabor

public static java.awt.image.BufferedImage gabor(int mean,
                                                 double cpp,
                                                 double contrast,
                                                 double phase,
                                                 int sigma,
                                                 double orientation)
                                          throws PixelOutOfRangeException
Generates a Gabor patch

Parameters:
mean - Mean luminance (pixel value 0-255)
cpp - Frequency, cycles per pixel
contrast - Half the amplitude of the sinusoidal (Michelson Contrast)
phase - Phase shift of the sinusoidal
sigma - Sigma of the Gaussian envelope, affects the diameter of the Gabor
orientation - Angle of rotation, 0 is vertical
Returns:
Gabor patch in a BufferedImage
Throws:
java.lang.Exception
PixelOutOfRangeException

setOutputFile

public static java.io.PrintWriter setOutputFile(java.lang.String prefix)
                                         throws java.io.FileNotFoundException
Opens an output file with the specified prefix followed by the date. If one or more files exist with the same date, it generates the new file with a version suffix.

Parameters:
prefix - For example subject id
Returns:
Throws:
java.io.FileNotFoundException

beep

public static void beep(int hz,
                        int msecs)
                 throws javax.sound.sampled.LineUnavailableException
Generates a tone

Parameters:
hz - Affects the pitch of the tone
msecs - Duration of the tone
Throws:
javax.sound.sampled.LineUnavailableException