ECW

ECW (Enhanced Compression Wavelet) is a wavelet compressed format used for images.   It is a proprietary technology developed by ER Mapper, a company that was acquired by ERDAS which in turn was acquired by Intergraph which in turn was acquired by Hexagon AB.    During that corporate evolution two main versions of ECW have become widely used, Version 2 and Version 3, with different SDK libraries for read-only or read/write capabilities licensed to third parties, including Manifold, by ER Mapper or its corporate successor, Hexagon.  ECW is a more modern, much faster and more effective format than the older wavelet compression format, MrSID.   

 

Manifold supports ECW for linking, importing and exporting.  Manifold supports MrSID only for read-only linking or importing.

 

For maximum flexibility in reading or writing ECW,  Manifold includes as built-in facilities both the read/write library from ER Mapper and also the read-only library from Hexagon.  No additional software need be installed to provide ECW capability.   The two libraries (SDKs) are used as follows:

 

 

 

 

ECW files are single files that end in an .ecw three letter extension.   Related files sometimes found along with .ecw files are .ers files, a relic of ERDAS days, which can be small files that contain a link to the accompanying .ecw file.   In such cases we simply open the .ecw file directly.

 

When exporting, .prj and .mapmeta files are written.  See the Exporting topic.

Designed for Viewing

ECW as a technology was designed to enable lightweight viewers to browse very large images without having to import many megabytes or gigabytes of image data into the viewer.   The technology is aimed primarily at viewing of data, not editing it.    The technology approach is similar to other formats using discrete wavelet technology compression, such as MrSID, although ECW is more modern and much faster than MrSID.

 

One key idea behind technologies like MrSID and ECW is that relatively few pixels are shown in whatever viewport or window the viewer displays for the user. An image may be many gigabytes in size but only a few megabytes of pixels will appear on the monitor.    If the format provides means for rapidly fetching a rendering of the image at whatever level of zoom is being used, for example, using intermediate levels, the viewer can leave the big image data in the ECW file and fetch only what is needed to populate those pixels that appear in the display.

 

Another key idea is using compression to reduce the overall size of the image.  If the decompression technology is fast it can be used as an essential part of the image fetching mechanism, so that fewer bytes need be fetched to synthesize on the fly the decompressed imagery required for the display.

 

ECW is very fast both at decompression and also at fetching what is necessary to rapidly generate, on-the-fly, whatever view is required of a compressed image.  Applications which use ECW can therefore leave big images in the original ECW file and link that file into their projects, so that when images are opened the ECW machinery brings in for display whatever imagery is required.

 

 Export: When exporting to ECW, Manifold writes image offset and scale info into the image file as well as projection information into the accompanying file.

Linking

In Manifold we can take advantage of that by linking an ECW file into our project.   The link creates a data source cylinder that indicates the data is stored outside of the project, in the original ECW file.  When we expand the data source we can see the image within and then we can use that image as a layer in maps.  This works well in cases when we only intend to view the image and not to edit it.

 

Linking an ECW into a Manifold project leaves the imagery within ECW format, so any manipulation of that imagery is limited to only what ECW technology can handle.    Since ECW files are normally stored using compression that involves some degree of data loss.  We will not have direct access to the original pixels in whatever was the original image before it was compressed into ECW:  we will only have access to the view that is generated on-the-fly by decompressing the data within the ECW.  

 

Important: When linking an ECW file the image that appears in that data source in the Manifold project stays resident in the ECW file.   It is an ECW image even though it appears in many respects, for the convenience of the user, to be a Manifold image.  

 

To link an ECW format file:

 

  1. Choose File-Link from the main menu.

  2. In the Link dialog browse to the folder containing data of interest.

  3. Click the .ecw file desired.

  4. Check or uncheck the Save cache box as desired.

  5. Press Link.  A linked data source will appear in the project.

  6. Press the + icon next to the data source to expand the data source to see the image it contains.

 

 

The  Options dialog allows setting cache options.

 

 

Most often when linking to a format like ECW, which is fast for links, we will ensure the Save cached data between sessions box is not checked.    We click OK and then back in the Link dialog we click Open.

 

 

That creates a data source that contains an image and the image's table in our project.  We can double-click on the image to open it.

 

 

For a more interesting display, we first create a new data source using a Bing street maps imageserver as shown in the Example: An Imageserver Tutorial topic.   We then create a map and drag and drop the Bing layer into the map, and then we drag and drop the ithaca Image from the data source into the map.    The image will be re-projected on the fly to match the Pseudo-Mercator projection used by the map.

 

When linking an ECW we can alter the coordinate system and Style the image, changing channel assignments and how channels are interpreted.  The data within the ECW remains unchanged, but Manifold will dynamically, on-the-fly re-project and re-interpret the data in the new Style as desired.

 

 

For example, to create the display above we have used the Style pane in the Component tab of the Info pane to treat the ECW not as a three-channel RGB image but as a single channel image, forcing use of Channel 0 as a single index channel to drive the display based on a palette, as shown.  We have also clicked the Options tab to apply hill shading.   This is nuts, of course, since the image is a photographic image and not terrain elevation data.  But we can interpret it as if it was intended to be terrain elevation data to create the display seen above.

Import

When we want to do more than just viewing, and to work with images using the full power of Manifold, we can import an ECW as a Manifold image.  

 

Importing an ECW into Manifold decompresses the image into the full content of all pixels for the height and width of the image.  That can be very many pixels as images that are tens of thousands of pixels high and wide are commonly found in ECW format.   

 

For example, the 30000 x 44000 ithaca image shown in this topic and used in the Example: Import or Link ECW topic contains 1.32 billion pixels.  At 4 bytes per pixel (one each for R, G, B and Alpha channels) the image requires 5.28 gigabytes.    When compressed as an ECW the ithaca image is reduced to a 200 megabyte file, but immediately upon import and decompression into a Manifold RGBA image it will expand to the full 5.28 gigabytes required for an image of that size.

 

Caution: Importing a large ECW file can take a few minutes or more, and then saving the project that contains a large imported image can also take a significant amount of time.   However, once the import is accomplished and the project has been saved, thereafter the project will open instantly.  On the plus side, imports from ECW are much faster than imports from older wavelet technology like MrSID.

 

Most GIS packages and spatial data tools will never import a very large ECW for several reasons:

 

 

Manifold, of course, can handle very large images with great speed so the first issue and second points are not problems for Manifold.   The third point we may just have to tolerate if the only source of images for work we must do is in a lossy format.

 

Important: When importing an ECW file the image that appears in the Manifold project is a native Manifold image with no further connection to the ECW file from which it was imported.   It is a native Manifold image and no longer is an ECW image.  

 

To import from ECW format:

 

  1. Choose File-Import from the main menu.

  2. In the Import dialog browse to the folder containing data of interest.

  3. Double-click the .ecw file desired.

  4. An image and the image's table will be created in the project.  

 

 

Double-clicking on the ithaca.ecw file in the Import dialog as seen above will create an image and the image's table in our project.

 

 

We can double-click on the image to open it.

 

 

For a more interesting display, we first create a new data source using a Bing street maps imageserver as shown in the Example: An Imageserver Tutorial topic.   We then create a map and drag and drop the Bing layer into the map, and then we drag and drop the ithaca Image into the map.    The image will be re-projected on the fly to match the Pseudo-Mercator projection used by the map.

Opacity / Transparency

ECW files written using the ECW SDK prior to version 4.1 do not support an alpha channel.  The displays above show that limitation of older ECW files: they do not allow transparent pixels, so any parts of the rectangular image that do not contain useful imagery are filled in with some color, typically white or black.

 

ECW files written using version 4.1 or greater of the SDK can have a fourth, opacity channel, which can be either 0 (fully transparent) or 255 (full opaque).   Values other than 0 or 255 are not allowed.   Manifold reads ECW files using the latest Hexagon ECW SDK, so any ECW files that have an opacity channel are imported with the correct value interpreted as opacity, so that pixels which were stored with opacity values of 0 will be imported and automatically inverted to show transparency values of 255 in the style pane.  When Manifold writes ECW files, it use the ER Mapper SDK to enable writing of any size ECW files as Version 2, which do not support use of alpha opacity/transparency.

 

Alpha channels may be interpreted as setting either opacity, or transparency.   When an alpha channel sets opacity, a high value in the channel means greater opacity, with a value of 255 meaning completely opaque and a value of 0 meaning totally transparent.  When an alpha channel sets transparency, a high value means more transparency.  Some formats, such as ECW images, specify alpha as opacity, so that is how Manifold imports alpha channel data for ECW, interpreting 255 within the ECW file as full opacity and 0 within the ECW file as full transparency.   

 

The Style pane reports values for the alpha channel as transparency.   When importing an ECW, the values within the ECW file will be automatically inverted to show a value of 255 in the Style pane's alpha channel for transparent pixels and a value of 0 in the alpha channel for opaque pixels.

Examples

For step-by-step examples of both importing and linking an ECW image, see the Example: Import or Link ECW topic.

Notes

16 bit values - Reading ECW reads and retains 16-bit values in raw format.  Early Release 9 builds mapped such 16-bit values to 8-bit RGB.

 

Valid datums and RAW coordinate systems - Reading an ECW with a coordinate system that specifies a valid datum and also specifies a RAW coordinate system preserves the datum info, even though this combination is disallowed by the ECW specification.

 

A difference from Manifold 8 - Manifold System Release 8.00 imported ECW images as a special class of compressed image stored within the Release 8 project in compressed form, also using ECW compression for that internally stored image.   Contemporary Manifold GIS products do not do that but use the same, hyper-fast storage mechanism all components within a project use.  An ECW image imported into a Manifold project thus becomes in a native Manifold image.

 

ECW vs MrSID - For a quick comparison of the two wavelet compression technologies see the Notes in the  SID, MrSID topic.   To summarize the comparison: when given a choice, choose ECW.

 

See Also

Assign Initial Coordinate System

 

Style

 

Example: Import or Link ECW