Personal tools
  • We're Hiring!

You are here: Home Documentation Previous versions OME Server Developer Image Server Method Reference Files

Files

Methods that operate on Files

  • UploadFile - Upload a file to OMEIS.
    • Required Parameters:
    • UploadSize - The size of the file in bytes. This parameter is only required when using the command-line interface. The File's size is calculated from the Content-Length header for a POST request over http. POST requests without a Content-Length header are rejected.
    • File - The file in its original binary form is sent in a multi-part form as a POST request. The form field must be called "File" and it must be the last part of the form. This form field may also contain a "filename" attribute, whose value will be used as the file's name.
      When using the command line, the File parameter doesn't have to be specified, but if it is, its value will be used as the file's name. The raw binary file is read from stdin.
  • Return value:
    • FileID - A 64-bit unsigned integer, which can be interpreted as a 21-character string. This value should be used for the FileID parameter whenever calling methods on this file.
  • ReadFile - Read bytes from the uploaded file.
    • Required Parameters:
      • FileID - The File ID returned by UploadFile.
    • Optional Parameters:
      • Offset - Number of bytes to skip in the file before reading. By default, Offset=0.
      • Length - Number of bytes to read from the file. By default, Length is set so that the file will be read to its end.
    • Return value: The file in binary form with an application/octet-stream mime-type. If the entire file is being returned, and the request was over http, then a Content-Disposition header will be issued, which will cause the the file to be downloaded under its own filename in most browsers.
  • ImportOMEfile - Import the Pixels in a previously uploaded OME-XML file. This method is used to strip the OME-XML file of its embedded pixels.
    • Required Parameters:
      • FileID - The File ID returned by UploadFile.
    • Return value: An OME-XML document without its embedded pixels. All of the Pixels in the OME file will be imported into OMEIS. The embedded Pixels are removed from the XML document and the resulting document is returned by the request with a text/xml mime-type. The Pixels elements in the original XML are converted to their CustomAttributes form, and the BinData elements are removed. The OMEIS PixelsIDs for the extracted pixels are stored in the "ImageServerID" attribute of the Pixels elements.
  • ExportOMEfile - Export the Pixels in an OME file. This method is used to pack an OME-XML file with pixels from the OMEIS.
  • Required Parameters:
    • UploadSize - The size of the OME-XML file in bytes. This parameter is only required when using the command-line interface. The File's size is calculated from the Content-Length header for a POST request over http. POST requests without a Content-Length header are rejected.
    • File - The OME-XML file to be packed is sent in a multi-part form as a POST request. The form field must be called "File" and it must be the last part of the form.
      When using the command line, the File parameter doesn't have to be specified. The OME-XML file is read from stdin.
  • Return value: An OME-XML document with its embedded pixels. The Pixels elements in the provided XML document (using the File parameter) are in their CustomAttributes form, with OMEIS PixelIsDs stored in the the "ImageServerID" attribute of the Pixels elements. These PixelIDs are used to get the pixels from omeis, compress them, encode them with base64, and pack them into the OME-XML using one BinData element per plane. The resulting complete OME-XML document is returned by the request with a text/xml mime-type.
  • IsOMExml - Ask omeis to determine if the file referenced is an OME-XML file.
  • Required Parameters:
    • FileID - The File ID returned by UploadFile.
  • Return value: A boolean (0 or 1). A 1 is returned if the FileID refers to an OME-XML file, and a 0 otherwise.
  • DeleteFile - Permanently delete a file from OMEIS. This method should only be called if there were import problems with the specified file.
  • Required Parameters:
    • FileID - The File ID returned by UploadFile.
  • Return value:
    • FileID - A 64-bit unsigned integer, which can be interpreted as a 21-character string. This FileID will no longer be a valid File ID (OMEIS IDs are not recycled).
  • FileSHA1 - Get SHA1 digest of the File
  • Required Parameters:
    • FileID - The File ID.
  • Return value: The SHA1 digest of the File - a 40 character lower-case hex string.
  • FileInfo - Get information about the File.
    • Required Parameters:
      • FileID - The File ID.
    • Return values: A set of key - value pairs with one pair per line
      • Name=string - the filename of the file as specified by the filename attribute of the File parameter in the UploadFile call
      • Length=integer - Size of the file in bytes
      • SHA1=string - The SHA1 digest of the file, a 40 character lower-case hex string
    • Optional Return values: These values are only relevant (and returned) for files who share their common contents. Details.
      • IsAlias=integer - the ID of the file whose contents this file sym-links to.
      • HasAlias=string - this is a tab delimited string of IDs. The IDs represent the files that sym-link to this file's contents.
  • GetLocalPath - Get the file path used by OMEIS for the specified File.
    • Required Parameters:
      • FileID - The File ID.
    • Return value: a string containing the file path for the given FileID
  • ZipFiles - Compose a .zip archive of multiple files and read the bytes of the archive
    • Required Parameters:
      • FileID - The File ID returned by UploadFile. There may be more than one File ID in this parameter, in which each File ID is seperated by a comma (",").
    • Optional Parameters:
      • OrigName - The original name of the dataset from which all of the image files originate from. This parameter, plus a ".zip" file extension, will be the name of the archive returned to the user. By default, OrigName will be set to "images"
    • Return value: The .zip file in binary form with an application/octet-stream mime-type. If the entire file is being returned and the request was over http, then the Content-Disposition header will be issued, with a filename specified by either the parameter OrigName or the default name ("images.zip").
Document Actions