vil_file_format.cxx
Go to the documentation of this file.
1 // This is core/vil/vil_file_format.cxx
2 //:
3 // \file
4 #include <cstdlib>
5 #include "vil_file_format.h"
6 
8 
9 #ifdef _MSC_VER
10 # include <vcl_msvc_warnings.h>
11 #endif
12 #include <vil/vil_config.h> // for list of configured file formats
13 #include <vil/vil_exception.h>
14 
15 #if HAS_PNM
17 #endif
18 
19 #if HAS_IRIS
21 #endif
22 
23 #if HAS_MIT
25 #endif
26 
27 #if HAS_VIFF
29 #endif
30 
31 #if HAS_PNG
33 #endif
34 
35 #if HAS_JPEG
37 #endif
38 
39 #if HAS_TIFF
42 #endif
43 
44 #if HAS_BMP
46 #endif
47 
48 #if HAS_GIF
49 #include <vil/file_formats/vil_gif.h>
50 #endif
51 
52 #if HAS_RAS
54 #endif
55 
56 #if HAS_GEN
57 #include <vil/file_formats/vil_gen.h>
58 #endif
59 
60 #if HAS_DCMTK
62 #endif
63 
64 #if HAS_NITF
66 #endif
67 
68 #if HAS_J2K
70 #endif
71 
72 #if HAS_OPENJPEG2
74 #endif
75 
76 #if HAS_SGI
78 #endif
79 
80 //constexpr unsigned MAX_FILE_FORMATS = 256;
81 //: Local class to hold file format list
82 // Clears list on deletion.
84 {
85  std::list<vil_file_format*> l;
87  {
88 #if HAS_JPEG
89  l.push_back(new vil_jpeg_file_format);
90 #endif
91 #if HAS_PNG
92  l.push_back(new vil_png_file_format);
93 #endif
94 #if HAS_PNM
95  l.push_back(new vil_pnm_file_format);
96  l.push_back(new vil_pbm_file_format);
97  l.push_back(new vil_pgm_file_format);
98  l.push_back(new vil_ppm_file_format);
99 #endif
100 #if HAS_IRIS
101  l.push_back(new vil_iris_file_format);
102 #endif
103 #if HAS_MIT
104  l.push_back(new vil_mit_file_format);
105 #endif
106 #if HAS_VIFF
107  l.push_back(new vil_viff_file_format);
108 #endif
109 #if HAS_BMP
110  l.push_back(new vil_bmp_file_format);
111 #endif
112 #if HAS_GIF
113  l.push_back(new vil_gif_file_format);
114 #endif
115 #if HAS_RAS
116  l.push_back(new vil_ras_file_format);
117 #endif
118 #if HAS_GEN
119  l.push_back(new vil_gen_file_format);
120 #endif
121 // the DCMTK based reader is more complete, so use try that
122 // before the vil implementation
123 #if HAS_DCMTK
124  l.push_back(new vil_dicom_file_format);
125 #endif
126 
127 #if HAS_NITF
128  l.push_back(new vil_nitf2_file_format);
129 #endif
130 
131 #if HAS_J2K
132  l.push_back(new vil_j2k_file_format);
133 #endif
134 
135 #if HAS_OPENJPEG2
136  l.push_back(new vil_openjpeg_jp2_file_format);
137  l.push_back(new vil_openjpeg_j2k_file_format);
138 #endif
139 
140 #if HAS_TIFF
141  l.push_back(new vil_tiff_file_format);
142  l.push_back(new vil_pyramid_image_list_format);
143 #endif
144 
145 #if HAS_SGI
146  l.push_back(new vil_sgi_file_format);
147 #endif
148  }
149 
151  {
152  for(auto & i : l)
153  {
154  if(i)
155  {
156  delete i;
157  }
158  }
159  }
160 };
161 
162 //: The function will take ownership of ff;
164 {
165  std::list<vil_file_format*>& l = all();
166 
167  // Always add runtime-loaded formats to the front to allow them to replace
168  // built-in formats
169  l.push_front(ff);
170 }
171 
172 
173 std::list<vil_file_format*>& vil_file_format::all()
174 {
175  static vil_file_format_storage storage;
176  return storage.l;
177 }
vil_j2k: Written by Rob Radtke (rob@) and Harry Voorhees (hlv@) of Stellar Science Ltd.
Loader for DICOM files.
Definition: vil_dicom.h:23
Exceptions thrown by vil, and a mechanism for turning them off.
Base class for image formats.
Image in MIT format.
Alias name for pnm; only tag() differs.
Definition: vil_pnm.h:37
Reader/Writer for DICOM format 2D images.
Alias name for pnm; only tag() differs.
Definition: vil_pnm.h:51
vil_nitf2: Written by Rob Radtke (rob@) and Harry Voorhees (hlv@) of Stellar Science Ltd.
Loader for PPM,PGM,PBM files.
Definition: vil_pnm.h:24
static std::list< vil_file_format * > & all()
Portable network graphics, http://www.cdrom.com/pub/png.
Definition: vil_png.h:21
Local class to hold file format list.
Loader for MIT files.
Definition: vil_mit.h:37
std::list< vil_file_format * > l
Loader for JPEG files.
Definition: vil_jpeg.h:24
static void add_file_format(vil_file_format *ff)
The function will take ownership of ff;.
virtual ~vil_file_format()
Image I/O for JPEG2000 imagery using OpenJPEG.
Alias name for pnm; only tag() differs.
Definition: vil_pnm.h:44
Loader for VIFF files, i.e., 1-banded Khoros 1.0 images.
Definition: vil_viff.h:27
Loader for SGI files.
Definition: vil_sgi.h:17
Loader for BMP files.
Definition: vil_bmp.h:41
Loader for RGB files (sgi iris).
Definition: vil_iris.h:24
Loader for tiff files.
Definition: vil_tiff.h:46
Base class for image formats.
A pyramid image resource based on multiple file-based image resources.
Loader for Sun raster files.
Definition: vil_ras.h:25
Loader for Khoros 1.0 images.