DiceRasterByTileCount Task

This task separates a raster into a specified number of tiles in the X and Y direction. You can optionally create a vector shapefile that shows the tile boundaries.

Example

; Start the application

e = ENVI()

 

; Open an input file

File = Filepath('qb_boulder_msi', Subdir=['data'], $

  Root_Dir=e.Root_Dir)

Raster = e.OpenRaster(File)

 

; Get the task from the catalog of ENVITasks

Task = ENVITask('DiceRasterByTileCount')

 

; Define inputs

Task.INPUT_RASTER = Raster

Task.NUMBER_OF_X_TILES = 4

Task.NUMBER_OF_Y_TILES = 3

Task.TILE_GRID_VECTORS = 'true'

 

; Define the output directory

Task.OUTPUT_DIRECTORY = Filepath('', /TMP)

 

; Run the task

Task.Execute

 

; Get the collection of data objects currently in the Data Manager

DataColl = e.Data

 

; Add the output to the Data Manager

DataColl.Add, Task.OUTPUT_RASTER

 

; Display the results

View1 = e.GetView()

FOR i=0,N_Elements(Task.Output_Raster)-1 DO $

  Layer = View1.CreateLayer(Task.OUTPUT_RASTER[i])

vectorLayer = View1.CreateLayer(Task.OUTPUT_VECTOR)

View1.Zoom, /FULL_EXTENT

Syntax

Result = ENVITask('DiceRasterByTileCount')

Input properties (Set, Get): INPUT_RASTER, NUMBER_OF_X_TILES, NUMBER_OF_Y_TILES, OUTPUT_DIRECTORY, TILE_GRID_VECTORS

Output properties (Get only): OUTPUT_RASTER, OUTPUT_VECTOR

Properties marked as "Set" are those that you can set to specific values. You can also retrieve their current values any time. Properties marked as "Get" are those whose values you can retrieve but not set.

Methods

This task inherits the following methods from ENVITask:

AddParameter

Execute

Parameter

ParameterNames

RemoveParameter

Properties

This task inherits the following properties from ENVITask:

COMMUTE_ON_DOWNSAMPLE

COMMUTE_ON_SUBSET

DESCRIPTION

DISPLAY_NAME

NAME

REVISION

TAGS

This task also contains the following properties:

INPUT_RASTER (required)

Specify the input raster.

NUMBER_OF_X_TILES (required)

Specify the number of resulting tiles in the X direction.

NUMBER_OF_Y_TILES (required)

Specify the number of resulting tiles in the Y direction.

Example: The input image in the code example above has 1024 rows and 1024 columns. The example specifies 4 tiles in the X direction and 3 tiles in the Y direction. Since 1024 is divisible by both 3 and 4, the resulting tiles are equally sized (X: 256, Y: 342).

In most cases, the number of pixels (in both directions) will not be divisible by the specified number of tiles. For example, suppose that an image has 10 rows and 10 columns and you want to separate it into 3 tiles in the X and Y directions. Since 10 divided by 3 is 3.333, ENVI rounds up to the nearest integer (4) when creating the tiles. The last tile in each column and row will have smaller dimensions. The following figure shows how the tiles are created:

OUTPUT_DIRECTORY (optional)

Specify the output directory for the tiles. If set to an asterisk (*), the output rasters will be virtual. This will not be written to disk, and the directory will not be created. If you do not set this property, the tiles will save to the directory indicated by the ENVI Output Directory preference.

OUTPUT_RASTER

This property contains an array of output rasters. Their filenames contain the root name of the input raster with the row/column index appended in the form of RxCx. For example, R2C3 means row 2 and column 3.

OUTPUT_VECTOR

This property contains the output shapefile if you set the TILE_GRID_VECTORS property to true.

TILE_GRID_VECTORS (optional)

Set this property to true to create an output shapefile that shows the tile boundaries.

Version History

ENVI 5.4

Introduced

ENVI 5.5

OUTPUT_DIRECTORY now supports '*', which allows OUTPUT_RASTER to be virtual output.

API Version

4.2

See Also

ENVITask, ENVITask::Parameter, ENVISubsetRaster, CreateSubrectsFromDistance Task, CreateSubrectsFromPixels Task, CreateSubrectsFromTileCount Task, CreateSubrectsFromVector Task, DiceRasterByDistance Task, DiceRasterBySubrects Task, DiceRasterByPixel Task, DiceRasterByVector Task, ExportRastersToDirectory Task