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.

 

 

The Save cache box allows save or not save cache.

 

 

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.

 

 

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 to see the ithaca Image within.  

 

For a more interesting display, we create a map n Pseudo-Mercator using a Bing streets image server as a base layer, and the ithaca Image as a layer.   We also add a Google image server layer that shows streets and labels with transparent pixels in between.   

 

 

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.  The ithaca Image is re-projected on the fly to match the Pseudo-Mercator projection used by the map.

 

 

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

 

 

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.

 

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 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.

 

Before moving on to the next section of this example, we save the .map project file using the name of ithaca.map.

 

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.  

 

 

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 Import dialog shows the .map file we saved, and also the .mapcache file Manifold created for the cache for the linked image.

 

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.

 

 

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 opened image in the Info pane.

 

  

 

From the Info pane we see the ithaca Image is 30001 x 44001 pixels in size, a total of 1.32 billion pixels.  The Info pane 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.

 

When working with undocked panes, if we have the Info pane sized to minimum width, there may not be enough horizontal room to display the full numbers and units of the Pixel size values.

 

 

That is easy to fix by simply dragging the right border of the pane to make it wider.  

 

 

As we did above in the linked image example, we can create a map using Bing as a base layer 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.

 

 

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.

 

 

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.

 

 

We can switch to the linked image, also a layer in the map, to see how the false coloring and hill shading reveals regular artifacts.

 

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.

 

 

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

Style Pane

 

ECW

 

Example: Spectacular Images and Data from Web Servers

 

Example: An Imageserver Tutorial