[ VIGRA Homepage | Class Index | Function Index | File Index | Main Page ]

details Image Import/Export Facilities VIGRA


Namespaces

namespace  vigra::detail

Classes

class  ImageExportInfo
 Argument object for the function exportImage(). See exportImage() for usage example. This object must be used to define the properties of an image to be written to disk. More...

class  ImageImportInfo
 Argument object for the function importImage(). See importImage() for a usage example. This object must be used to read an image from disk and enquire about its properties. More...


Functions

VIGRA_EXPORT std::string impexListFormats ()
 List the image formats VIGRA can read and write.

VIGRA_EXPORT std::string impexListExtensions ()
 List the file extension VIGRA understands.

VIGRA_EXPORT bool isImage (char const *filename)
 Test whether a file is an image format known to VIGRA.

template<...> void read_bands (Decoder *dec, ImageIterator ys, Accessor a, SrcValueType)
 used for reading bands after the source data type has been figured out.

template<...> void read_band (Decoder *dec, ImageIterator ys, Accessor a, SrcValueType)
 used for reading bands after the source data type has been figured out.

template<...> void importVectorImage (const ImageImportInfo &info, ImageIterator iter, Accessor a)
 used for reading images of vector type, such as integer of float rgb.

template<...> void importScalarImage (const ImageImportInfo &info, ImageIterator iter, Accessor a)
 used for reading images of scalar type, such as integer and float grayscale.

template<...> void importImage (const ImageImportInfo &info, ImageIterator iter, Accessor a)
 Read an image, given an vigra::ImageImportInfo object.

template<...> void write_bands (Encoder *enc, ImageIterator ul, ImageIterator lr, Accessor a, DstValueType)
 used for writing bands after the source data type has been figured out.

template<...> void write_band (Encoder *enc, ImageIterator ul, ImageIterator lr, Accessor a, DstValueType)
 used for writing bands after the source data type has been figured out.

template<...> void exportFloatingVectorImage (SrcIterator sul, SrcIterator slr, SrcAccessor sget, const ImageExportInfo &info)
 Deprecated.

template<...> void exportIntegralVectorImage (SrcIterator sul, SrcIterator slr, SrcAccessor sget, const ImageExportInfo &info)
 Deprecated.

template<...> void exportFloatingScalarImage (SrcIterator sul, SrcIterator slr, SrcAccessor sget, const ImageExportInfo &info)
 Deprecated.

template<...> void exportIntegralScalarImage (SrcIterator sul, SrcIterator slr, SrcAccessor sget, const ImageExportInfo &info)
 Deprecated.

template<...> void exportImage (SrcIterator sul, SrcIterator slr, SrcAccessor sget, const ImageExportInfo &info)
 Write an image, given an vigra::ImageExportInfo object.



Detailed Description


supports GIF, TIFF, JPEG, BMP, PNM (PBM, PGM, PPM), PNG, SunRaster, KHOROS-VIFF formats


Function Documentation


  void exportFloatingScalarImage (...)
 
 

Deprecated.

Use exportImage() instead.

Declaration:

        namespace vigra {
            template < class SrcIterator, class SrcAccessor >
            void exportFloatingScalarImage( SrcIterator sul, SrcIterator slr, SrcAccessor sget,
                                            const ImageExportInfo & info )
        }


  void exportFloatingVectorImage (...)
 
 

Deprecated.

Use exportImage() instead.

Declaration:

        namespace vigra {
            template < class SrcIterator, class SrcAccessor >
            void exportFloatingVectorImage( SrcIterator sul, SrcIterator slr, SrcAccessor sget,
                                            const ImageExportInfo & info )
        }


  void exportImage (...)
 
 

Write an image, given an vigra::ImageExportInfo object.

If the file format to be exported to supports the pixel type of the source image, the pixel type will be kept (e.g. float can be stored as TIFF without conversion, in contrast to most other image export toolkits). Otherwise, the pixel values are transformed to the range 0.255 and converted to unsigned char. Currently, the following file formats are supported. The pixel types given in brackets are those that are written without conversion:

"BMP"
Microsoft Windows bitmap image file (pixel types: UINT8 as gray and RGB).
"GIF"
CompuServe graphics interchange format; 8-bit color (pixel types: UINT8 as gray and RGB).
"JPEG"
Joint Photographic Experts Group JFIF format; compressed 24-bit color (pixel types: UINT8 as gray and RGB). (only available if libjpeg is installed)
"PNG"
Portable Network Graphic (pixel types: UINT8 and UINT16 with up to 4 channels). (only available if libpng is installed)
"PBM"
Portable bitmap format (black and white).
"PGM"
Portable graymap format (pixel types: UINT8, INT16, INT32 as gray scale)).
"PNM"
Portable anymap (pixel types: UINT8, INT16, INT32 as gray and RGB).
"PPM"
Portable pixmap format (pixel types: UINT8, INT16, INT32 as RGB).
"SUN"
SUN Rasterfile (pixel types: UINT8 as gray and RGB).
"TIFF"
Tagged Image File Format (pixel types: UINT8, INT16, INT32, FLOAT, DOUBLE with up to 4 channels). (only available if libtiff is installed.)
"VIFF"
Khoros Visualization image file (pixel types: UINT8, INT16, INT32, FLOAT, DOUBLE with arbitrary many channels).

Declarations:

pass arguments explicitly:

    namespace vigra {
        template <class SrcIterator, class SrcAccessor>
        void exportImage(SrcIterator sul, SrcIterator slr, SrcAccessor sget,
                         ImageExportInfo const & info)
    }

use argument objects in conjunction with Argument Object Factories:

    namespace vigra {
        template <class SrcIterator, class SrcAccessor>
        void exportImage(SrcIterator sul, SrcIterator slr, SrcAccessor sget,
                         ImageExportInfo const & info)
    }

Usage:

#include "vigra/impex.hxx"
Namespace: vigra

    vigra::BRGBImage out(w, h);
    ...

    // write as JPEG image, using compression quality 80
    vigra::exportImage(srcImageRange(out),
                      vigra::ImageExportInfo("myimage.jpg").setCompression("80"));


    // force it to a particular pixel type (the pixel type must be supported by the
    // desired image file format, otherwise an \ref vigra::PreconditionViolation exception will be thrown)
    vigra::exportImage(srcImageRange(out),
                      vigra::ImageExportInfo("myINT16image.tif").setPixelType("INT16"));

Preconditions:

  • the image file must be writable.
  • the file type must be one of the supported file types.


  void exportIntegralScalarImage (...)
 
 

Deprecated.

Use exportImage() instead.

Declaration:

        namespace vigra {
            template < class SrcIterator, class SrcAccessor >
            void exportIntegralScalarImage( SrcIterator sul, SrcIterator slr, SrcAccessor sget,
                                            const ImageExportInfo & info )
        }


  void exportIntegralVectorImage (...)
 
 

Deprecated.

Use exportImage() instead.

Declaration:

        namespace vigra {
            template < class SrcIterator, class SrcAccessor >
            void exportIntegralVectorImage( SrcIterator sul, SrcIterator slr, SrcAccessor sget,
                                            const ImageExportInfo & info )
        }


VIGRA_EXPORT std::string impexListExtensions  

 

List the file extension VIGRA understands.

This is useful for creating file dialogs that only list image files VIGRA can actually import.

Usage:

#include "vigra/imageinfo.hxx"
Namespace: vigra

        std::cout << "supported extensions: " << vigra::impexListExtensions() << std::endl;


VIGRA_EXPORT std::string impexListFormats  

 

List the image formats VIGRA can read and write.

This is useful for creating error messages if VIGRA encounters an image format it doesn't recognize.

Usage:

#include "vigra/imageinfo.hxx"
Namespace: vigra

        std::cout << "supported formats: " << vigra::impexListFormats() << std::endl;
Examples:
boundarytensor.cxx, convert.cxx, edge.cxx, invert.cxx, invert_explicitly.cxx, profile.cxx, pyramid.cxx, resize.cxx, smooth.cxx, subimage.cxx, and watershed.cxx.


  void importImage (...)
 
 

Read an image, given an vigra::ImageImportInfo object.

Declarations:

pass arguments explicitly:

        namespace vigra {
            template <class ImageIterator, class Accessor>
            void
            importImage(ImageImportInfo const & image, ImageIterator iter, Accessor a)
        }

use argument objects in conjunction with Argument Object Factories:

        namespace vigra {
            template <class ImageIterator, class Accessor>
            inline void
            importImage(ImageImportInfo const & image, pair<ImageIterator, Accessor> dest)
        }

Usage:

#include "vigra/impex.hxx"
Namespace: vigra

        vigra::ImageImportInfo info("myimage.gif");

        if(info.isGrayscale())
        {
            // create byte image of appropriate size
            vigra::BImage in(info.width(), info.height());

            vigra::importImage(info, destImage(in)); // read the image
            ...
        }
        else
        {
            // create byte RGB image of appropriate size
            vigra::BRGBImage in(info.width(), info.height());

            vigra::importImage(info, destImage(in)); // read the image
            ...
        }

Preconditions:

  • the image file must be readable
  • the file type must be one of

    "BMP"
    Microsoft Windows bitmap image file.
    "GIF"
    CompuServe graphics interchange format; 8-bit color.
    "JPEG"
    Joint Photographic Experts Group JFIF format; compressed 24-bit color. (only available if libjpeg is installed)
    "PNG"
    Portable Network Graphic. (only available if libpng is installed)
    "PBM"
    Portable bitmap format (black and white).
    "PGM"
    Portable graymap format (gray scale).
    "PNM"
    Portable anymap.
    "PPM"
    Portable pixmap format (color).
    "SUN"
    SUN Rasterfile.
    "TIFF"
    Tagged Image File Format. (only available if libtiff is installed.)
    "VIFF"
    Khoros Visualization image file.


  void importScalarImage (...)
 
 

used for reading images of scalar type, such as integer and float grayscale.

#include "vigra/impex.hxx"
Namespace: vigra

Declaration:

        namespace vigra {
            template < class ImageIterator, class Accessor >
            void importScalarImage( const ImageImportInfo & info, ImageIterator iter, Accessor a )
        }
Parameters:
ImageIterator  the image iterator type for the destination image
Accessor  the image accessor type for the destination image
info  user supplied image import information
iter  image iterator referencing the upper left pixel of the destination image
a  image accessor for the destination image


  void importVectorImage (...)
 
 

used for reading images of vector type, such as integer of float rgb.

#include "vigra/impex.hxx"
Namespace: vigra

Declaration:

        namespace vigra {
            template< class ImageIterator, class Accessor >
            void importVectorImage( const ImageImportInfo & info, ImageIterator iter, Accessor a )
        }
Parameters:
ImageIterator  the image iterator type for the destination image
Accessor  the image accessor type for the destination image
info  user supplied image import information
iter  image iterator referencing the upper left pixel of the destination image
a  image accessor for the destination image


VIGRA_EXPORT bool isImage char const *    filename

 

Test whether a file is an image format known to VIGRA.

This checks the first few bytes of the file and compares them with the "magic strings" of each recognized image format.

Usage:

#include "vigra/imageinfo.hxx"
Namespace: vigra

    std::cout << "is image: " << vigra::isImage("foo.bmp") << std::endl;


  void read_band (...)
 
 

used for reading bands after the source data type has been figured out.

#include "vigra/impex.hxx"
Namespace: vigra

Declaration:

        namespace vigra {
            template< class ImageIterator, class Accessor, class SrcValueType >
            void read_band( Decoder * dec, ImageIterator ys, Accessor a, SrcValueType )
        }
Parameters:
dec  decoder object through which the source data will be accessed
ys  image iterator referencing the upper left pixel of the destination image
a  image accessor for the destination image


  void read_bands (...)
 
 

used for reading bands after the source data type has been figured out.

#include "vigra/impex.hxx"
Namespace: vigra

Declaration:

        namespace vigra {
            template< class ImageIterator, class Accessor, class SrcValueType >
            void read_bands( Decoder * dec, ImageIterator ys, Accessor a, SrcValueType )
        }
Parameters:
dec  decoder object through which the source data will be accessed
ys  image iterator referencing the upper left pixel of the destination image
a  image accessor for the destination image


  void write_band (...)
 
 

used for writing bands after the source data type has been figured out.

#include "vigra/impex.hxx"
Namespace: vigra

Declaration:

        namespace vigra {
            template< class ImageIterator, class Accessor, class DstValueType >
            void write_band( Encoder * enc, ImageIterator ul, ImageIterator lr, Accessor a, DstValueType )
        }
Parameters:
enc  encoder object through which the destination data will be accessed
ul  image iterator referencing the upper left pixel of the source image
lr  image iterator referencing the lower right pixel of the source image
a  image accessor for the source image


  void write_bands (...)
 
 

used for writing bands after the source data type has been figured out.

#include "vigra/impex.hxx"
Namespace: vigra

Declaration:

        namespace vigra {
            template< class ImageIterator, class Accessor, class DstValueType >
            void write_bands( Encoder * enc, ImageIterator ul, ImageIterator lr, Accessor a, DstValueType )
        }
Parameters:
enc  encoder object through which the destination data will be accessed
ul  image iterator referencing the upper left pixel of the source image
lr  image iterator referencing the lower right pixel of the source image
a  image accessor for the source image

© Ullrich Köthe (koethe@informatik.uni-hamburg.de)
Cognitive Systems Group, University of Hamburg, Germany

html generated using doxygen and Python
VIGRA 1.5.0 (7 Dec 2006)