Segment

Segment

The Segment task takes a single raster dataset as input and uploads the image to the cloud storage.

The input raster dataset can be clipped, resampled, and reprojected based on the setting.

Request URL

http://<analysis url>/Segment/submitJob?
inputRaster={"itemId": "1780d648db3545bba8661ad98df824a4"}&
outputName={“itemId": "04180233981a4b978755d854687e149e"}&
spectralDetail=15.5&
spatialDetail=15&
minimumSegmentSizeInPixels=20&
bandIndexes="0,1,2"&
removeTilingArtifacts="true"

Request Parameters

The following is a list of parameters with syntax and details for each.

Parameter

Description

inputRaster

(Required)

The complete JSON rft (URI or by value), the complete XML rft (URI or by value), Portal Item ID, Image Service URL, cloud raster dataset, or shared raster dataset that will be segmented.

Syntax: A string describes the input raster.

Example:

{"itemId": <portal item id>}
{"url": <image service url}
{"serviceProperties":{"name":"testrasteranalysis",
  "serviceUrl":"http://<server name>/server/rest/services/Hosted/testrasteranalysis/ImageServer"},
  "itemProperties":{"itemId":"8cfbd3ec25584d0d8f4ed23b8ff7c43b", "folderId", "sdfwerfbd3ec25584d0d8f4",: }}

Example 2:

{  
   "rasterFunction":"SegmentMeanShift",
   "rasterFunctionArguments": {  
      "SpectralDetail":15.5,
      "SpatialDetail":15,
      "MinNumPixelsPerSegment":20,
      "Raster":<image service url>
   }
}

If a complete rft (JSON or XML, URI or by value) is given, then spectralDetail, spatialDetail, minimumSegmentSizeInPixels , and bandIndexes will not be honored. This option is used by ArcGIS Pro and web apps.

Note: If multiple inputs are given the itemId takes the priority.

outputName

(Required)

The location where the service will generate the output raster.

Syntax: JSON object that describes the output raster.

Example:

{"itemId": <portal item id>}
{"url": <image service url}
{"serviceProperties":{"name":"testrasteranalysis",
  "serviceUrl":"http://<server name>/server/rest/services/Hosted/testrasteranalysis/ImageServer"},
  "itemProperties":{"itemId":"8cfbd3ec25584d0d8f4ed23b8ff7c43b", "folderId", "sdfwerfbd3ec25584d0d8f4",: }}

At least one type of input needs to be provided in the JSON object. If multiple inputs are given, the itemId takes the priority.

spectralDetail

Set the level of importance given to the spectral differences of features in your imagery.

Valid values range from 1.0 to 20.0. A high value is appropriate when you have features you want to classify separately but have somewhat similar spectral characteristics. Smaller values create spectrally smoother outputs. For example, with higher spectral detail in a forested scene, you will be able to have greater discrimination between the different tree species.

Example: 15.5

spatialDetail

Set the level of importance given to the proximity between features in your imagery.

Valid values range from 1 to 20. A high value is appropriate for a scene where your features of interest are small and clustered together. Smaller values create spatially smoother outputs. For example, in an urban scene, you could classify an impervious surface using a smaller spatial detail, or you could classify buildings and roads as separate classes using a higher spatial detail.

Example: 15

minimumSegmentSizeInPixels

Merge segments smaller than this size with their best fitting neighbor segment. Units are in pixels.

Example: 20

bandIndexes

Define which 3 bands are used in segmentation. The value is a string of three numbers, separated by commas.

Example: 0,1,2

removeTilingArtifacts

If the value is false or 0, the tool will not run to remove tiling artifacts after segmentation. The result may seem blocky at some tiling boundaries.

Example: false

Response

When you submit a request, the task assigns a unique job ID for the transaction.

Syntax:

{ "jobId": "<unique job identifier>", "jobStatus": "<job status>" }

After the initial request is submitted, you can use the jobId to periodically check the status of the job and messages as described in Checking job status. Once the job has successfully completed, use the jobId to retrieve the results. To track the status, you can make a request of the following form:

http://<analysis url>/Segment/jobs/<jobId>

Accessing results:

When the status of the job request is esriJobSucceeded, you can access the results of the analysis by making a request of the following form:

http://<raster analysis url>/Segment/jobs/<jobId>/results/outputRaster?token=<your token>&f=json

Parameter

Description

outputRaster

The output raster item ID and URL.

Example: {"url": "http://<raster analysis url>/Segment/jobs/<jobId>/results/outputRaster"}

The result has properties for parameter name, data type, and value. The content of the value is always the output raster dataset itemId and the image service url.

{
 "paramName": "outputRaster",
 "dataType": "GPString",
 "value": {
  "itemId": "f121390b85ef419790479fc75b493efd", 
  "url": "https://<server name>/arcgis/rest/services/Hosted/<service name>/ImageServer"
 } 
}

Related topics

10/6/2017