Main Content


Create R-Set file from image file



rsetfile = rsetwrite(filename) creates a reduced resolution dataset (R-Set) file from the specified input. The input file must be a TIFF or NITF image file. The function writes the generated R-Set file to the current working folder and has same file name as the input but with an rset extension.

rsetfile = rsetwrite(filename,rsetfilename) specifies the name of R-Set file using rsetfilename.

rsetfile = rsetwrite(adapter,rsetfilename) creates an R-Set file named rsetfilename from an ImageAdapter object, adapter. Use this syntax when creating an R-Set file from a type of image file that is not TIFF or NITF.


collapse all

Load a TIFF image file into the workspace.

filename = "mandi.tif";

Create an R-Set file from the image file. The function creates the R-Set in the current working folder.

rsetfile = rsetwrite(filename);

Display the R-Set file by using the imtool function.


Zoom in on the R-Set by 65% to view the spatial tiles.


Input Arguments

collapse all

Name of a TIFF or NITF image file, specified as a character vector or string scalar.

Data Types: char | string

Name for the output R-Set file, specified as a character vector or string scalar. If rsetfilename is not specified, filename sets the name of R-Set file, rsetfile.

Data Types: char | string

Image adapter object, specified as an ImageAdapter object. An ImageAdapter is a user-defined object that provides rsetwrite function with a common API to read a particular image file format.

Output Arguments

collapse all

Name of the R-Set file, returned as a string scalar. This value specifies the name of the file to which the R-Set is stored.


  • rsetwrite creates an R-Set by dividing an image into spatial tiles and resampling the image at different resolution levels. The R-Set file contains a compressed copy of the full-resolution image data. You can use the Image Tool (imtool) to open the R-Set file and zoom in to view the tiles at a higher resolution. When you zoom out, the function displays tiles at a lower resolution. In this way, an R-Set file balances clarity of the image and memory usage for optimal performance.

  • When creating an R-Set, a progress bar shows the status of the completion. If you cancel the creation process before it is complete, the function does not create an R-Set and returns an empty rsetfile.

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

  • You can create an R-Set from an image whose dimensions are smaller than the size of a single R-Set tile. However, the resulting R-Set file might be larger and take longer to load than the original file. The current size of a tile in an R-Set is 512-by-512 pixels.

Version History

Introduced in R2009a