How to use the aicsimageio.exceptions.InvalidDimensionOrderingError function in aicsimageio

To help you get started, we’ve selected a few aicsimageio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AllenCellModeling / aicsimageio / aicsimageio / aics_image.py View on Github external
----------
        dims: str
            A string containing a list of dimensions being requested. The default is to
            return the six standard dims.

        Returns
        -------
        size: Tuple[int]
            A tuple with the requested dimensions filled in.
        """
        # Ensure dims is an uppercase string
        dims = dims.upper()

        # Check that dims requested are all a part of the available dims in the package
        if not (all(d in Dimensions.DefaultOrder for d in dims)):
            raise InvalidDimensionOrderingError(f"Invalid dimensions requested: {dims}")

        # Check that the dims requested are in the image dims
        if not (all(d in self.dims for d in dims)):
            raise InvalidDimensionOrderingError(f"Invalid dimensions requested: {dims}")

        # Return the shape of the data for the dimensions requested
        return tuple([self.dask_data.shape[self.dims.index(dim)] for dim in dims])
github AllenCellModeling / aicsimageio / aicsimageio / readers / tiff_reader.py View on Github external
def dims(self, dims: str):
        # Check amount of provided dims against data shape
        if len(dims) != len(self.dask_data.shape):
            raise exceptions.InvalidDimensionOrderingError(
                f"Provided too many dimensions for the associated file. "
                f"Received {len(dims)} dimensions [dims: {dims}] "
                f"for image with {len(self.data.shape)} dimensions "
                f"[shape: {self.data.shape}]."
            )

        # Set the dims
        self._dims = dims
github AllenCellModeling / aicsimageio / aicsimageio / aics_image.py View on Github external
----------
        dims: str
            A string containing a list of dimensions being requested. The default is to
            return the six standard dims.

        Returns
        -------
        size: Tuple[int]
            A tuple with the requested dimensions filled in.
        """
        # Ensure dims is an uppercase string
        dims = dims.upper()

        # Check that dims requested are all a part of the available dims in the package
        if not (all(d in Dimensions.DefaultOrder for d in dims)):
            raise InvalidDimensionOrderingError(f"Invalid dimensions requested: {dims}")

        # Check that the dims requested are in the image dims
        if not (all(d in self.dims for d in dims)):
            raise InvalidDimensionOrderingError(f"Invalid dimensions requested: {dims}")

        # Return the shape of the data for the dimensions requested
        return tuple([self.dask_data.shape[self.dims.index(dim)] for dim in dims])
github AllenCellModeling / aicsimageio / aicsimageio / readers / default_reader.py View on Github external
def dims(self, dims: str):
        # Check amount of provided dims against data shape
        if len(dims) != len(self.dask_data.shape):
            raise exceptions.InvalidDimensionOrderingError(
                f"Provided too many dimensions for the associated file. "
                f"Received {len(dims)} dimensions [dims: {dims}] "
                f"for image with {len(self.data.shape)} dimensions "
                f"[shape: {self.data.shape}]."
            )

        # Set the dims
        self._dims = dims
github AllenCellModeling / aicsimageio / aicsimageio / aics_image.py View on Github external
...     data = img.get_image_data("ZYX", S=0, T=0, C=0)

        Notes
        -----
        When using the AICSImage context manager, the processing machine or container
        must have networking capabilities enabled to function properly.

        Constructor for AICSImage class intended for providing a unified interface for
        dealing with microscopy images. To extend support to a new reader simply add a
        new reader child class of Reader ([readers/reader.py]) and add the class to
        SUPPORTED_READERS variable.
        """
        # Check known dims
        if known_dims is not None:
            if not all([d in Dimensions.DefaultOrder for d in known_dims]):
                raise InvalidDimensionOrderingError(
                    f"The provided dimension string to the 'known_dims' argument "
                    f"includes dimensions that AICSImage does not support. "
                    f"Received: '{known_dims}'. "
                    f"Supported dimensions: {Dimensions.DefaultOrderList}."
                )

        # Hold onto known dims until data is requested
        self._known_dims = known_dims

        # Dims should nearly always be default dim order unless explictly overridden
        self.dims = Dimensions.DefaultOrder

        # Determine reader class and create dask delayed array
        reader_class = self.determine_reader(data=data)
        self._reader = reader_class(data, **kwargs)
github AllenCellModeling / aicsimageio / aicsimageio / aics_image.py View on Github external
...     data = img.get_image_data("ZYX", S=0, T=0, C=0)

        Notes
        -----
        When using the AICSImage context manager, the processing machine or container
        must have networking capabilities enabled to function properly.

        Constructor for AICSImage class intended for providing a unified interface for
        dealing with microscopy images. To extend support to a new reader simply add a
        new reader child class of Reader ([readers/reader.py]) and add the class to
        SUPPORTED_READERS variable.
        """
        # Check known dims
        if known_dims is not None:
            if not all([d in Dimensions.DefaultOrder for d in known_dims]):
                raise InvalidDimensionOrderingError(
                    f"The provided dimension string to the 'known_dims' argument "
                    f"includes dimensions that AICSImage does not support. "
                    f"Received: '{known_dims}'. "
                    f"Supported dimensions: {Dimensions.DefaultOrderList}."
                )

        # Hold onto known dims until data is requested
        self._known_dims = known_dims

        # Dims should nearly always be default dim order unless explictly overridden
        self.dims = Dimensions.DefaultOrder

        # Determine reader class and create dask delayed array
        reader_class = self.determine_reader(data=data)
        self._reader = reader_class(data, **kwargs)