9 #define where (std::cerr << __FILE__ " : " << __LINE__ << " : ") 10 #define SGI_HDR_SIZE 512 119 where <<
"File is not a valid SGI file\n";
129 where <<
"SGI file has a non-supported pixel size of " <<
hdr.
bpc*
hdr.
zsize*8 <<
" bits\n";
136 where <<
"The RLE storage format is not yet supported for SGI images\n";
143 where <<
"Only colormap mode 0 is supported for SGI images\n";
153 std::cerr <<
"Writing SGI header\n" 154 <<
ni() <<
'x' <<
nj() <<
'@' 170 unsigned x0,
unsigned nx,
unsigned y0,
unsigned ny)
const 172 if (x0+nx >
ni() || y0+ny >
nj())
181 for(
int i = 0; i < ny; i++)
191 unsigned x0,
unsigned y0)
206 for(
int i = 0; i < view2.nj(); i++)
209 is_->
write(&view2(0, i, view2.nplanes()-1), view2.ni()*view2.nplanes());
vil_sgi_image(vil_stream *is, unsigned ni, unsigned nj, unsigned nplanes, vil_pixel_format format)
An abstract base class of smart pointers to actual image data in memory.
virtual bool view_fits(const vil_image_view_base &im, unsigned i0, unsigned j0)
Check that a view will fit into the data at the given offset.
enum vil_pixel_format pixel_format() const override
Pixel Format.
Indicates that some operation is not supported.
virtual vil_streampos write(void const *buf, vil_streampos n)=0
Write n bytes from buf. Returns number of bytes written.
Concrete view of image data of type T held in memory.
bool put_view(const vil_image_view_base &im, unsigned i0, unsigned j0) override
Put the data in this view back into the image source.
bool get_property(char const *tag, void *prop=nullptr) const override
Extra property information.
Indicates that an image load or save operation failed.
virtual void seek(vil_streampos position)=0
Goto file pointer.
virtual vil_streampos read(void *buf, vil_streampos n)=0
Read n bytes into buf. Returns number of bytes read.
Exceptions thrown by vil, and a mechanism for turning them off.
Stream interface for VIL image loaders.
~vil_sgi_image() override
virtual enum vil_pixel_format pixel_format() const =0
Return a description of the concrete data pixel type.
Indicates that some reference was made to pixels beyond the bounds of an image.
char const * file_format() const override
Return a string describing the file format.
Generic image implementation for SGI files.
void ref()
up/down the reference count.
vil_image_view_base_sptr get_copy_view() const
Create a read/write view of a copy of all the data.
A base class reference-counting view of some image data.
Ref. counted block of data on the heap.
unsigned ni() const override
Dimensions: Planes x ni x nj.
unsigned nplanes() const override
Dimensions: planes x width x height x components.
unsigned nj() const override
Dimensions: Planes x ni x nj.
void vil_exception_warning(T exception)
Throw an exception indicating a potential problem.
void vil_exception_error(T exception)
Throw an exception indicating a definite problem.
char const * vil_sgi_format_tag