File

class qmenta.sdk.context.File(container_id, name, metadata, tags, comm)

Bases: object

get_file_modality()

Get the modality of the file.

Returns

Modality of the file or None if not known.

Return type

str or None

get_file_format()

Get the format of the file (e.g. ‘nifti’, ‘txt’, etc.).

Returns

File format or None if not known.

Return type

str

get_file_info()

Get the file information. The type of information depends on the type of file (e.g. nifti files include information such as ‘Data strides’, ‘Data type’, ‘Dimensions’ or ‘Voxel size’).

Returns

Dictionary of key-value pairs that depend on the format of the file.

Return type

dict

get_file_tags()

Get the file tags.

Returns

Set of tags associated to this file

Return type

set

get_file_path()

Get the file download path.

Returns

The path of the file where it has been downloaded

Return type

str

Raises

RuntimeError – If get_file_path is called before the file has been downloaded

download(dest_path, unpack=True)

Downloads a file or the contents of a packed file to to the specified path.

Parameters
  • dest_path – Path where the file should be downloaded to.

  • unpack – Tells the function whether the file should be unpacked to the given folder.

Returns

The full path of the file or the folder with the unpacked files.

Return type

str