Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

libpnmrw.h File Reference

Go to the source code of this file.


Data Structures

struct  colorhist_item
struct  colorhist_list_item
struct  pixel

Defines

#define ARGS(alist)   ()
#define const
#define PBM_WHITE   0
#define PBM_BLACK   1
#define PBM_FORMAT_TYPE(f)   ((f) == PBM_FORMAT || (f) == RPBM_FORMAT ? PBM_TYPE : -1)
#define PGM_MAXMAXVAL   255
#define PGM_FORMAT_TYPE(f)   ((f) == PGM_FORMAT || (f) == RPGM_FORMAT ? PGM_TYPE : PBM_FORMAT_TYPE(f))
#define PPM_MAXMAXVAL   PGM_MAXMAXVAL
#define PPM_GETR(p)   ((p).r)
#define PPM_GETG(p)   ((p).g)
#define PPM_GETB(p)   ((p).b)
#define PPM_ASSIGN(p, red, grn, blu)   do { (p).r = (red); (p).g = (grn); (p).b = (blu); } while ( 0 )
#define PPM_EQUAL(p, q)   ( (p).r == (q).r && (p).g == (q).g && (p).b == (q).b )
#define PPM_FORMAT_TYPE(f)   ((f) == PPM_FORMAT || (f) == RPPM_FORMAT ? PPM_TYPE : PGM_FORMAT_TYPE(f))
#define PNM_MAXMAXVAL   PPM_MAXMAXVAL
#define PNM_GET1(x)   PPM_GETB(x)
#define PNM_ASSIGN1(x, v)   PPM_ASSIGN(x,0,0,v)
#define PNM_EQUAL(x, y)   PPM_EQUAL(x,y)
#define PNM_FORMAT_TYPE(f)   PPM_FORMAT_TYPE(f)
#define PBM_MAGIC1   'P'
#define PBM_MAGIC2   '1'
#define RPBM_MAGIC2   '4'
#define PBM_FORMAT   (PBM_MAGIC1 * 256 + PBM_MAGIC2)
#define RPBM_FORMAT   (PBM_MAGIC1 * 256 + RPBM_MAGIC2)
#define PBM_TYPE   PBM_FORMAT
#define PGM_MAGIC1   'P'
#define PGM_MAGIC2   '2'
#define RPGM_MAGIC2   '5'
#define PGM_FORMAT   (PGM_MAGIC1 * 256 + PGM_MAGIC2)
#define RPGM_FORMAT   (PGM_MAGIC1 * 256 + RPGM_MAGIC2)
#define PGM_TYPE   PGM_FORMAT
#define PPM_MAGIC1   'P'
#define PPM_MAGIC2   '3'
#define RPPM_MAGIC2   '6'
#define PPM_FORMAT   (PPM_MAGIC1 * 256 + PPM_MAGIC2)
#define RPPM_FORMAT   (PPM_MAGIC1 * 256 + RPPM_MAGIC2)
#define PPM_TYPE   PPM_FORMAT
#define PPM_DEPTH(newp, p, oldmaxval, newmaxval)
#define PPM_LUMIN(p)   ( 0.299 * PPM_GETR(p) + 0.587 * PPM_GETG(p) + 0.114 * PPM_GETB(p) )
#define pnm_allocarray(cols, rows)   ((xel**) pm_allocarray( cols, rows, sizeof(xel) ))
#define pnm_allocrow(cols)   ((xel*) pm_allocrow( cols, sizeof(xel) ))
#define pnm_freearray(xels, rows)   pm_freearray( (char**) xels, rows )
#define pnm_freerow(xelrow)   pm_freerow( (char*) xelrow )

Typedefs

typedef unsigned char bit
typedef unsigned char gray
typedef gray pixval
typedef pixel xel
typedef pixval xelval
typedef colorhist_itemcolorhist_vector
typedef colorhist_list_itemcolorhist_list
typedef colorhist_listcolorhash_table

Functions

void * malloc ()
void pnm_init2 ARGS ((char *pn))
char **pm_allocarray ARGS ((int cols, int rows, int size))
char *pm_allocrow ARGS ((int cols, int size))
void pm_freearray ARGS ((char **its, int rows))
void pm_freerow ARGS ((char *itrow))
xel **pnm_readpnm ARGS ((FILE *file, int *colsP, int *rowsP, xelval *maxvalP, int *formatP))
int pnm_readpnmrow ARGS ((FILE *file, xel *xelrow, int cols, xelval maxval, int format))
int pnm_writepnm ARGS ((FILE *file, xel **xels, int cols, int rows, xelval maxval, int format, int forceplain))
int pnm_writepnminit ARGS ((FILE *file, int cols, int rows, xelval maxval, int format, int forceplain))
int pnm_writepnmrow ARGS ((FILE *file, xel *xelrow, int cols, xelval maxval, int format, int forceplain))
FILE *pm_openr ARGS ((char *name))
int pm_closer ARGS ((FILE *f))
colorhist_vector ppm_computecolorhist ARGS ((pixel **pixels, int cols, int rows, int maxcolors, int *colorsP))
void ppm_addtocolorhist ARGS ((colorhist_vector chv, int *colorsP, int maxcolors, pixel *colorP, int value, int position))
void ppm_freecolorhist ARGS ((colorhist_vector chv))
int ppm_lookupcolor ARGS ((colorhash_table cht, pixel *colorP))
colorhist_vector ppm_colorhashtocolorhist ARGS ((colorhash_table cht, int maxcolors))
colorhash_table ppm_colorhisttocolorhash ARGS ((colorhist_vector chv, int colors))
int ppm_addtocolorhash ARGS ((colorhash_table cht, pixel *colorP, int value))
colorhash_table ppm_alloccolorhash ARGS ((void))
void ppm_freecolorhash ARGS ((colorhash_table cht))
void pnm_promoteformat ARGS ((xel **xels, int cols, int rows, xelval maxval, int format, xelval newmaxval, int newformat))
void pnm_promoteformatrow ARGS ((xel *xelrow, int cols, xelval maxval, int format, xelval newmaxval, int newformat))
xel pnm_backgroundxel ARGS ((xel **xels, int cols, int rows, xelval maxval, int format))
xel pnm_backgroundxelrow ARGS ((xel *xelrow, int cols, xelval maxval, int format))
xel pnm_whitexel ARGS ((xelval maxval, int format))
void pnm_invertxel ARGS ((xel *xP, xelval maxval, int format))

Variables

xelval pnm_pbmmaxval

Define Documentation

#define ARGS alist       ()
 

Definition at line 34 of file libpnmrw.h.

#define const
 

Definition at line 35 of file libpnmrw.h.

#define PBM_BLACK   1
 

Definition at line 43 of file libpnmrw.h.

#define PBM_FORMAT   (PBM_MAGIC1 * 256 + PBM_MAGIC2)
 

Definition at line 77 of file libpnmrw.h.

#define PBM_FORMAT_TYPE      ((f) == PBM_FORMAT || (f) == RPBM_FORMAT ? PBM_TYPE : -1)
 

Definition at line 44 of file libpnmrw.h.

#define PBM_MAGIC1   'P'
 

Definition at line 74 of file libpnmrw.h.

#define PBM_MAGIC2   '1'
 

Definition at line 75 of file libpnmrw.h.

#define PBM_TYPE   PBM_FORMAT
 

Definition at line 79 of file libpnmrw.h.

#define PBM_WHITE   0
 

Definition at line 42 of file libpnmrw.h.

#define PGM_FORMAT   (PGM_MAGIC1 * 256 + PGM_MAGIC2)
 

Definition at line 84 of file libpnmrw.h.

#define PGM_FORMAT_TYPE      ((f) == PGM_FORMAT || (f) == RPGM_FORMAT ? PGM_TYPE : PBM_FORMAT_TYPE(f))
 

Definition at line 48 of file libpnmrw.h.

#define PGM_MAGIC1   'P'
 

Definition at line 81 of file libpnmrw.h.

#define PGM_MAGIC2   '2'
 

Definition at line 82 of file libpnmrw.h.

#define PGM_MAXMAXVAL   255
 

Definition at line 47 of file libpnmrw.h.

#define PGM_TYPE   PGM_FORMAT
 

Definition at line 86 of file libpnmrw.h.

#define pnm_allocarray cols,
rows       ((xel**) pm_allocarray( cols, rows, sizeof(xel) ))
 

Definition at line 115 of file libpnmrw.h.

#define pnm_allocrow cols       ((xel*) pm_allocrow( cols, sizeof(xel) ))
 

Definition at line 117 of file libpnmrw.h.

#define PNM_ASSIGN1 x,
v       PPM_ASSIGN(x,0,0,v)
 

Definition at line 67 of file libpnmrw.h.

#define PNM_EQUAL x,
y       PPM_EQUAL(x,y)
 

Definition at line 68 of file libpnmrw.h.

#define PNM_FORMAT_TYPE      PPM_FORMAT_TYPE(f)
 

Definition at line 69 of file libpnmrw.h.

#define pnm_freearray xels,
rows       pm_freearray( (char**) xels, rows )
 

Definition at line 119 of file libpnmrw.h.

#define pnm_freerow xelrow       pm_freerow( (char*) xelrow )
 

Definition at line 121 of file libpnmrw.h.

#define PNM_GET1      PPM_GETB(x)
 

Definition at line 66 of file libpnmrw.h.

#define PNM_MAXMAXVAL   PPM_MAXMAXVAL
 

Definition at line 65 of file libpnmrw.h.

#define PPM_ASSIGN p,
red,
grn,
blu       do { (p).r = (red); (p).g = (grn); (p).b = (blu); } while ( 0 )
 

Definition at line 59 of file libpnmrw.h.

#define PPM_DEPTH newp,
p,
oldmaxval,
newmaxval   
 

Value:

PPM_ASSIGN( (newp), \
        ( (int) PPM_GETR(p) * (newmaxval) + (oldmaxval) / 2 ) / (oldmaxval), \
        ( (int) PPM_GETG(p) * (newmaxval) + (oldmaxval) / 2 ) / (oldmaxval), \
        ( (int) PPM_GETB(p) * (newmaxval) + (oldmaxval) / 2 ) / (oldmaxval) )

Definition at line 98 of file libpnmrw.h.

#define PPM_EQUAL p,
q       ( (p).r == (q).r && (p).g == (q).g && (p).b == (q).b )
 

Definition at line 60 of file libpnmrw.h.

#define PPM_FORMAT   (PPM_MAGIC1 * 256 + PPM_MAGIC2)
 

Definition at line 91 of file libpnmrw.h.

#define PPM_FORMAT_TYPE      ((f) == PPM_FORMAT || (f) == RPPM_FORMAT ? PPM_TYPE : PGM_FORMAT_TYPE(f))
 

Definition at line 61 of file libpnmrw.h.

#define PPM_GETB p       ((p).b)
 

Definition at line 58 of file libpnmrw.h.

#define PPM_GETG p       ((p).g)
 

Definition at line 57 of file libpnmrw.h.

#define PPM_GETR p       ((p).r)
 

Definition at line 56 of file libpnmrw.h.

#define PPM_LUMIN p       ( 0.299 * PPM_GETR(p) + 0.587 * PPM_GETG(p) + 0.114 * PPM_GETB(p) )
 

Definition at line 107 of file libpnmrw.h.

#define PPM_MAGIC1   'P'
 

Definition at line 88 of file libpnmrw.h.

#define PPM_MAGIC2   '3'
 

Definition at line 89 of file libpnmrw.h.

#define PPM_MAXMAXVAL   PGM_MAXMAXVAL
 

Definition at line 51 of file libpnmrw.h.

#define PPM_TYPE   PPM_FORMAT
 

Definition at line 93 of file libpnmrw.h.

#define RPBM_FORMAT   (PBM_MAGIC1 * 256 + RPBM_MAGIC2)
 

Definition at line 78 of file libpnmrw.h.

#define RPBM_MAGIC2   '4'
 

Definition at line 76 of file libpnmrw.h.

#define RPGM_FORMAT   (PGM_MAGIC1 * 256 + RPGM_MAGIC2)
 

Definition at line 85 of file libpnmrw.h.

#define RPGM_MAGIC2   '5'
 

Definition at line 83 of file libpnmrw.h.

#define RPPM_FORMAT   (PPM_MAGIC1 * 256 + RPPM_MAGIC2)
 

Definition at line 92 of file libpnmrw.h.

#define RPPM_MAGIC2   '6'
 

Definition at line 90 of file libpnmrw.h.


Typedef Documentation

typedef unsigned char bit
 

Definition at line 41 of file libpnmrw.h.

typedef colorhist_list* colorhash_table
 

Definition at line 161 of file libpnmrw.h.

typedef struct colorhist_list_item* colorhist_list
 

Definition at line 154 of file libpnmrw.h.

typedef struct colorhist_item* colorhist_vector
 

Definition at line 147 of file libpnmrw.h.

typedef unsigned char gray
 

Definition at line 46 of file libpnmrw.h.

Referenced by hash_color(), and XImage_to_mri().

typedef gray pixval
 

Definition at line 50 of file libpnmrw.h.

Referenced by expand_right_edge().

typedef pixel xel
 

Definition at line 63 of file libpnmrw.h.

typedef pixval xelval
 

Definition at line 64 of file libpnmrw.h.


Function Documentation

void pnm_invertxel ARGS (xel *xP, xelval maxval, int format  
 

xel pnm_blackxel ARGS (xelval maxval, int format  
 

xel pnm_backgroundxelrow ARGS (xel *xelrow, int cols, xelval maxval, int format  
 

xel pnm_backgroundxel ARGS (xel **xels, int cols, int rows, xelval maxval, int format  
 

void pnm_promoteformatrow ARGS (xel *xelrow, int cols, xelval maxval, int format, xelval newmaxval, int newformat  
 

void pnm_promoteformat ARGS (xel **xels, int cols, int rows, xelval maxval, int format, xelval newmaxval, int newformat  
 

void ppm_freecolorhash ARGS (colorhash_table cht)   
 

colorhash_table ppm_alloccolorhash ARGS (void)   
 

int ppm_addtocolorhash ARGS (colorhash_table cht, pixel *colorP, int value  
 

colorhash_table ppm_colorhisttocolorhash ARGS (colorhist_vector chv, int colors  
 

colorhist_vector ppm_colorhashtocolorhist ARGS (colorhash_table cht, int maxcolors  
 

int ppm_lookupcolor ARGS (colorhash_table cht, pixel *colorP  
 

void ppm_freecolorhist ARGS (colorhist_vector chv)   
 

void ppm_addtocolorhist ARGS (colorhist_vector chv, int *colorsP, int maxcolors, pixel *colorP, int value, int position  
 

colorhash_table ppm_computecolorhash ARGS (pixel **pixels, int cols, int rows, int maxcolors, int *colorsP  
 

int pm_closew ARGS (FILE *f)   
 

FILE *pm_openw ARGS (char *name  
 

int pnm_writepnmrow ARGS (FILE *file, xel *xelrow, int cols, xelval maxval, int format, int forceplain  
 

int pnm_writepnminit ARGS (FILE *file, int cols, int rows, xelval maxval, int format, int forceplain  
 

int pnm_writepnm ARGS (FILE *file, xel **xels, int cols, int rows, xelval maxval, int format, int forceplain  
 

int pnm_readpnmrow ARGS (FILE *file, xel *xelrow, int cols, xelval maxval, int format  
 

int pnm_readpnminit ARGS (FILE *file, int *colsP, int *rowsP, xelval *maxvalP, int *formatP  
 

void pm_freerow ARGS (char *itrow)   
 

void pm_freearray ARGS (char **its, int rows  
 

char* pm_allocrow ARGS (int cols, int size  
 

char** pm_allocarray ARGS (int cols, int rows, int size  
 

void pnm_init2 ARGS (char *pn)   
 

void* malloc  
 

include <malloc.h> *


Variable Documentation

xelval pnm_pbmmaxval
 

Definition at line 131 of file libpnmrw.h.

 

Powered by Plone

This site conforms to the following standards: