This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Create reduced resolution data set from image file


rsetfile = rsetwrite(File_Name)
rsetfile = rsetwrite(File_Name, output_filename)
rsetfile = rsetwrite(adapter, output_filename)


rsetfile = rsetwrite(File_Name) creates a reduced resolution data set (R-Set) from the specified file, where File_Name is a TIFF or NITF image file. The R-Set file is written to the current working directory with a name based on the input file name. For example, if File_Name is 'VeryLargeImage.tiff', rsetfile will be 'VeryLargeImage.rset'. If an image file contains multiple images, only the first one is used.

rsetfile = rsetwrite(File_Name, output_filename) creates an R-Set from the specified image file, using output_filename as the name of the new file. In this case, rsetfile and output_filename are identical.

rsetfile = rsetwrite(adapter, output_filename) creates an R-Set from the specified Image Adapter object, adapter. Image Adapters are user-defined classes that provide rsetwrite a common API for reading a particular image file format. See the documentation for ImageAdapter for more details.


Example 1: Create an R-Set File

Visualize a very large image by using an R-Set. Replace 'MyReallyBigImage.tif' in the example below with the name of your file:

big_file = 'MyReallyBigImage.tif';
rset_file = rsetwrite(big_file);

Example 2: Convert TIFF Files to R-Set Files

Create R-Set files for every TIFF in a directory containing very large images. Put the R-Set files into a temporary directory:

d = dir('*.tif*');
image_dir = pwd;
for p = 1:numel(d)
    big_file = fullfile(image_dir, d(p).name);


rsetwrite creates an R-Set file by dividing an image into spatial tiles and resampling the image at different resolution levels. When you open the R-Set file in the Image Tool and zoom in, you view tiles at a higher resolution. When you zoom out, you view tiles at a lower resolution. In this way, clarity of the image and memory usage are balanced for optimal performance. The R-Set file contains a compressed copy of the full-resolution data.

Because R-Set creation can be time consuming, a progress bar shows the status of the operation. If you cancel the operation, processing stops, no file is written, and the rsetfile variable will be empty.

rsetwrite supports NITF image files that are uncompressed and Version 2.0 or higher. It does not support NITF files with more than three bands or with floating point data. Images with more than one data band are OK if they contain unsigned integer data.

While it is possible to create an R-Set from an image where the dimensions are smaller than the size of a single R-Set tile, the resulting R-set file will likely be larger and take longer to load than the original file. The current size of an R-Set tile is 512 x 512 pixels.

See Also


Introduced in R2009a