|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - downloadIndex: ┃ T v ┃
Length: 2578 (0xa12) Types: TextFile Names: »var_double_image.c++«
└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki └─ ⟦this⟧ »EUUGD11/euug-87hel/sec1/image/varc++/var_double_image.c++«
/* This is the interface between the mv image file format and my c++ image handling datatype for images full of doubles */ #include <stream.h> #include <stdio.h> #include <string.h> #include "error.h++" #include "var.h++" #include "image.h++" #include "for.h++" #include "double_image.h++" /* Reads in a double image from a mv file */ double_image::double_image ( const read_image_type rit , // marker that the image is being read const FILE * image_file , // file for image const card w_width = 1 , // window width const card w_length = 1 // window length ) : ( READ , image_file , w_width , w_length ) { /* check that the constructor is called correctly */ if ( rit != READ ) { cerr << "constructor for double_image being called in obscure way\n"; abort(); } /* read in image from file */ struct var_header *vh = (struct var_header *) header_info; double * image_buffer = var_read_doubles ( image_file , vh ); if (error_occured) { cerr << "error when reading in data from file"; print_errors_and_abort(); } /* assign fields of the class */ comments = vh->vh_comments; comment_length = strlen(vh->vh_comments); number_rows = vh->vh_length; number_cols = vh->vh_width; /* allocate space for dope vector */ image_rows = new double * [ number_rows ]; /* allocate space for window dope vector */ window_rows = new double * [ w_length ]; /* initialize dope vector */ FOR(int i1 = 0 ; i1 < number_rows; i1++) { image_rows[i1] = image_buffer + i1*number_cols; } ENDFOR /* set up the protection so the image can be written */ prot = CAN_READ; /* initialize function pointers */ next = &uninitialized_next; prev = &uninitialized_prev; get_w_e_pointer = &uninitialized_get_w_e; write_w_e_pointer = &uninitialized_write_w_e; } /* This writes out a double image to a mv image file */ void double_image::write ( ) { /* do the image independent stuff */ this->image_class::write(); /* fill in the relevant fields of the header info */ struct var_header *vh = var_create_double_header(number_rows,number_cols); vh->vh_comments = comments; /* put the header, comments and data out to the file */ var_write_doubles(file,vh,image_buffer); } /* Copyright (C) 1986, David Sher in the University of Rochester Permission is granted to any individual or institution to use, copy, or redistribute this software so long as it is not sold for profit, provided this copyright notice is retained. */