Example: Import or Link ECW

This topic provides step-by-step examples showing how to link an image from an ECW file into a project and also how to import an image from an ECW file into a project.   For important background on ECW format please read the ECW topic before proceeding with this example.

Linking an ECW

Linking an ECW is the most common operation so we will cover that first.

 

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. Choose the cache option desired, for example unchecking the Save cache box to keep file size small.

  5. Press Open.  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.

 

dlg_link_ecw01.png

 

The Save cache box allows save or not save cache.

 

dlg_link_ecw02.png

 

Most often when linking to a format like ECW, which is fast for links, we will ensure the Save cache box is not checked.    If we check the box then Manifold will build a cache within the project file that contains all the imagery we fetch from the ECW.  That will make display go faster for repeat views, but at the cost of growing the size of the project file when we save it, potentially to very large sizes.  

 

ECW is so fast as a viewing technology that there is no need to cache imagery within the project file for acceptable performance.  We therefore un-check the Save cache box and then we click Open.

 

il_link_ecw01_01.png

That creates a data source that contains an image and the image's table in our project.  We expand the data source by clicking the + icon next to the database cylinder and then we can double-click on the image to open it.

 

il_link_ecw01_02.png

 

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.

 

The display above shows a limitation of 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.

 

il_link_ecw01_03.png

 

Zooming into the map we see the image shows the town of Ithaca, New York, including much of Cornell University.

 

il_link_ecw01_04.png

We can save the project as a Manifold .map format file called ithaca_link.map.   As can be seen above the saved size of the project is only 1 megabyte.   

 

The project is so small because all of the image data has stayed resident within the ithaca.ecw file that was linked into the project.   To generate views as we pan and zoom within the image, or add it as a layer to maps, the system will automatically pull imagery as needed from the linked ithaca.ecw file.

Importing an ECW

We will now shift gears and import the same ECW file.  As noted in the ECW topic, importing an ECW into Manifold will decompress the file into all the pixels involved for the full extent of the file, potentially a huge number of pixels for a large file.    

 

The import creates a native Manifold RGBA image that is stored entirely within the Manifold project and which no longer has any connection to the ECW file from which it was imported.

 

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.  

 

 

dlg_import_ecw.png

 

Double-click on the ithaca.ecw file to import it.   No need to change the file filter from All Files (*.*) to ECW Files (*.ecw), as Manifold will automatically recognize the .ecw file and use the ECW dataport to import it.   

 

The .ecw is a 200 MB file.  Given typical compression ratios used by ECW technology it contains a compressed image that is several gigabytes in size, so we should expect the import to take a minute or two.

 

il_import_ecw01_01.png

Importing the .ecw results in an image and the image's table.    If we double-click the image to open it we can read information about the image in the Component panel of the Contents pane, and we can right-click on the image in the Project pane and choose Properties to get more info.

 

il_import_ecw01_02.png  il_import_ecw01_02a.png

 

From the Properties dialog Rect property we see the ithaca Image is 30001 x 44001 pixels in size, a total of 1.32 billion pixels.  The Component panel tells us the tiles in the image are unit8x3, so it is an RGB image with 3 bytes per pixel.  At 3 bytes per pixel (one each for R, G, and B channels) the image requires almost 4 gigabytes.    When it was compressed as an ECW (and losing content as a result as discussed below)  the ithaca image required only a 200 megabyte file, but immediately upon import and decompression into a Manifold RGBA image it expands to the full 4 gigabytes required for a Manifold  image of that size.

 

il_import_ecw01_03.png

 

As we did above in the linked image example, we can create a map using Bing as a background and then drag and drop the ithaca Image into it as a layer.  The image will be re-projected on the fly to match the Pseudo-Mercator projection used by the map, a process that seems to happen instantly even though the image is 4 gigabytes in size.

 

il_import_ecw01_04.png

 

Zooming into the image we see what was imported is identically the same as the linked image that is served into the Manifold project from a linked ECW file.

 

il_import_ecw01_05.png

 

Zooming even further into the image we can see that the smaller size of the compressed image within the ECW was achieved, in part, by discarding part of the information content of the image.   The decompression is lossy, that is, not all of the data is retained that was in the original photograph before it was compressed using ECW wavelet technology and stored in the ECW file.   The technology depends upon a reconstitution where some of the pixels in the reconstituted image were not stored, but instead are computed based on what the ECW algorithms think they should be.

 

The full-sized image is indeed 30001 x 44001 pixels in size, but not all of those 1.3+ billion pixels were each stored in the ECW file.   Instead, many of the pixels that are required to fill out a full-sized 30001 x 44001 image are computed on the fly by the ECW code when the image is decompressed, the pixel values being generated by what the decompression algorithm thinks they should be based on the subset of data that was stored in the ECW.

 

The zoomed-in image above shows decompression artifacts, not-quite-right patterns of pixels in some regions, where the decompression algorithms produced a result visibly different from what the original photograph must have been.   All the same, even though what was decompressed from 200 MB into 4 GB is an imperfect reproduction of what the original photograph must have been, the image still occupies a large amount of space because it is indeed 30001 x 44001 pixels in size.

 

il_import_ecw01_06.png

 

Saving the file we see that the Manifold .map file that saves the project is over 5 GB in size, as predicted by the size of the image.   Manifold has created numerous intermediate level images to use for faster performance when displaying the image, so the overall size of the file is larger than just the raw image.

 

Importing the ECW does produce a native image within the project which can be manipulated by the full power of Manifold.  But in the case of an imported ECW, if the ECW was compressed using lossy compression (as are most ECWs), we start with an image that is highly imperfect given the size of the image.   It would be better to simply get a scan of the original photograph at 30001 x 44001 pixels and to use that, so we can take advantage of full detail before any losses as a result of round-trip, lossy compression and decompression.  

See Also

ECW

 

Example: Spectacular Images and Data from Web Servers

 

Example: An Imageserver Tutorial