Skip to main content

Images

Upload hyperspectral imagery, fetch image metadata, attach workspace labels, and download processed image files.

Module methods​

sdk.image exposes:

  • get(image_id): return one ImageResource
  • get_by_ids(image_ids): return a list of resources
  • upload(file_paths, name, folder_id, geotiff_source=None, processing_level=REFLECTANCE): import one HSI file bundle and return its image resource

Pass every required file in file_paths. geotiff_source is optional and is used to identify a GeoTIFF provider such as EnMAP; omit it for non-GeoTIFF imports. The selected processing_level describes the uploaded source data. It labels the values but does not convert or calibrate them.

REFLECTANCE is the method default, not an inference about the file contents. Set processing_level explicitly when the source values represent another level, and verify units and correction provenance before downstream analysis.

A returned image resource does not by itself confirm that background import processing has finished. Confirm the image's import status and available layers in Files before attaching labels or downloading a processed layer.

An ImageResource includes id, name, width, height, and top_processing_level. download(folder_path, correction_level=None) uses the top available level unless you pass a level explicitly.

Image downloads first prepare an archive on the server, then transfer and unpack it locally. The cache can remain empty during server preparation. The SDK reports the task UUID and status while waiting, followed by downloaded byte counts.

In the next SDK release, image.download(..., timeout=1800) limits the server preparation wait in seconds (30 minutes by default). A timeout raises TimeoutError and does not cancel the server task. Check its status before submitting another export, since repeated calls can queue duplicate work. Network transfers also have connection and idle-read timeouts.

Example​

from fusion_sdk.models.data_source_enum import DataSourceEnum
from fusion_sdk.models.hsi_processing_level_enum import HsiProcessingLevelEnum

image = sdk.image.upload(
file_paths=[
"/path/to/METADATA.XML",
"/path/to/SPECTRAL_IMAGE.TIF",
],
name="imported_enmap",
folder_id=19,
processing_level=HsiProcessingLevelEnum.RADIANCE,
geotiff_source=DataSourceEnum.ENMAP,
)

# Continue after import processing has finished and the input layer is ready.
image.upload_shapefiles(
workspace_id=8,
shapefile_paths=[
"/path/to/polygon.shp",
"/path/to/polygon.shx",
"/path/to/polygon.dbf",
"/path/to/polygon.prj",
],
)

image.download(
folder_path="/local/downloads",
correction_level=HsiProcessingLevelEnum.RADIANCE,
)

upload_shapefiles and upload_rasters import label sources into the specified workspace for this image; they do not add standalone files to the Files page.

upload_rasters submits each TIFF or ENVI bundle separately, keeping matching sidecar files together. With the current API, a call without target semantics stages the imported rasters for configuration in the workspace. A successful upload does not mean those targets have been finalized for training.

To configure targets during upload, pass target_type ("categorical" or "continuous"), class_data for categorical mappings, or ml_class_id and common_attribute_definition_id for a continuous target. Set should_finalize=True when the supplied configuration is ready for training. The same configuration applies to every raster in that call; call the method separately for rasters with different target meanings.