Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

ppm_draw.c File Reference

Routines for making plots and saving them as ppm images. More...

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <math.h>
#include <vector>
#include "ipc.h"
#include "cmdparam.h"
#include "inputs.h"
#include "analyze.h"
#include "globals.h"
#include "lissom.h"
#include "ppm_draw.h"

Include dependency graph for ppm_draw.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct  XColor

Defines

#define HIGHEST_COLOR_LEVEL   255
 Highest possible integer value each color component (R,G,or B) can assume. More...

#define BadPixel   ((char)(1<<5))
 Possible values for the flags. More...

#define NOHUE   -1.0
 Value to indicate that an HSV value has no color; entails S=0. More...

#define PPM_RYW   0
#define PPM_GRAYSCALE   1
#define PPM_ORIENTATION   2
#define PPM_OCULARDOMINANCE   3
#define PPM_SINGLEHUE   4
#define PPM_NONE   5
#define PPM_SELECTIVITY   6
#define PPM_MAX_SUBPLOT   6
#define PPM_WTSCALE_FIXED   0
#define PPM_WTSCALE_INHIB   1
#define PPM_WTSCALE_COUNT   2
#define PPM_WTSCALE_ACTIVE   3
#define PPM_WTSCALE_PEAKRELATIVE   4
#define PPM_WTSCALE_RELATIVE   5
#define PPM_MAX_WTSCALE   5
#define CROP(lower,upper,x)    (MAX((lower),MIN((upper),(x))));

Typedefs

typedef unsigned char RGB_value
 Type for R, G, or B value of a pixel color. More...

typedef int (* ppm_inside_test_ptr )( int i, int j, int int1, int int2, double float1, double float2, void *otherparams )
 Function pointer type for routines which return the answer to a question "is this point inside?". More...


Functions

void BhamXDrawLine_PointsAlongX (int xA, int yA, int xB, int yB, int direction, XColor color, int thickness)
 Two versions of XDrawLine using Bresenham's line drawing algorithm. More...

void BhamXDrawLine_PointsAlongY (int xA, int yA, int xB, int yB, int direction, XColor color, int thickness)
int canExtendWidthTo (int width)
 Ensure that bitmap boundaries are respected. More...

void compute_weight_scale ( int ui, int uj, int max_coord, int circular_wts, int radius, int ar_width, void* weights, int weights_are_lat, double* factor, double* offset )
 Figure out the appropriate weight scale for the given unit. More...

void create_colormap_RGB ( XColor colormap[HIGHEST_COLOR_LEVEL+1], int numcolors )
 Allocates colors in the RGB colormap for the display passed as a parameter. More...

int draw_box_outline ( XColor color, int xl, int xh, int yl, int yh, int width )
 Draws a box in the background color at the specified location in the image. More...

int draw_box_outline_on_cortex ( double centeri, double centerj, double radius, int left_offset)
 When called immediately after drawing a cortex plot in the image buffer, draws a sqare of the given radius around the indicated unit. More...

int draw_box_outline_on_retina ( double centeri, double centerj, double radius, int left_offset)
 When called immediately after drawing a retina plot in the image buffer, draws a sqare of the given radius around the indicated unit. More...

void draw_histogram_bin ( double value, int j, int reset_values, int draw_zero, int left_offset)
void draw_horizontal_line ( XColor color, int l_i, int h_i, int j )
int draw_outline_on_cortex ( int ui, int uj, int radius, int left_offset, ppm_inside_test_ptr testfn)
 When called immediately after drawing a retina plot in the image buffer, draws an outline of the given function in the radius around the indicated unit. More...

int draw_outline_on_retina ( int ui, int uj, int radius, int left_offset, ppm_inside_test_ptr testfn)
 When called immediately after drawing a retina plot in the image buffer, draws an outline of the given function in the radius around the indicated unit. More...

void draw_rectangle ( XColor color, int upper_left_x, int upper_left_y, int x_pixels, int y_pixels )
void draw_retina_unit ( XColor color, int x, int y, int reset_values, int left_offset)
void draw_cortex_unit ( XColor color, int i, int j, int reset_values, int left_offset)
void draw_vertical_line ( XColor color, int i, int l_j, int h_j )
void hsv2rgb ( double h, double s, double v, XColor *color )
 Convert a color specified in HSV to RGB. More...

int inhWeightAbove ( int i, int j, int ui, int uj, double radius, double threshold, void *dummyv )
 Returns true if unit (ui,uj) has a lateral inhibitory weight from (i,j) above the given threshold. More...

int isAlwaysInside ( int i, int j, int int1, int int2, double float1, double float2, void *dummyv )
 Always returns true. More...

int isInsideCircle ( int i, int j, int centeri, int centerj, double radius, double dummyf, void *dummyv )
 Returns true if unit (i,j) is within the specified radius of the unit (centeri, centerj). More...

void ppm_clear_image (int bg_R, int bg_G, int bg_B)
void ppm_draw_line (int x_1, int y_1, int x_2, int y_2, XColor color, int thickness)
 Simple version of XDrawLine using Bresenham's line drawing algorithm. More...

void ppm_draw_line_at_angle (int cx, int cy, double angle, double length, double width, XColor color)
 Same as ppm_draw_line but takes a center point, an angle (in radians), and a length rather than two endpoints. More...

int ppm_draw_od_pref (double od_pref_array[NMAX][NMAX], int left_offset)
int ppm_draw_or_pref_line (int or_preferences[NMAX][NMAX], double or_selectivities[NMAX][NMAX], int left_offset)
 Draws orientation preferences as a line drawing. More...

void ppm_draw_pixel (int xi, int yi, XColor color)
 Draw a pixel, unless full or outside the border. More...

XColor ppm_get_drawing_color (int lowi, int highi, int lowj, int highj, XColor set_color)
 If a color was specified explicitly, returns it, otherwise computes whether white or black is more visible, on average, at the centers of the edges of the bounding box given. More...

int ppm_init_cortex_plot (int left_offset)
 Ensure that bitmap boundaries are respected. More...

int ppm_init_retina_plot (int left_offset)
 Ensure that bitmap boundaries are respected. More...

int ppm_init_histogram_plot (int symmetric, int left_offset)
 Ensure that bitmap boundaries are respected. More...

XColor ppm_lookup_color ( int i, int j, double scaled_value, int subplot, int paper_based=Uninitialized)
 Determine color for pixel based on magnitude and location. More...

int ppm_scaled_cortex_height_offset (void)
int ppm_scaled_cortex_plot_height ( void )
int ppm_scaled_cortex_plot_width ( void )
int ppm_scaled_cortex_unit_pixels ( void )
int ppm_scaled_histogram_bin_pixels ( int num_bins )
int ppm_scaled_histogram_height_offset (int num_bins )
int ppm_scaled_histogram_plot_height (int num_bins )
int ppm_scaled_histogram_plot_width ( int num_bins, double scale )
int ppm_scaled_retina_height_offset (void)
int ppm_scaled_retina_plot_height ( void )
int ppm_scaled_retina_plot_width ( void )
int ppm_scaled_retina_unit_pixels ( void )
void ppm_write_header ( FILE *file, const char *comments, int width, int height, int max_val )
 Print ppm header to file. More...

void rgb2hsv (XColor c, double *h, double *s, double *v )
int ppm_write_pixel ( FILE *file, XColor pixel, int max_val )
template<classT> int ppm_write_image_to_file ( T imagedata, const char* filename, const char *comments, int width, int height, int max_val )
 Write the given matrix to a ppm file; accepts both vector and array images. More...

int draw_outline (XColor color, int lowi, int highi, int lowj, int highj, int starti, int startj, int left_offset, int height_offset, int npixels_perunit, int outline_width, ppm_inside_test_ptr testfn, int int1, int int2, double float1, double float2, void *otherparams )
void ppm_init_hook ( void )
void ppm_bitmap_initialize (void)
 Call this routine before drawing anything into the bitmap, each time you start a new plot. More...

int ppm_presentation_height (void)
 Returns maximum height of combined plot of retina and cortex (typical). More...

LOff ppm_draw_activity (double activity[NMAX][NMAX], int left_offset)
LOff ppm_draw_or_pref (int or_preferences[NMAX][NMAX], double or_selectivities[NMAX][NMAX], bool selectivity_only, int left_offset)
LOff ppm_draw_lateral_weights (int ui, int uj, l_weight *weights, int radius, int ar_width, int left_offset, int isInhWts, int mark_neuron)
LOff ppm_draw_retina (int eye, double input_v[RNMAX*RNMAX], int left_offset)
 Draw the current activity on the retina. More...

LOff ppm_draw_afferent_weights (int center_x, int center_y, a_weight weights[WTMAX][WTMAX], int ui, int uj, int left_offset)
LOff ppm_draw_angle_histogram ( OrientationHistogram histo, int symmetric, int left_offset)
 Draw a histogram of activation values for each angle. More...

LOff ppm_draw_angle_histogram_difference ( OrientationHistogram poshisto, OrientationHistogram neghisto, int left_offset)
LOff ppm_draw_or_color_key (int num_examples, int key_length, int vertical, int left_offset)
LOff ppm_draw_presentation (double input_v[RNMAX*RNMAX*MAX_NUM_EYES], double init[NMAX][NMAX], double settled[NMAX][NMAX])
 Draws combined image of input and activity. More...

LOff ppm_draw_orientations (int or_preferences[EYE_ARRAY_SIZE][NMAX][NMAX], double or_selectivities[EYE_ARRAY_SIZE][NMAX][NMAX], bool selectivity_only)
 Draws or_prefs with a border and histogram. More...

LOff ppm_draw_ocular_dominance (double od_pref_array[NMAX][NMAX])
 Draws od_prefs with a border. More...

LOff ppm_draw_weights (int ui, int uj )
 Draws all weights for a single neuron. More...

void ppm_draw_afferent_weight_map (const char* filename, int eye, int baseline_eye)
 Draws afferent weights from all (or a subset of) the neurons in the given eye. More...

int ppm_write_to_file ( const char* filename, const char *comments, int width, int height, int max_val )
 Writes bitmap in memory to a ppm file; assumes data is in global variable "image". More...


Variables

double ppm_master_scale = 1.0
double ppm_retina_scale = Uninitialized
double ppm_cortex_scale = Uninitialized
int ppm_border = MAX(2,(int)(NMAX*0.03))
double ppm_bg_R = Uninitialized
double ppm_bg_G = Uninitialized
double ppm_bg_B = Uninitialized
double ppm_luminance_multiplier = 1
double ppm_lateral_multiplier = 700
double ppm_afferent_multiplier = 100
double ppm_selectivity_multiplier = 1
double ppm_line_selectivity_multiplier = 50
double ppm_activity_luminance_offset = 0
int ppm_weight_scale_type = PPM_WTSCALE_PEAKRELATIVE
int ppm_weight_scale_init_count = True
int ppm_weight_scale_max_count = True
int ppm_neuron_skip_aff = 1
int ppm_paper_based_colors = False
int ppm_paper_based_retina = Uninitialized
int ppm_outline_weights = True
int ppm_outline_retina = True
int ppm_always_mark_neuron = False
int ppm_retina_edge_buffer_suppress = False
int ppm_activity_subplot = PPM_RYW
int ppm_retina_subplot = PPM_RYW
int ppm_lateral_subplot = PPM_RYW
int ppm_afferent_subplot = PPM_RYW
int ppm_orientation_subplot = PPM_NONE
int ppm_ocular_dominance_subplot = PPM_RYW
int ppm_line_orientation_subplot = PPM_SELECTIVITY
double ppm_subplot_hue = NOHUE
int ppm_line_plots = False
int ppm_shaded_plots = True
int ppm_always_draw_point = True
int ppm_neuron_skip_line = 1
int ppm_neuron_ioffset_line = 0
int ppm_neuron_joffset_line = 0
int ppm_interior_border = 1
int ppm_interior_outline = False
double ppm_line_R = Uninitialized
double ppm_line_G = Uninitialized
double ppm_line_B = Uninitialized
int ppm_start_i = Uninitialized
int ppm_start_j = Uninitialized
int ppm_end_i = Uninitialized
int ppm_end_j = Uninitialized
int ppm_start_x = Uninitialized
int ppm_start_y = Uninitialized
int ppm_end_x = Uninitialized
int ppm_end_y = Uninitialized
int ppm_ui = Uninitialized
int ppm_uj = Uninitialized
double ppm_weight_threshold = DEATH_FLAG
int ppm_outline_width = 1
double ppm_reference_angle = 0
double ppm_value_range = 0.6
double ppm_value_offset = 0.1
int ppm_minimal_outline = False
double ppm_histo_percentage_range = 25
double ppm_histo_scale_factor = 0.25
int ppm_histograms = True
char ppm_image_viewer [MAXFILENAMELENGTH] = "xv -expand 4 -raw"
char ppm_remote_viewer [MAXFILENAMELENGTH] = "anytoascii"
int& ppm_spawn_viewer = spawn_viewer
int ppm_spawn_independent_viewers = True
int ppm_color_keys = Uninitialized
int ppm_color_key_num = 13
int ppm_combine_alternate_eyes = False
XColor colors [HIGHEST_COLOR_LEVEL+1]
XColor image [IMG_SIZE_X][IMG_SIZE_Y]
 Maximum size ppm image. More...

XColor ppm_background_color
XColor ppm_foreground_color
int ncolors = 252
int ppm_height = 0
const XColor Black = {0,0,0,0}
const XColor White = {HIGHEST_COLOR_LEVEL,HIGHEST_COLOR_LEVEL,HIGHEST_COLOR_LEVEL,0}
const XColor Blue = {0,0,HIGHEST_COLOR_LEVEL,0}


Detailed Description

Routines for making plots and saving them as ppm images.

Header:
/u/nn/cvsroot/lissom/src/ppm_draw.c,v 1.87 2000/08/15 19:51:21 jbednar Exp

Definition in file ppm_draw.c.


Define Documentation

#define BadPixel   ((char)(1<<5))
 

Possible values for the flags.

Definition at line 45 of file ppm_draw.c.

#define CROP( lower, upper, x )   (MAX((lower),MIN((upper),(x))));
 

Definition at line 106 of file ppm_draw.c.

#define HIGHEST_COLOR_LEVEL   255
 

Highest possible integer value each color component (R,G,or B) can assume.

Definition at line 42 of file ppm_draw.c.

#define NOHUE   -1.0
 

Value to indicate that an HSV value has no color; entails S=0.

Definition at line 57 of file ppm_draw.c.

#define PPM_GRAYSCALE   1
 

Definition at line 67 of file ppm_draw.c.

#define PPM_MAX_SUBPLOT   6
 

Definition at line 73 of file ppm_draw.c.

#define PPM_MAX_WTSCALE   5
 

Definition at line 83 of file ppm_draw.c.

#define PPM_NONE   5
 

Definition at line 71 of file ppm_draw.c.

#define PPM_OCULARDOMINANCE   3
 

Definition at line 69 of file ppm_draw.c.

#define PPM_ORIENTATION   2
 

Definition at line 68 of file ppm_draw.c.

#define PPM_RYW   0
 

Definition at line 66 of file ppm_draw.c.

#define PPM_SELECTIVITY   6
 

Definition at line 72 of file ppm_draw.c.

#define PPM_SINGLEHUE   4
 

Definition at line 70 of file ppm_draw.c.

#define PPM_WTSCALE_ACTIVE   3
 

Definition at line 80 of file ppm_draw.c.

#define PPM_WTSCALE_COUNT   2
 

Definition at line 79 of file ppm_draw.c.

#define PPM_WTSCALE_FIXED   0
 

Definition at line 77 of file ppm_draw.c.

#define PPM_WTSCALE_INHIB   1
 

Definition at line 78 of file ppm_draw.c.

#define PPM_WTSCALE_PEAKRELATIVE   4
 

Definition at line 81 of file ppm_draw.c.

#define PPM_WTSCALE_RELATIVE   5
 

Definition at line 82 of file ppm_draw.c.


Typedef Documentation

typedef unsigned char RGB_value
 

Type for R, G, or B value of a pixel color.

Definition at line 39 of file ppm_draw.c.

typedef int (* ppm_inside_test_ptr)( int i, int j, int int1, int int2, double float1, double float2, void *otherparams )
 

Function pointer type for routines which return the answer to a question "is this point inside?".

E.g., for a circle, such a function would return whether the given point (i,j) is within the circle defined by the parameters.

Each function may declare the "otherParams" to be of another pointer type as appropriate.

Definition at line 96 of file ppm_draw.c.


Function Documentation

void BhamXDrawLine_PointsAlongX ( int xA,
int yA,
int xB,
int yB,
int direction,
XColor color,
int thickness )
 

Two versions of XDrawLine using Bresenham's line drawing algorithm.

They differ in the axis (X or Y) they increment over, to avoid drawing lines with gaps between pixels.

The "thickness" argument is just a hack; it draws sheared rectangles instead of rotated ones, but that's better than nothing and much simpler than doing scan line conversion.

Definition at line 2510 of file ppm_draw.c.

Referenced by ppm_draw_line().

void BhamXDrawLine_PointsAlongY ( int xA,
int yA,
int xB,
int yB,
int direction,
XColor color,
int thickness )
 

Definition at line 2537 of file ppm_draw.c.

int canExtendWidthTo ( int width )
 

Ensure that bitmap boundaries are respected.

Definition at line 2055 of file ppm_draw.c.

Referenced by ppm_draw_or_pref_line(), ppm_init_cortex_plot(), ppm_init_histogram_plot(), and ppm_init_retina_plot().

void compute_weight_scale ( int ui,
int uj,
int max_coord,
int circular_wts,
int radius,
int ar_width,
void * weights,
int weights_are_lat,
double * factor,
double * offset )
 

Figure out the appropriate weight scale for the given unit.

Definition at line 1594 of file ppm_draw.c.

Referenced by ppm_draw_afferent_weight_map().

void create_colormap_RGB ( XColor colormap[HIGHEST_COLOR_LEVEL+1],
int numcolors )
 

Allocates colors in the RGB colormap for the display passed as a parameter.

numcolors is the number of colors.

Definition at line 1755 of file ppm_draw.c.

Referenced by ppm_bitmap_initialize().

int draw_box_outline ( XColor color,
int xl,
int xh,
int yl,
int yh,
int width )
 

Draws a box in the background color at the specified location in the image.

Definition at line 2151 of file ppm_draw.c.

Referenced by draw_box_outline_on_cortex(), and draw_box_outline_on_retina().

int draw_box_outline_on_cortex ( double centeri,
double centerj,
double radius,
int left_offset )
 

When called immediately after drawing a cortex plot in the image buffer, draws a sqare of the given radius around the indicated unit.

When called at any other time, behavior is unspecified.

Definition at line 2203 of file ppm_draw.c.

Referenced by ppm_draw_ocular_dominance(), and ppm_draw_orientations().

int draw_box_outline_on_retina ( double centeri,
double centerj,
double radius,
int left_offset )
 

When called immediately after drawing a retina plot in the image buffer, draws a sqare of the given radius around the indicated unit.

When called at any other time, behavior is unspecified.

Definition at line 2172 of file ppm_draw.c.

Referenced by ppm_draw_retina().

void draw_cortex_unit ( XColor color,
int i,
int j,
int reset_values,
int left_offset )
 

Definition at line 2248 of file ppm_draw.c.

void draw_histogram_bin ( double value,
int j,
int reset_values,
int draw_zero,
int left_offset )
 

Definition at line 2267 of file ppm_draw.c.

void draw_horizontal_line ( XColor color,
int l_i,
int h_i,
int j )
 

Definition at line 2130 of file ppm_draw.c.

int draw_outline ( XColor color,
int lowi,
int highi,
int lowj,
int highj,
int starti,
int startj,
int left_offset,
int height_offset,
int npixels_perunit,
int outline_width,
ppm_inside_test_ptr testfn,
int int1,
int int2,
double float1,
double float2,
void * otherparams )
 

Definition at line 2425 of file ppm_draw.c.

int draw_outline_on_cortex ( int ui,
int uj,
int radius,
int left_offset,
ppm_inside_test_ptr testfn )
 

When called immediately after drawing a retina plot in the image buffer, draws an outline of the given function in the radius around the indicated unit.

Definition at line 2405 of file ppm_draw.c.

Referenced by ppm_draw_ocular_dominance(), and ppm_draw_orientations().

int draw_outline_on_retina ( int ui,
int uj,
int radius,
int left_offset,
ppm_inside_test_ptr testfn )
 

When called immediately after drawing a retina plot in the image buffer, draws an outline of the given function in the radius around the indicated unit.

Definition at line 2381 of file ppm_draw.c.

void draw_rectangle ( XColor color,
int upper_left_x,
int upper_left_y,
int x_pixels,
int y_pixels )
 

Definition at line 2117 of file ppm_draw.c.

void draw_retina_unit ( XColor color,
int x,
int y,
int reset_values,
int left_offset )
 

Definition at line 2229 of file ppm_draw.c.

void draw_vertical_line ( XColor color,
int i,
int l_j,
int h_j )
 

Definition at line 2138 of file ppm_draw.c.

void hsv2rgb ( double h,
double s,
double v,
XColor * c )
 

Convert a color specified in HSV to RGB.

HSV values are specified in the range [0,1]. From _Computer_Graphics_, 2nd Ed., Foley et al, 1990, except Hue modified to lie in [0,1] instead of [0,360]

Definition at line 1788 of file ppm_draw.c.

Referenced by ppm_draw_retina(), and ppm_lookup_color().

int inhWeightAbove ( int i,
int j,
int ui,
int uj,
double radius,
double threshold,
void * dummyv )
 

Returns true if unit (ui,uj) has a lateral inhibitory weight from (i,j) above the given threshold.

Can be used with draw_outline to create a contour plot by successively setting increasing thresholds.

Definition at line 2347 of file ppm_draw.c.

int isAlwaysInside ( int i,
int j,
int centeri,
int centerj,
double radius,
double dummyf,
void * dummyv )
 

Always returns true.

Definition at line 2365 of file ppm_draw.c.

int isInsideCircle ( int i,
int j,
int centeri,
int centerj,
double radius,
double dummyf,
void * dummyv )
 

Returns true if unit (i,j) is within the specified radius of the unit (centeri, centerj).

Intended to match the criterion for weight death in init_weights() in kernel.c.

Definition at line 2331 of file ppm_draw.c.

void ppm_bitmap_initialize ( void )
 

Call this routine before drawing anything into the bitmap, each time you start a new plot.

Definition at line 759 of file ppm_draw.c.

Referenced by save_presentation_image().

void ppm_clear_image ( int bg_R,
int bg_G,
int bg_B )
 

Definition at line 1737 of file ppm_draw.c.

LOff ppm_draw_activity ( double activity[NMAX][NMAX],
int left_offset )
 

Definition at line 863 of file ppm_draw.c.

void ppm_draw_afferent_weight_map ( const char * filename,
int eye,
int baseline_eye = Uninitialized )
 

Draws afferent weights from all (or a subset of) the neurons in the given eye.

This one is separate from all other PPM plots and was written later than most (using C++); it uses its own image buffer since the image is typically much different in size from the regular plots.

Definition at line 1533 of file ppm_draw.c.

LOff ppm_draw_afferent_weights ( int center_x,
int center_y,
a_weight weights[WTMAX][WTMAX],
int ui,
int uj,
int left_offset )
 

Definition at line 1175 of file ppm_draw.c.

LOff ppm_draw_angle_histogram ( OrientationHistogram histo,
int symmetric,
int left_offset )
 

Draw a histogram of activation values for each angle.

If symmetric is true, assumes both positive and negative values are allowed, each at half-scale.

Definition at line 1244 of file ppm_draw.c.

LOff ppm_draw_angle_histogram_difference ( OrientationHistogram poshisto,
OrientationHistogram neghisto,
int left_offset )
 

Definition at line 1273 of file ppm_draw.c.

LOff ppm_draw_lateral_weights ( int ui,
int uj,
l_weight * weights,
int radius,
int ar_width,
int left_offset,
int isInhWts,
int mark_neuron )
 

Definition at line 1060 of file ppm_draw.c.

void ppm_draw_line ( int x_1,
int y_1,
int x_2,
int y_2,
XColor color,
int thickness )
 

Simple version of XDrawLine using Bresenham's line drawing algorithm.

Definition at line 2568 of file ppm_draw.c.

Referenced by ppm_draw_line_at_angle().

void ppm_draw_line_at_angle ( int cx,
int cy,
double angle,
double length,
double width,
XColor color )
 

Same as ppm_draw_line but takes a center point, an angle (in radians), and a length rather than two endpoints.

Definition at line 2598 of file ppm_draw.c.

Referenced by ppm_draw_or_pref_line().

LOff ppm_draw_ocular_dominance ( double od_pref_array[NMAX][NMAX] )
 

Draws od_prefs with a border.

Definition at line 1438 of file ppm_draw.c.

LOff ppm_draw_od_pref ( double od_pref_array[NMAX][NMAX],
int left_offset )
 

Definition at line 892 of file ppm_draw.c.

LOff ppm_draw_or_color_key ( int num_examples,
int key_length,
int vertical,
int left_offset )
 

Definition at line 1292 of file ppm_draw.c.

LOff ppm_draw_or_pref ( int or_preferences[NMAX][NMAX],
double or_selectivities[NMAX][NMAX],
bool selectivity_only,
int left_offset )
 

Definition at line 908 of file ppm_draw.c.

LOff ppm_draw_or_pref_line ( int or_preferences[NMAX][NMAX],
double or_selectivities[NMAX][NMAX],
int left_offset )
 

Draws orientation preferences as a line drawing.

Definition at line 996 of file ppm_draw.c.

Referenced by ppm_draw_orientations().

LOff ppm_draw_orientations ( int or_preferences[EYE_ARRAY_SIZE][NMAX][NMAX],
double or_selectivities[EYE_ARRAY_SIZE][NMAX][NMAX],
bool selectivity_only = false )
 

Draws or_prefs with a border and histogram.

Definition at line 1384 of file ppm_draw.c.

void ppm_draw_pixel ( int xi,
int yi,
XColor color )
 

Draw a pixel, unless full or outside the border.

Definition at line 2490 of file ppm_draw.c.

Referenced by BhamXDrawLine_PointsAlongX().

LOff ppm_draw_presentation ( double input_v[RNMAX *RNMAX *MAX_NUM_EYES],
double init[NMAX][NMAX],
double settled[NMAX][NMAX] )
 

Draws combined image of input and activity.

Draws left retina, initial activity, settled activity, and right eye(s) if different.

Definition at line 1335 of file ppm_draw.c.

LOff ppm_draw_retina ( int eye,
double input_v[RNMAX *RNMAX],
int left_offset )
 

Draw the current activity on the retina.

Assumes input vector starts at index zero, so e.g. the right eye will need to be passed as a vector that starts at RN*RN.

Definition at line 1126 of file ppm_draw.c.

LOff ppm_draw_weights ( int ui,
int uj )
 

Draws all weights for a single neuron.

Draws afferent weights to left eye, then inhibitory weights, excitatory weights, and afferent weights to rest of the eyes, if any.

Definition at line 1471 of file ppm_draw.c.

XColor ppm_get_drawing_color ( int lowi,
int highi,
int lowj,
int highj,
XColor set_color )
 

If a color was specified explicitly, returns it, otherwise computes whether white or black is more visible, on average, at the centers of the edges of the bounding box given.

Definition at line 1702 of file ppm_draw.c.

Referenced by draw_box_outline_on_cortex(), draw_box_outline_on_retina(), and ppm_draw_line_at_angle().

int ppm_init_cortex_plot ( int left_offset )
 

Ensure that bitmap boundaries are respected.

Definition at line 2083 of file ppm_draw.c.

int ppm_init_histogram_plot ( int symmetric,
int left_offset )
 

Ensure that bitmap boundaries are respected.

Definition at line 2098 of file ppm_draw.c.

Referenced by ppm_draw_angle_histogram().

void ppm_init_hook ( void )
 

Definition at line 294 of file ppm_draw.c.

int ppm_init_retina_plot ( int left_offset )
 

Ensure that bitmap boundaries are respected.

Definition at line 2068 of file ppm_draw.c.

Referenced by ppm_draw_retina().

XColor ppm_lookup_color ( int i,
int j,
double scaled_level,
int subplot,
int paper_based = Uninitialized )
 

Determine color for pixel based on magnitude and location.

Definition at line 1961 of file ppm_draw.c.

Referenced by ppm_draw_afferent_weight_map(), and ppm_draw_retina().

int ppm_presentation_height ( void )
 

Returns maximum height of combined plot of retina and cortex (typical).

Definition at line 817 of file ppm_draw.c.

Referenced by save_presentation_image().

int ppm_scaled_cortex_height_offset ( void )
 

Definition at line 1675 of file ppm_draw.c.

int ppm_scaled_cortex_plot_height ( void )
 

Definition at line 1673 of file ppm_draw.c.

int ppm_scaled_cortex_plot_width ( void )
 

Definition at line 1674 of file ppm_draw.c.

int ppm_scaled_cortex_unit_pixels ( void )
 

Definition at line 1672 of file ppm_draw.c.

int ppm_scaled_histogram_bin_pixels ( int num_bins )
 

Definition at line 1683 of file ppm_draw.c.

int ppm_scaled_histogram_height_offset ( int num_bins )
 

Definition at line 1692 of file ppm_draw.c.

int ppm_scaled_histogram_plot_height ( int num_bins )
 

Definition at line 1686 of file ppm_draw.c.

int ppm_scaled_histogram_plot_width ( int num_bins,
double scale )
 

Definition at line 1689 of file ppm_draw.c.

int ppm_scaled_retina_height_offset ( void )
 

Definition at line 1680 of file ppm_draw.c.

int ppm_scaled_retina_plot_height ( void )
 

Definition at line 1678 of file ppm_draw.c.

int ppm_scaled_retina_plot_width ( void )
 

Definition at line 1679 of file ppm_draw.c.

int ppm_scaled_retina_unit_pixels ( void )
 

Definition at line 1677 of file ppm_draw.c.

void ppm_write_header ( FILE * file,
const char * comments,
int width,
int height,
int max_val )
 

Print ppm header to file.

If 'comments' contains newlines, they should be followed immediately by a '#'.

Definition at line 1888 of file ppm_draw.c.

Referenced by ppm_write_image_to_file().

template<classT>
int ppm_write_image_to_file ( T imagedata,
const char * filename,
const char * comments,
int width,
int height,
int max_val )
 

Write the given matrix to a ppm file; accepts both vector and array images.

Definition at line 1923 of file ppm_draw.c.

Referenced by ppm_draw_afferent_weight_map(), and ppm_write_to_file().

int ppm_write_pixel ( FILE * file,
XColor pixel,
int max_val )
 

Definition at line 1898 of file ppm_draw.c.

int ppm_write_to_file ( const char * filename,
const char * comments,
int width,
int height,
int max_val )
 

Writes bitmap in memory to a ppm file; assumes data is in global variable "image".

Definition at line 1916 of file ppm_draw.c.

void rgb2hsv ( XColor c,
double * h,
double * s,
double * v )
 

Definition at line 1842 of file ppm_draw.c.


Variable Documentation

const XColor Black = {0,0,0,0}
 

Definition at line 219 of file ppm_draw.c.

const XColor Blue = {0,0,HIGHEST_COLOR_LEVEL,0}
 

Definition at line 221 of file ppm_draw.c.

const XColor White = {HIGHEST_COLOR_LEVEL,HIGHEST_COLOR_LEVEL,HIGHEST_COLOR_LEVEL,0}
 

Definition at line 220 of file ppm_draw.c.

XColor colors[HIGHEST_COLOR_LEVEL+1]
 

Definition at line 209 of file ppm_draw.c.

XColor image[IMG_SIZE_X][IMG_SIZE_Y]
 

Maximum size ppm image.

Definition at line 210 of file ppm_draw.c.

int ncolors = 252
 

Definition at line 215 of file ppm_draw.c.

double ppm_activity_luminance_offset = 0
 

Definition at line 131 of file ppm_draw.c.

int ppm_activity_subplot = PPM_RYW
 

Definition at line 146 of file ppm_draw.c.

double ppm_afferent_multiplier = 100
 

Definition at line 128 of file ppm_draw.c.

int ppm_afferent_subplot = PPM_RYW
 

Definition at line 149 of file ppm_draw.c.

int ppm_always_draw_point = True
 

Definition at line 158 of file ppm_draw.c.

int ppm_always_mark_neuron = False
 

Definition at line 143 of file ppm_draw.c.

XColor ppm_background_color
 

Definition at line 212 of file ppm_draw.c.

double ppm_bg_B = Uninitialized
 

Definition at line 124 of file ppm_draw.c.

double ppm_bg_G = Uninitialized
 

Definition at line 123 of file ppm_draw.c.

double ppm_bg_R = Uninitialized
 

Definition at line 122 of file ppm_draw.c.

int ppm_border = MAX(2,(int)(NMAX*0.03))
 

Definition at line 120 of file ppm_draw.c.

int ppm_color_key_num = 13
 

Definition at line 201 of file ppm_draw.c.

int ppm_color_keys = Uninitialized
 

Definition at line 200 of file ppm_draw.c.

int ppm_combine_alternate_eyes = False
 

Definition at line 203 of file ppm_draw.c.

double ppm_cortex_scale = Uninitialized
 

Definition at line 118 of file ppm_draw.c.

int ppm_end_i = Uninitialized
 

Definition at line 171 of file ppm_draw.c.

int ppm_end_j = Uninitialized
 

Definition at line 172 of file ppm_draw.c.

int ppm_end_x = Uninitialized
 

Definition at line 176 of file ppm_draw.c.

int ppm_end_y = Uninitialized
 

Definition at line 177 of file ppm_draw.c.

XColor ppm_foreground_color
 

Definition at line 213 of file ppm_draw.c.

int ppm_height = 0
 

Definition at line 216 of file ppm_draw.c.

double ppm_histo_percentage_range = 25
 

Definition at line 191 of file ppm_draw.c.

double ppm_histo_scale_factor = 0.25
 

Definition at line 192 of file ppm_draw.c.

int ppm_histograms = True
 

Definition at line 193 of file ppm_draw.c.

char ppm_image_viewer[MAXFILENAMELENGTH] = "xv -expand 4 -raw"
 

Definition at line 195 of file ppm_draw.c.

int ppm_interior_border = 1
 

Definition at line 162 of file ppm_draw.c.

int ppm_interior_outline = False
 

Definition at line 163 of file ppm_draw.c.

double ppm_lateral_multiplier = 700
 

Definition at line 127 of file ppm_draw.c.

int ppm_lateral_subplot = PPM_RYW
 

Definition at line 148 of file ppm_draw.c.

double ppm_line_B = Uninitialized
 

Definition at line 167 of file ppm_draw.c.

double ppm_line_G = Uninitialized
 

Definition at line 166 of file ppm_draw.c.

double ppm_line_R = Uninitialized
 

Definition at line 165 of file ppm_draw.c.

int ppm_line_orientation_subplot = PPM_SELECTIVITY
 

Definition at line 152 of file ppm_draw.c.

int ppm_line_plots = False
 

Definition at line 156 of file ppm_draw.c.

double ppm_line_selectivity_multiplier = 50
 

Definition at line 130 of file ppm_draw.c.

double ppm_luminance_multiplier = 1
 

Definition at line 126 of file ppm_draw.c.

double ppm_master_scale = 1.0
 

Definition at line 116 of file ppm_draw.c.

int ppm_minimal_outline = False
 

Definition at line 189 of file ppm_draw.c.

int ppm_neuron_ioffset_line = 0
 

Definition at line 160 of file ppm_draw.c.

int ppm_neuron_joffset_line = 0
 

Definition at line 161 of file ppm_draw.c.

int ppm_neuron_skip_aff = 1
 

Definition at line 137 of file ppm_draw.c.

int ppm_neuron_skip_line = 1
 

Definition at line 159 of file ppm_draw.c.

int ppm_ocular_dominance_subplot = PPM_RYW
 

Definition at line 151 of file ppm_draw.c.

int ppm_orientation_subplot = PPM_NONE
 

Definition at line 150 of file ppm_draw.c.

int ppm_outline_retina = True
 

Definition at line 142 of file ppm_draw.c.

int ppm_outline_weights = True
 

Definition at line 141 of file ppm_draw.c.

int ppm_outline_width = 1
 

Definition at line 183 of file ppm_draw.c.

int ppm_paper_based_colors = False
 

Definition at line 139 of file ppm_draw.c.

int ppm_paper_based_retina = Uninitialized
 

Definition at line 140 of file ppm_draw.c.

double ppm_reference_angle = 0
 

Definition at line 184 of file ppm_draw.c.

char ppm_remote_viewer[MAXFILENAMELENGTH] = "anytoascii"
 

Definition at line 196 of file ppm_draw.c.

int ppm_retina_edge_buffer_suppress = False
 

Definition at line 144 of file ppm_draw.c.

double ppm_retina_scale = Uninitialized
 

Definition at line 117 of file ppm_draw.c.

int ppm_retina_subplot = PPM_RYW
 

Definition at line 147 of file ppm_draw.c.

double ppm_selectivity_multiplier = 1
 

Definition at line 129 of file ppm_draw.c.

int ppm_shaded_plots = True
 

Definition at line 157 of file ppm_draw.c.

int ppm_spawn_independent_viewers = True
 

Definition at line 198 of file ppm_draw.c.

int & ppm_spawn_viewer = spawn_viewer
 

Definition at line 197 of file ppm_draw.c.

int ppm_start_i = Uninitialized
 

Definition at line 169 of file ppm_draw.c.

int ppm_start_j = Uninitialized
 

Definition at line 170 of file ppm_draw.c.

int ppm_start_x = Uninitialized
 

Definition at line 174 of file ppm_draw.c.

int ppm_start_y = Uninitialized
 

Definition at line 175 of file ppm_draw.c.

double ppm_subplot_hue = NOHUE
 

Definition at line 154 of file ppm_draw.c.

int ppm_ui = Uninitialized
 

Definition at line 179 of file ppm_draw.c.

int ppm_uj = Uninitialized
 

Definition at line 180 of file ppm_draw.c.

double ppm_value_offset = 0.1
 

Definition at line 187 of file ppm_draw.c.

double ppm_value_range = 0.6
 

Definition at line 186 of file ppm_draw.c.

int ppm_weight_scale_init_count = True
 

Definition at line 134 of file ppm_draw.c.

int ppm_weight_scale_max_count = True
 

Definition at line 135 of file ppm_draw.c.

int ppm_weight_scale_type = PPM_WTSCALE_PEAKRELATIVE
 

Definition at line 133 of file ppm_draw.c.

double ppm_weight_threshold = DEATH_FLAG
 

Definition at line 182 of file ppm_draw.c.


Generated at Mon Aug 21 00:31:09 2000 for RF-LISSOM by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000