5.1. AbstractImageIOModule

5.1.1. Detailed Description

Abstract image IO class that provides overridable methods to determine custom image input and output operations. Every overridable method must be implemented. The methods should not call each other.
class mocha.mediaio.AbstractImageIOModule
class mocha.mediaio.AbstractImageIOModule(format_name, extensions, save_image_formats, save_image_types[, is_clip_loader=false])
Parameters:
  • format_name (unicode) – Short description of custom format, e.g. “Maya Image Format”.
  • extensions (list of strings) – List of supported extensions, e.g. [‘.iff’].
  • save_image_formats (list of PixelFormat) – List of supported PixelFormat to persist.
  • save_image_types (list of ChannelType) – List of supported ChannelType to persist.
  • is_clip_loader (PySide.QtCore.bool) – True if the loader returns multiple frames from a single file (such as with .MOV or .AVI).

Creates and registers custom image IO module. Create its instance in custom Python bootstrapping code to obtain appropriate image format in mocha backend.

AbstractImageIOModule.accepts_ext(extension)
Return type:PySide.QtCore.bool
Parameters:extension (unicode) – Absolute path to an image file.

Implements checking whether given file extension is acceptable by the module.

AbstractImageIOModule.accepts_file(file_name)
Return type:PySide.QtCore.bool
Parameters:file_name (unicode) – Absolute path to an image file.

Implements checking whether image file is acceptable by the module. Being called upon project opening.

AbstractImageIOModule.channel_type(file_name)
Return type:mocha.project.ChannelType
Parameters:file_name (unicode) – Absolute path to an image file.

Implements channel type getting for given file.

Parameters:file_name – Absolute path to an image file.

Implements channel type getting for given file.

AbstractImageIOModule.get_fps(path)
Return type:PySide.QtCore.float
AbstractImageIOModule.get_frame_count(path)
Return type:PySide.QtCore.float
AbstractImageIOModule.get_gamma(file_name)
Return type:mocha.project.OptionalFloat
Parameters:file_name (unicode) – Absolute path to an image file.

Implements gamma value getting. Return None if the module does not support this.

AbstractImageIOModule.get_interlace_mode(file_name)
Return type:mocha.project.InterlaceMode or None
Parameters:file_name (unicode) – Absolute path to an image file.

Implements interlace mode getting. Return None if the module does not support this.

AbstractImageIOModule.get_metadata(path, frame_number, stream_name)
Return type:Dictionary with keys of type QString and values of type QVariant.
AbstractImageIOModule.get_stream_names(path)
Return type:list of QString
AbstractImageIOModule.image_size(file_name)
Return type:PySide.QtCore.QSize
AbstractImageIOModule.load_image(image, path, frame_number, stream_name)
AbstractImageIOModule.pixel_format(file_name)
Return type:mocha.project.PixelFormat
Parameters:file_name (unicode) – Absolute path to an image file.

Implements checking whether given file extension is acceptable by the module.

AbstractImageIOModule.save_image(image, path)
Parameters:
  • image (mocha.project.ImageData) – Complete image instance.
  • path (unicode) – Absolute path to an image file to save.

Implements image saving.

Important: mocha presents vertically flipped images only.

AbstractImageIOModule.supports_image(file_name, format, pixels_type)
Return type:

PySide.QtCore.bool

Parameters:
  • file_name (unicode) – Absolute path to an image file.
  • format (mocha.project.PixelFormat) – Image format.
  • pixels_type (mocha.project.ChannelType) – Pixels type.

Implements checking whether the module supports image persisting with given path, image format and pixels type.