################################################################### ## Stimulus Creation Software. ## ################################################################### Example of Parameters file : ####################################### Size_Image_X 512 Size_Image_Y 512 Rect_X_First_coord 128 Rect_Y_First_coord 128 Rect_X_Second_coord 384 Rect_Y_Second_coord 384 Rect_RGB_Value 0.7 0.57 15.0 Line_Thickness 5 Grid_RGB_Value 0.6 3.0 15.0 ########################################### Size_Image_X 512 Size_Image_Y 512 Nb_Of_Rings 6 Center_X 256 Center_Y 256 MAX_Radius 220 Ring_Thickness 20 Ring_RGB_Value 0.7 0.57 15.0 0.6 3.0 15.0 0.7 0.57 15.0 0.6 3.0 15.0 0.7 0.57 15.0 0.6 3.0 15.0 ####################################### Size_Image_X 512 Size_Image_Y 512 Nb_Of_Stripes 6 Width_of_stripes 20 Stripes_RGB_Value 0.7 0.57 15.0 0.6 3.0 15.0 0.7 0.57 15.0 0.6 3.0 15.0 0.7 0.57 15.0 0.6 3.0 15.0 ############################################################################################ -- DESCRIPTION : -- _____________________ The purpose of this software is to provide the Red, Green and Blue components of a Stimulus. A (yet) very short library is able to create rectangles, (and in the same way, squares, lines, or grids) and circles. The main file is tuned to propose 3 kind of stimulus : A colored rectangle covered with a grid, concentric circles of different chromaticities, or vertical stripes of alternating chromaticities. The functions for rectangles shapes and circles shapes are given below: Rect = Rectangle(1, Rect, ImageSizeX, ImageSizeY, RectOrigX, RectOrigY, RectOrigX, RectEndY, RedValue, GreenValue, BlueValue, index); 1st arg : 1 to overwrite a file, 0 else. 2nd arg : File to overwrite, put any pointer on double if 0 previsouly given. 3rd arg : Horizontal size of the backgroung image. 4th arg : Vertical size of the backgroung image. 5th arg : Horizontal coordinate of the upper left corner of the rectangle. 6th arg : Vertical coordinate of the upper left corner of the rectangle. 7th arg : Horizontal coordinate of the lower right corner of the rectangle. 8th arg : Vertical coordinate of the lower rigth corner of the rectangle. 9th arg : Red value of the rectangle (can be either real value or percentage). 10th arg : Green value of the rectangle (can be either real value or percentage). 11th arg : Blue value of the rectangle (can be either real value or percentage). 12th arg : equals 0 to deal with the Red component, 1 for the Green, and 2 for the Blue. Circ = Circle(1, Circ, ImageSizeX, ImageSizeY, CircleCenterX, CircleCenterY, MaxRadius, RedValue, GreenValue, BlueValue, index); 1st to 4th args : See above. 5th arg : Horizontal coordinate. 6th arg : Vertical coordinate. 7th arg : Circle radius. 8th to 11th args : See above. WARNING : The (0,0) coordinate is located in the upper left corner of the image. All the length must be given in pixels. _______________________________________________________________________________________ -- SYNTAX : -- ________________ To launch the program, type: > ./CreateStimulus < 1 OR 2 OR 3> > ./CreateStimulus <-h> OR OR <-help> OR <--help> : Displays this help. The software reads some optional configuration parameters in the file 'ParametersFileName.cfg'. These parameters are written above. The first argument corresponds to the name which will be given to the R, G and B output images. This argument must be given without any extension. The second argument corresponds to the parameters file to read, There are several given files. The third argument corresponds to the build in stimulus functions. The first stimulus corresponds to a square with a grid, the second stimulus is a shape made of concentric circles alternating chromaticity, and the third option draws a set of vertical stripes (alternating chromaticity). -- OUTPUTS : -- ________________ The output images will be named according to the second given argument. The output corresponds to 3 image, given in RGB values. To perform the retinal images computation, These images will need to be converted in percentage of the maximum of each CRT gun. For an first argument named 'Rectangle', the software creates 3 RGB Bitmaps named : - RectangleR.tim - RectangleG.tim - RectangleB.tim Stored as (unsigned char) 8 bpp images without header. And 3 other Bitmap Stored as 32 bpp images without header, named : - DRectangleR.tim - DRectangleG.tim - DRectangleB.tim This format allow the storage of double values (useful to store percentage of R, G and B guns). But these files have an important drawback : ImageJ (quickly presented below) is not able (at this time) to merge the R, G & B (double) components into a single image. But it can merge the unsigned char output values. This program reads in the parameters files the geometric configuration of the expected stimulus, shapes, image size, shapes sizes,... It also reads the colors (which must be given in 'lsY' chromaticity) for each shape !!!!!!!!!!!!!! !! WARNING !! !!!!!!!!!!!!!! This program converts the 'lsY' values into percentage of Red, Green and Blue guns. To do this, it needs to load the Judd Specs (3x4 matrix in the file 'JuddSpecs_114.txt'). This matrix depends on the used CRT monitor. If you use this software with the Retinal Image computation software, you will need to load the Spectral Power Distribution corresponding to this Judd Specs Matrix ! The three output images : - DRectangleR.tim - DRectangleG.tim - DRectangleB.tim represents the percentage of each RGB gun for each pixel. -- SPLITTING OR MERGING RGB COMPONENTS AND DISPLAYS : -- __________________________________________________________ I just give here some links to free softwares able to deal with the input or output data of my code... These softwares run on Windows, Mac, Unix or Linux Operating Systems. The output Bitmaps are 'Text Images', that means they are simple Matrices without any kind of header. - The free ImageJ software can read and write such images: http://rsb.info.nih.gov/ij/ 'ImageJ' can import and save Text Images, it can also split or merge RGB Images. To read the 8bits shapes, open ImageJ and read images as raw images : "File" -> "Import" -> "Raw" Image Type : 8-bit Width : 512 Height : 512 Offset : 0 Nb of images : 1 Gap : 0 Reading 8 bpp images will allow you to merge R,G,B component into a single RGB image. (which is impossible when you open text images with ImageJ v1.32) To read the double format images, open ImageJ and read images as text images : "File" -> "Import" -> "Text Image" Note : ImageJ can also plot 3D images, by clicking on "Analyse" -> "Surface Plot". - The GNU Image Manipulation Program (Gimp : www.gimp.org) can split a RGB bitmap into 3 layers: Menu: Filters->Colors->Decompose Select "RGB" and "Decompose into layers" To merge the layers : Filters->Colors->Compose There must be a way to read a simple text image (Matrix without any header) under the Gimp, but I still didn't found out how... - Some commercial softwares (e.g. Adobe Photoshop) must be able to read/write such images, but I didn't tried yet. Matlab can read and save text images, it can also plot the 3D shapes: >> load /MyImage_PSF_R.tim; >> figure, surf(MyImage_PSF_R.tim); or >> figure, imagesc(MyImage_PSF_R.tim); If you don't have Matlab installed, you should try with octave (www.octave.org), which is a very powerful (and free) software. The syntax is globally the same as Matlab's. Note: you will need to install gnuplot (www.gnuplot.info). -- COMPILATION : -- _____________________ This program has been build and compiled with 'Project Builder', (Xcode) v 2.0.1, under Mac OS X.2.8. To compile the code without Xcode, type in the build directory : > gcc -o CreateStimulus ../main.cpp -lstdc++ -- APPLICATIONS : -- ______________________ This program is mainly intended to be use to create stimulus files as BitMaps. Its goal is to be able to run the retinal image computation, without having to use any software to split RGB images. It also allows to give RGB guns values or ever RGB guns percentages. -------------------------------------------------------------------- For any question or help regarding this software, please contact me: Florent Autrusseau, Visual Science Lab. University of Chicago, 940 E, 57th Street, 60637, Chicago, IL, USA. florent@uchicago.edu http://home.uchicago.edu/~florent/ ############################################################################################