![]() |
IOLink Python
IOL_v1.1.0_release
|
Public Member Functions | |
| def | __init__ (self, *args, **kwargs) |
Static Public Member Functions | |
| def | allocate (*args) |
| def | copy_in_memory (image) |
| def | create_on_disk (*args) |
| def | copy_on_disk (*args) |
| def | from_random_access (*args) |
| def | from_image_view (view, properties, metadata) |
| def | uniform (*args) |
| def | adapt_dynamic_range (view, type, inputRange, outputRange) |
| def | adapt_data_type (view, type) |
| def | extract_channel (view, idxChannel) |
| def | extract_region (view, region) |
| def | extract_adjusted_region (view, region) |
| def | stack (*args) |
| def | assemble_channels (image) |
| def | disassemble_channels (image) |
| def | interlace (*args) |
| def | reinterpret (image, newImageType) |
| def | reinterpret_axes (image, dimensionsList) |
| def | sub_sample (image, step) |
| def | flip (*args) |
| def | make_thread_safe (image) |
| def | from_buffer (shape, dtype, buffer, properties=None, metadata=None) |
Properties | |
| thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") | |
This factory is aimed at creating dataset views. By default, ImageViews returned by this factory are __not__ thread safe. Only #makeThreadSafe method allows to apply threadsafety guarantee on an ImageView. [READ]: 'READ' [WRITE]: 'WRITE' [BUFFER]: 'BUFFER' [RESHAPE]: 'RESHAPE'
|
static |
Creates an ImageView from another view with given type. No memory is allocated by this operation. Capabilities of returned ImageView will depend on original ImageView, and will be restricted to (see #ImageCapability): - READ - WRITE One or many adapters will be added if necessary to convert from input view type to output View type. Data will be mapped to full output type range. For example, if given view is 16 bits with valueRange [1000, 2000] and type is uint8, input range [1000, 2000] will be mapped to output range [0, 255]. Input data range are read from view properties. Output range is specified type standard range. It can be retrieved with DataType::standardRange(type). :type view: :py:class:`ImageView` :param view: The source image :type type: :py:class:`DataType` :param type: The target datatype :raises: InvalidArgument If properties of input ImageView are not valid :raises: InvalidArgument If type cardinality is different of original type :raises: InvalidArgument If given type is not numeric :raises: Error if Input view does not support READ or WRITE capability
|
static |
Creates an ImageView from another view with given type by mapping dynamic range. No memory is allocated by this operation. Capabilities of returned ImageView will depend on original ImageView, and will be restricted to (see #ImageCapability): - READ - WRITE This method will map [inputRange[0], inputRange[1]] -> [outputRange[0], outputRange[1]] One or many adapters will be added if necessary to convert from input view type to output View type. Data will be mapped to full output type range. For example, if given view is 16 bits with valueRange [1000, 2000] and type is uint8 with input range [20, 50], input range [1000, 2000] will be mapped to output range [20, 50]. If input image contains value outside of given inputRange, these values will be linearly mapped outside of outputRange. For example, with [0, 1]->[0, 2], a value of -1 will be mapped to -2. Warning: No clamp are done for values outside of type admissible values. Invalid ranges may lead to overflow issues. :type view: :py:class:`ImageView` :param view: Input view :type type: :py:class:`DataType` :param type: Requested data type :type inputRange: :py:class:`Vector2d` :param inputRange: Range of data in input view :type outputRange: :py:class:`Vector2d` :param outputRange: Requested output range :raises: InvalidArgument If properties of input ImageView are not valid :raises: InvalidArgument If type cardinality is different of original type :raises: InvalidArgument If given type is not numeric :raises: Error if Input view does not support READ or WRITE capability
|
static |
*Overload 1:* Creates a memory image with the given shape and type. Memory is allocated by this operation. Returned ImageView has following capabilities (see #ImageCapability): - READ - WRITE - BUFFER - RESHAPE :type shape: :py:class:`VectorXu64` :param shape: The shape of the image (its dimension and sizes in all dimensions) :type type: :py:class:`DataType` :param type: The type of data contained in that view. :type properties: :py:class:`ImageProperties` :param properties: Properties to set to the allocated ImageView. If null, default properties are generated. :type metadata: :py:class:`MetadataNode` :param metadata: Metadata to set to the allocated ImageView :raises: Error If given properties are not compatible with given shape and type | *Overload 2:* Creates a memory image with the given shape and type. Memory is allocated by this operation. Returned ImageView has following capabilities (see #ImageCapability): - READ - WRITE - BUFFER - RESHAPE :type shape: :py:class:`VectorXu64` :param shape: The shape of the image (its dimension and sizes in all dimensions) :type type: :py:class:`DataType` :param type: The type of data contained in that view.
|
static |
Adapt a N dimensions scalar ImageView into a N-1 dimensions vectorial one. No memory is allocated by this operation. Capabilities of returned ImageView will be restricted to (see #ImageCapability): - READ It packs the values of CHANNEL dimension (or the last dimension if does not exist) into one sample vector. The dimension of this vector will be the size of the last dimension of the source ImageView. :type image: :py:class:`ImageView` :param image: The source ImageView :raises: InvalidArgument If properties of input ImageView are not valid :raises: Error If original ImageView does not support READ capability
|
static |
Copy given image in memory. Memory is allocated by this operation. Data from original ImageView (if not in memory) are duplicated. Returned ImageView has following capabilities (see #ImageCapability): - READ - WRITE - BUFFER - RESHAPE If the input image already is in memory, return it (no copy are done). :type image: :py:class:`ImageView` :param image: Image to load :raises: InvalidArgument If the source is null :raises: Error If the input ImageView does not support READ capability :raises: InvalidArgument If properties of input ImageView are not valid
|
static |
*Overload 1:* Load an image data into a temporary raw file on disk. The file is created in usual temporary directory and will be automatically deleted from disk when the instance of the returned ImageView is deleted. Samples are copied chunk by chunk to optimize memory consumption. Maximum chunk size is 1MB. No memory is allocated by this operation, only disk space is used. Returned ImageView has following capabilities (see #ImageCapability): - READ - WRITE - RESHAPE Original ImageView data are duplicated. Data from the returned ImageView are not linked to original ImageView. If given image is already on disk, a copy will be created in spite of all. :type image: :py:class:`ImageView` :param image: ImageView to load on disk :raises: InvalidArgument If properties of input ImageView are not valid :rtype: :py:class:`ImageView` :return: ImageView on disk | *Overload 2:* Load an image data into a temporary raw file on disk. The file will be removed from disk when the instance of the returned ImageView is deleted. Samples are copied chunk by chunk to optimize memory consumption. Maximum chunk size is 1MB. No memory is allocated by this operation, only disk space is used. Returned ImageView has following capabilities (see #ImageCapability): - READ - WRITE - RESHAPE Original ImageView data are duplicated. Data from the returned ImageView are not linked to original ImageView. If given image is already on disk, a copy will be created in spite of all. :type image: :py:class:`ImageView` :param image: ImageView to load on disk :type dirPath: string :param dirPath: path where temporary file is created (must exist) :raises: InvalidArgument if given directory path does not exist :raises: InvalidArgument If properties of input ImageView are not valid :rtype: :py:class:`ImageView` :return: ImageView on disk
|
static |
*Overload 1:* Create an image with the data stored into a temporary file (in given folder) on disk in raw. No memory is allocated by this operation, only disk space is used. Returned ImageView has following capabilities (see #ImageCapability): - READ - WRITE - RESHAPE The created file is automatically deleted when destroying the image. :type dirPath: string :param dirPath: the path to the folder where the temporary file will be created :type shape: :py:class:`VectorXu64` :param shape: The shape of the image (its dimension and sizes in all dimensions) :type type: :py:class:`DataType` :param type: The type of data contained in that view. :type properties: :py:class:`ImageProperties` :param properties: Properties to set to the allocated ImageView :type metadata: :py:class:`MetadataNode` :param metadata: Metadata to set to the allocated ImageView :raises: Error if given properties are not compatible with given shape and type :raises: InvalidArgument if given directory path does not exist | *Overload 2:* Create an image with the data stored into a temporary file (in given folder) on disk in raw. No memory is allocated by this operation, only disk space is used. Returned ImageView has following capabilities (see #ImageCapability): - READ - WRITE - RESHAPE The created file is automatically deleted when destroying the image. :type dirPath: string :param dirPath: the path to the folder where the temporary file will be created :type shape: :py:class:`VectorXu64` :param shape: The shape of the image (its dimension and sizes in all dimensions) :type type: :py:class:`DataType` :param type: The type of data contained in that view. :raises: InvalidArgument if given directory path does not exist | *Overload 3:* Create an image with the data stored into a temporary file on disk in raw. No memory is allocated by this operation, only disk space is used. Returned ImageView has following capabilities (see #ImageCapability): - READ - WRITE - RESHAPE The file is created in usual temporary directory and automatically deleted when destroying the image. :type shape: :py:class:`VectorXu64` :param shape: The shape of the image (its dimension and sizes in all dimensions) :type type: :py:class:`DataType` :param type: The type of data contained in that view. :type properties: :py:class:`ImageProperties` :param properties: Properties to set to the allocated ImageView :type metadata: :py:class:`MetadataNode` :param metadata: Metadata to set to the allocated ImageView :raises: Error if given properties are not compatible with given shape and type | *Overload 4:* Create an image with the data stored into a temporary file on disk in raw. No memory is allocated by this operation, only disk space is used. Returned ImageView has following capabilities (see #ImageCapability): - READ - WRITE - RESHAPE The file is created in usual temporary directory and automatically deleted when destroying the image. :type shape: :py:class:`VectorXu64` :param shape: The shape of the image (its dimension and sizes in all dimensions) :type type: :py:class:`DataType` :param type: The type of data contained in that view.
|
static |
Adapt a N dimensions vectorial ImageView into a N+1 dimensions scalar one. No memory is allocated by this operation. Capabilities of returned ImageView will be resctriced to (see #ImageCapability): - READ It unpacks samples to generate a CHANNEL dimension for each component. This new dimension will have the size of the original sample size. (e.g. disassemble a RGBA 2D ImageView will result into a 3D ImageView with CHANNEL dimension size = 4) :type image: :py:class:`ImageView` :param image: The source ImageView :raises: InvalidArgument If view already contains a CHANNEL dimension :raises: InvalidArgument If properties of input ImageView are not valid :raises: Error If original ImageView does not support READ capability
|
static |
Creates an ImageView of given region from given view, packing flat dimensions. Returned ImageView can potentially have a dimension count lesser than original one. It will depend on the required region. If one (or more) dimension of this region has its size equal to 1, this dimension will be skipped in returned ImageView. No memory is allocated by this operation. Capabilities of returned ImageView will depend on original ImageView, and will be restricted to (see #ImageCapability): - READ - WRITE :type view: :py:class:`ImageView` :param view: Original view on which we want to create a sub-region view :type region: :py:class:`RegionXu64` :param region: Region of the original view that we want to isolate to create a new view :raises: Error If input ImageView has nor READ or WRITE capability :raises: InvalidArgument If properties of input ImageView are not valid :raises: InvalidArgument If required region is empty
|
static |
Returns an ImageView from another view containing only given channel Index (useful when channel is not clearly identified). No memory is allocated by this operation. Capabilities of returned ImageView will depend on original ImageView, and will be restricted to (see #ImageCapability): - READ - WRITE :type view: :py:class:`ImageView` :param view: Original view on which we want to isolate given channel :type idxChannel: int :param idxChannel: Channel index between 0 and dataType dimension - 1 :raises: InvalidArgument If requested channel index does not exist :raises: InvalidArgument If properties of input ImageView are not valid :raises: Error If input image does not support READ or WRITE capability
|
static |
Creates an ImageView of given region from given view. No memory is allocated by this operation. Capabilities of returned ImageView will depend on original ImageView, and will be restricted to (see #ImageCapability): - READ - WRITE :type view: :py:class:`ImageView` :param view: Original view on which we want to create a sub-region view :type region: :py:class:`RegionXu64` :param region: Region of the original view that we want to isolate to create a new view :raises: Error If input ImageView has nor READ or WRITE capability :raises: InvalidArgument If properties of input ImageView are not valid :raises: InvalidArgument if required region is empty
|
static |
*Overload 1:* Flip an ImageView following the given dimension. No memory is allocated by this operation. Capabilities of returned ImageView will be resctriced to (see #ImageCapability): - READ :type image: :py:class:`ImageView` :param image: ImageView to flip :type dimension: int :param dimension: ImageDimension used for flipping :rtype: :py:class:`ImageView` :return: a ImageView flipped following given dimension :raises: Error If input image does not support READ capability :raises: InvalidArgument If image type is not known :raises: InvalidArgument If properties of input ImageView are not valid :raises: InvalidArgument If image does not contain given dimension | *Overload 2:* Flip an ImageView following the given dimension. No memory is allocated by this operation. Capabilities of returned ImageView will be resctriced to (see #ImageCapability): - READ :type image: :py:class:`ImageView` :param image: ImageView to flip :type dimensionIndex: int :param dimensionIndex: Dimension index used for flipping :rtype: :py:class:`ImageView` :return: a ImageView flipped following given dimension :raises: Error If input image does not support READ capability :raises: InvalidArgument If properties of input ImageView are not valid :raises: InvalidArgument if dimension count of given image is lesser than given dimension index
|
static |
Create an ImageView from a buffer :type shape: :py:class:`VectorXu64` :param shape: The shape of returned image :type dtype: :py:class:`DataType` :param dtype: The data type of returned image :param buffer: The buffer which contains the image data :return an ImageView with given shape and datatype which contains given image data
|
static |
Allows to apply specific properties and metadata to a ImageView without impact on originals.
No memory is allocated by this operation.
Returned ImageView has the same capabilities than original ImageView.
:type view: :py:class:`ImageView`
:param view: Input view
:type properties: :py:class:`ImageProperties`
:param properties: The new properties used by the returned image view.
If null, the returned image view uses a clone of the input view properties.
:type metadata: :py:class:`MetadataNode`
:param metadata: The new metadata used by the returned image view (can be null).
:raises: Error if given properties are not compatible with given shape and type
|
static |
*Overload 1:* Create an image from a RandomAccess. No memory is allocated by this operation. Returned ImageView has following capabilities (see #ImageCapability): - READ - WRITE :type accessor: :py:class:`RandomAccess` :param accessor: The RandomAccess from which reading data :type layout: int :param layout: The memory layout to use :type shape: :py:class:`VectorXu64` :param shape: The shape of the image to create :type type: :py:class:`DataType` :param type: The data type of the image :type properties: :py:class:`ImageProperties` :param properties: The properties to attach to the image. If null, default properties are generated. :type metadata: :py:class:`MetadataNode` :param metadata: A set of metadata to attach to the image :raises: Error If given properties are not compatible with given shape and type | *Overload 2:* Create an image from a RandomAccess. No memory is allocated by this operation. Returned ImageView has following capabilities (see #ImageCapability): - READ - WRITE :type accessor: :py:class:`RandomAccess` :param accessor: The RandomAccess from which reading data :type layout: int :param layout: The memory layout to use :type shape: :py:class:`VectorXu64` :param shape: The shape of the image to create :type type: :py:class:`DataType` :param type: The data type of the image | *Overload 3:* Create an image from a given RandomAccess. No memory is allocated by this operation. Returned ImageView has following capabilities (see #ImageCapability): - READ - WRITE Here the Memory layout is defaulted to Fortan. :type accessor: :py:class:`RandomAccess` :param accessor: The RandomAccess from which reading data :type shape: :py:class:`VectorXu64` :param shape: The shape of the image to create :type type: :py:class:`DataType` :param type: The data type of the image :type properties: :py:class:`ImageProperties` :param properties: The properties to attach to the image. If null, default properties are generated. :type metadata: :py:class:`MetadataNode` :param metadata: A set of metadata to attach to the image :raises: Error if the storage cannot contain a raw image with given shape and datatype :raises: Error if given properties are not compatible with given shape and type | *Overload 4:* Create an image from a given RandomAccess. No memory is allocated by this operation. Returned ImageView has following capabilities (see #ImageCapability): - READ - WRITE Here the Memory layout is defaulted to Fortan. :type accessor: :py:class:`RandomAccess` :param accessor: The RandomAccess from which reading data :type shape: :py:class:`VectorXu64` :param shape: The shape of the image to create :type type: :py:class:`DataType` :param type: The data type of the image :raises: Error if the storage cannot contain a raw image with given shape and datatype
|
static |
*Overload 1:* Interlace frames of a MultiImageView into an ImageView. No memory is allocated by this operation. Capabilities of returned ImageView will depend on capabilities of ImageViews contained in the multiImageView, and be resctriced to (see #ImageCapability): - READ - WRITE Frames contained in MultiImageViews are assembled to create an ImageView whose samples are the concatenation of samples from original ImageViews. i.e. 3 grayscale ImageViews with UINT16 datatype contained in a multiImageView First ImageView contains ABCDEFG..... values Second ImageView contains abcdefg... values Third ImageView contains 123456.... values Interlace operation gives an ImageViews with VEC3UINT16 datatype whose content is: Aa1 Bb2 Cc3 Dd4 Ee5 Ff6 Gg7..... Final interlaced ImageView will have Write access only if all original ImageViews (in multiImageView) have Write access :type multiView: :py:class:`MultiImageView` :param multiView: MultiImageView which contains ImageViews to interlace :type newInterpretation: int :param newInterpretation: interpretation to set for the interlaced ImageView (default is UNKNOWN) :type hasAlpha: boolean :param hasAlpha: indicates if the interlaced ImageView contains an Alpha channel (default is FALSE) :raises: InvalidArgument If multiImageView contains incompatible ImageViews (different shape or datatypes) :raises: InvalidArgument If one frame from multiImageView contains a CHANNEL dimension :raises: InvalidArgument If type of at least one frame is not scalar | *Overload 2:* Interlace frames of a MultiImageView into an ImageView. No memory is allocated by this operation. Capabilities of returned ImageView will depend on capabilities of ImageViews contained in the multiImageView, and be resctriced to (see #ImageCapability): - READ - WRITE Frames contained in MultiImageViews are assembled to create an ImageView whose samples are the concatenation of samples from original ImageViews. i.e. 3 grayscale ImageViews with UINT16 datatype contained in a multiImageView First ImageView contains ABCDEFG..... values Second ImageView contains abcdefg... values Third ImageView contains 123456.... values Interlace operation gives an ImageViews with VEC3UINT16 datatype whose content is: Aa1 Bb2 Cc3 Dd4 Ee5 Ff6 Gg7..... Final interlaced ImageView will have Write access only if all original ImageViews (in multiImageView) have Write access :type multiView: :py:class:`MultiImageView` :param multiView: MultiImageView which contains ImageViews to interlace :raises: InvalidArgument If multiImageView contains incompatible ImageViews (different shape or datatypes) :raises: InvalidArgument If one frame from multiImageView contains a CHANNEL dimension :raises: InvalidArgument If type of at least one frame is not scalar
|
static |
Make an ImageView threadsafe. No memory is allocated by this operation. Capabilities of returned ImageView will be the same than original image's. :type image: :py:class:`ImageView` :param image: ImageView to make threadsafe :rtype: :py:class:`ImageView` :return: an ImageView protected for multi-thread accesses.
|
static |
Reinterpret an ImageView with a new ImageTypeId. No memory is allocated by this operation. Capabilities of returned ImageView will depend on capabilities of input ImageView and be resctriced to (see #ImageCapability): - READ - WRITE It allows to modify the interpretation (VOLUME, IMAGE SEQUENCE, ...) of an any-dimension image. It does not change samples data reading, only image properties. When new interpretation is given, a quick check is done to verify compatibility with given ImageView. (number of dimensions should match with new interpretation) Specific case: ImageType::UNKNOWN can be set for any given ImageView without error :raises: Error If ImageType is incompatible with ImageView dimension :type image: :py:class:`ImageView` :param image: ImageView whose interpretation must be changed :type newImageType: :py:class:`ImageType` :param newImageType: Image interpretation to apply to image :rtype: :py:class:`ImageView` :return: a ImageView with new properties to match new image interpretation :raises: InvalidArgument If properties of input ImageView are not valid :raises: Error If new imageType is not comparible with given ImageView
|
static |
Reinterpret an ImageView by identifying each dimension (axis). No memory is allocated by this operation. Capabilities of returned ImageView will depend on capabilities of input ImageView and be resctriced to (see #ImageCapability): - READ - WRITE :type image: :py:class:`ImageView` :param image: ImageView to reinterpret :type dimensionsList: int :param dimensionsList: Ordered list of dimensions to affect to ImageView :type count: int :param count: Number of elements in the given list :rtype: :py:class:`ImageView` :return: a ImageView where dimensions are potentially reordered to match canonical order and with a new ImageTypeId :raises: Error If dimensionsList size does not match with image dimension. :raises: InvalidArgument If properties of input ImageView are not valid
|
static |
*Overload 1:* Creates an ImageView from a multiImageView by agglomerating frames into a new given dimension. No memory is allocated by this operation. Capabilities of returned ImageView will depend on original ImageViews contained in MultiImageView, and will be restricted to (see #ImageCapability): - READ - WRITE (i.e. a given multiImageView containing 2D frames (with Imagetype = IMAGE) and a given dimension equal to SEQUENCE will give as result a IMAGE_SEQUENCE - video - containing all the images) Concatenation of frames is possible only if their shapes, datatypes and ImageTypes are equal. A warning will be raised if given frames have an ImageType = UNKNOWN, because the given ImageDimension is ignored in this case, but the stack is still applied, and output ImageType will be UNKNOWN :type view: :py:class:`MultiImageView` :param view: MultiImage view which contains frames of same format and shape :type newDimension: int :param newDimension: interpretation of the new dimension to create :raises: InvalidArgument if all frames don't have same shape and datatype :raises: InvalidArgument if given new dimension already exist in given frames :raises: InvalidArgument if all frames don't have the same interpretation of axes | *Overload 2:* Creates an ImageView from a multiImageView by agglomerating frames into a new unidentified dimension. No memory is allocated by this operation. Capabilities of returned ImageView will depend on original ImageViews contained in MultiImageView, and will be restricted to (see #ImageCapability): - READ - WRITE (i.e. a given multiImageView containing 2D ImageViews will give as result 3D ImageView - containing all the images) Concatenation of frames is possible only if their shapes and datatypes are equal. New dimension is always created in **last position**. e.g.: 3 frames with shapes (5, 6) will be stacked into an 3D Image with shape (5, 6, 3) This method can be used with frames whose ImageType is not UNKNOWN, but as the new dimension is not given, the ImageType will be lost (UNKNOWN) in output ImageView. :type view: :py:class:`MultiImageView` :param view: MultiImage view which contains frames of same format and shape :raises: InvalidArgument if all frames don't have same shape and datatype
|
static |
Create a sub-sampled imageView from original. No memory is allocated by this operation. Capabilities of returned ImageView will be resctriced to (see #ImageCapability): - READ :type image: :py:class:`ImageView` :param image: ImageView to sub-sample :type step: int :param step: level of sub-sampling to apply New ImageView is created by picking one sample for every `step` samples of original ImageView. A step of 1 will give the same Image as the original :rtype: :py:class:`ImageView` :return: a Sub-Sampled ImageView from original ImageView :raises: InvalidArgument If properties of input ImageView are not valid :raises: InvalidArgument If step is 0 or not compatible with ImageView shape :raises: Error If input image does not support READ capability
|
static |
*Overload 1:* Create an image with uniform value. No memory is allocated by this operation. Returned ImageView has following capabilities (see #ImageCapability): - READ This image doesn't consume memory, so you can create an image as big as you want. :type shape: :py:class:`VectorXu64` :param shape: The shape of the image (its dimension and sizes in all dimensions) :type type: :py:class:`DataType` :param type: The type of data contained in that view. :type value: void :param value: Buffer should correspond to given DataType. If null is given, image is filled with zeros. :type properties: :py:class:`ImageProperties` :param properties: Optional properties. If null, default properties are generated. :type metadata: :py:class:`MetadataNode` :param metadata: Optional metadata. If null, no metadata are generated. :raises: InvalidArgument If given properties are not compatible with given shape and type | *Overload 2:* Create an image with uniform value. No memory is allocated by this operation. Returned ImageView has following capabilities (see #ImageCapability): - READ This image doesn't consume memory, so you can create an image as big as you want. :type shape: :py:class:`VectorXu64` :param shape: The shape of the image (its dimension and sizes in all dimensions) :type type: :py:class:`DataType` :param type: The type of data contained in that view. :type value: void :param value: Buffer should correspond to given DataType. If null is given, image is filled with zeros.