vil_viffheader.cxx
Go to the documentation of this file.
1 //:
2 // \file
3 #include <cstring>
4 #include "vil_viffheader.h"
5 #ifdef _MSC_VER
6 # include <vcl_msvc_warnings.h>
7 #endif
8 
9 
10 //: Construct an image header
11 // \param ncols - vil_image::ni()
12 // \param nrows - vil_image::nj()
13 // \param storage_type - similar to vil_image::pixel_format()
14 // \param num_bands - similar to vil_image::n_planes()
16  unsigned ncols, unsigned nrows,
17  vil_viff_data_storage storage_type,
18  unsigned num_bands)
19 {
20  const unsigned VIL_VIFF_COMMENT_LENGTH = 512L;
21 
22  identifier = (char)XV_FILE_MAGIC_NUM;
23  file_type = XV_FILE_TYPE_XVIFF;
24  release = XV_IMAGE_REL_NUM;
25  version = XV_IMAGE_VER_NUM;
26  machine_dep = VFF_DEP_IEEEORDER; /* assume IEEE byte order */
27  memset( reserve, 0, VIFF_HEADERSIZE-21*sizeof(vxl_sint_32)-520*sizeof(char)-4*sizeof(float));
28  memset( trash, 0, 3L);
29  memset( comment, 0, VIL_VIFF_COMMENT_LENGTH);
30  strncpy( comment, "vil_viff image writer output", 28); // must be <= 511 chars
31  row_size = ncols;
32  col_size = nrows;
33  subrow_size = 0; /* Don't care, just avoid uninitialised memory. */
34  startx = VFF_NOTSUB;
35  starty = VFF_NOTSUB;
36  pixsizx = 1.0;
37  pixsizy = 1.0;
38  location_type = VFF_LOC_IMPLICIT;
39  location_dim = 0;
40  location = nullptr;
41  num_of_images = 1;
42  num_data_bands = num_bands;
43  data_storage_type = storage_type;
44  data_encode_scheme = VFF_DES_RAW;
45  map_scheme = VFF_MS_NONE;
46  map_storage_type = VFF_MAPTYP_NONE;
47  maps = nullptr;
48  map_row_size = 0;
49  map_col_size = 0;
50  map_subrow_size = 0;
51  map_enable = VFF_MAP_OPTIONAL;
52  maps_per_cycle = 0; /* Don't care */
53  color_space_model = VFF_CM_NONE;
54  ispare1 = 0;
55  ispare2 = 0;
56  fspare1 = 0;
57  fspare2 = 0;
58 
59  imagedata = nullptr;
60 }
61 
63 {
64  memset(this,0, sizeof(vil_viff_xvimage));
65 }
vxl_sint_32 starty
vxl_uint_32 ispare1
vxl_uint_32 location_type
vxl_uint_32 map_col_size
vxl_uint_32 map_row_size
vxl_uint_32 data_encode_scheme
vxl_sint_32 startx
vxl_uint_32 subrow_size
vxl_uint_32 location_dim
vxl_uint_32 map_enable
vxl_uint_32 row_size
vxl_uint_32 map_storage_type
vxl_uint_32 ispare2
vxl_uint_32 color_space_model
vxl_uint_32 data_storage_type
vxl_uint_32 map_scheme
vxl_uint_32 num_data_bands
char reserve[VIFF_HEADERSIZE -(21 *sizeof(vxl_sint_32)) -(520 *sizeof(char)) -(2 *sizeof(char *)) -(4 *sizeof(float)) -(sizeof(float *))]
vxl_uint_32 num_of_images
vxl_uint_32 col_size
vil_viff_data_storage
vxl_uint_32 map_subrow_size
vxl_uint_32 maps_per_cycle